[r810]: / trunk / mqttsparkplug / mqttsparkplug / SparkplugB / Function Blocks / FB_PrimaryHost / FB_PrimaryHost / PoolManager / allocDevicetoEdge / svnobj  Maximize  Restore  History

Download this file

18 lines (17 with data), 2.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
// Will try to allocate a new Device with the given name
METHOD allocDevicetoEdge :  REFERENCE TO FB_RemoteDevice
VAR_IN_OUT
    DeviceName : WSTRING;    
    itfEdge : IRemoteEdge;
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^( itfRemoteEdge := itfEdge,
                           Name := DeviceName );
        allocDevicetoEdge REF= _fb_RemoteDevice^;
    END_IF
END_IF