<< Click to Display Table of Contents >> Navigation: Multi-Protocol MasterOPC Server > Lua 5.1 Reference Manual > Function library > The SERVER Library > Functions to Operate with Sub-Devices |
server.CheckUpdateCurrentSubDevice
server.CheckUpdateSubDeviceByName
server.GetCurrentSubDeviceCycle
server.ReadSubDeviceExtProperty
server.SetCurrentSubDeviceCycle
server.CheckUpdateCurrentSubDevice
The function returns FALSE after polling a subdevice. A function result can be used in order to reset a tag of forced poll (after usage of server.PollCurrentSubDevice ).
Example
––In a script after writing:
function OnWrite()
tag = server.ReadCurrentTag(); --read a tag value
if tag then
server.PollCurrentSubDevice (); --if the value is TRUE, poll the subdevice
end
end
––In a script after reading:
function OnRead()
local b = server.CheckUpdateCurrentSubDevice () –-contol poll execution
server.WriteCurrentTag(b,192); --reset the tag
end
server.CheckUpdateSubDeviceByName
The function returns FALSE after polling a subdevice specified in the function argument. A function result can be used in order to reset a tag of forced poll (after usage of server.PollSubDeviceByName ).
Example
––In a script after writing:
function OnWrite()
--read a tag value:
tag = server.ReadTag("Node1.Device1.SubDevice1.Tag1");
if tag then
--if the value is TRUE, poll the subdevice:
server.PollSubDeviceByName ("Node1.Device1.SubDevice1");
end
end
––In a script after reading:
function OnRead()
–-contol poll execution:
local b = server.CheckUpdateCurrentSubDevice("Node1.Device1.SubDevice1")
--reset the tag:
server.WriteTag("Node1.Device1.SubDevice1.Tag1",b,192);
end
server.GetCurrentSubDeviceCycle
Returns a period of poll of current subdevice by ms.
Initiates forced (out of order) poll of the current subdevice.
Example
server.PollCurrentSubDevice ();
Initiates forced (out of order) poll of a subdevice by a subdevice name.
Example
server.PollSubDeviceByName("Node1.Device1.SubDevice1");
server.ReadSubDeviceExtProperty
Returns a value specified for an axtra property of the current sub-device (see Setting Extra Properties ).
The function parameter is an extra property name.
Example
local Slot = server.ReadSubDeviceExtProperty("Slot");
server.SetCurrentSubDeviceCycle
Sets a period of poll of current subdevice by ms.