Enable or disable an IO server

The following script explains how to start or stop an IO server inside the Flexy thanks to BASIC script.

Let's assume that the IO server is initially enabled and has been configured like this (this content can be retrieved from the config.txt file):

IOSrv0:ABLOGIXIO
SrvData0:EnabledA:1¶PeriodA:2000¶GlobAddrA:10.0.0.30,1,0¶EnabledB:0¶EnabledC:0

In order to disable the IO server, the following command has to be executed:

setsys sys,"load"
setsys sys,"IOSrvData0","EnabledA:0"+chr$(13)+chr$(10)+"EnabledB:0"+chr$(13)+chr$(10)+"EnabledC:0"
setsys sys,"save"
cfgsave

Then, to restore the initial (and so enable the IO server) configuration:

setsys sys,"load"
setsys sys,"IOSrvData0","EnabledA:0"+chr$(13)+chr$(10)+"EnabledB:0"+chr$(13)+chr$(10)+"EnabledC:0"
setsys sys,"save"
cfgsave

You can see that there is a "¶" needed between parameters names & values. You can replace each "¶" found in the config.txt by "chr$(13)+chr$(10)" in the BASIC code.

To avoid the use of the "chr$(13)+chr$(10)" syntax, you can also read the IO server configuration with:

a$=getsys sys,"IOSrvData0"

And restore it later with:

setsys sys,"IOSrvData0",a$