[r803]: / branches / FeatureBranches / PrimaryHost / SparkplugB / Function Blocks / FB_PrimaryHost / FB_PrimaryHost / PoolManager / allocDevicetoEdge / svnobj  Maximize  Restore  History

Download this file

20 lines (19 with data), 3.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
// Will try to allocate a new Device with the given name
METHOD allocDevicetoEdge :  REFERENCE TO FB_RemoteDevice
VAR_IN_OUT
    DeviceName : WSTRING;    
    itfEdge : IRemoteEdge;
    itfPrimaryHost :  IPrimaryHost;
END_VAR
VAR_OUTPUT
    eError : ERROR;
VAR
    _itfElement    : IElement;
    _itfElement := THIS^._DevicePool.HeadElem.RemoveElem(); //Remove it, but now it is not part of a group anymore
    IF __QUERYPOINTER( _itfElement,  _fb_RemoteDevice ) THEN
        _fb_RemoteDevice^( itfPrimaryHost := itfPrimaryHost,
                           itfRemoteEoN := itfEdge,
                           Name := DeviceName );
        allocDevicetoEdge REF= _fb_RemoteDevice^;
    END_IF
END_IF