This commit is contained in:
@@ -15,6 +15,11 @@
|
||||
<Local name="ex" type="string" xsi:type="array" size="1" />
|
||||
<Local name="array_separator" type="string" xsi:type="array" size="1" />
|
||||
<Local name="last_id" type="string" xsi:type="array" size="1" />
|
||||
<Local name="ret" type="num" xsi:type="array" size="1" />
|
||||
<Local name="aux" type="num" xsi:type="array" size="1" />
|
||||
<Local name="auxb" type="bool" xsi:type="array" size="1" />
|
||||
<Local name="count" type="num" xsi:type="array" size="1" />
|
||||
<Local name="ok" type="bool" xsi:type="array" size="1" />
|
||||
</Locals>
|
||||
<Code><![CDATA[begin
|
||||
rx=""
|
||||
@@ -70,8 +75,85 @@
|
||||
endWhile
|
||||
endIf
|
||||
tx = ""
|
||||
ex = ""
|
||||
call onCommandTcp(cmd,args, tx, ex)
|
||||
ex = ""
|
||||
//General commands
|
||||
switch(cmd)
|
||||
case "eval"
|
||||
tx=$exec(args[0])
|
||||
break
|
||||
|
||||
case "get_var","get_bool"
|
||||
if cmd == "get_var"
|
||||
ret = getData(args[0], aux)
|
||||
else
|
||||
ret = getData(args[0], auxb)
|
||||
endIf
|
||||
switch(ret)
|
||||
case -1
|
||||
ex = "The variable does not exists"
|
||||
break
|
||||
case -2
|
||||
ex = "The variable library does not exists"
|
||||
break
|
||||
case -3
|
||||
ex = "The index is out of range"
|
||||
break
|
||||
case -4
|
||||
ex = "The data's type does not match the variable's type"
|
||||
break
|
||||
default
|
||||
if cmd == "get_var"
|
||||
tx = toString(".4", aux)
|
||||
else
|
||||
if auxb
|
||||
tx = "1"
|
||||
else
|
||||
tx = "0"
|
||||
endIf
|
||||
endIf
|
||||
break
|
||||
endSwitch
|
||||
break
|
||||
|
||||
case "get_arr"
|
||||
toNum(args[1], count, ok)
|
||||
tx = ""
|
||||
for index = 0 to count
|
||||
if cmd == "get_var"
|
||||
ret = getData(args[0], aux)
|
||||
else
|
||||
ret = getData(args[0], auxb)
|
||||
endIf
|
||||
|
||||
ret = getData(args[0] + "[" + toString("", index )+ "]", aux)
|
||||
switch(ret)
|
||||
case -1
|
||||
ex = "The variable does not exists"
|
||||
return
|
||||
break
|
||||
case -2
|
||||
ex = "The variable library does not exists"
|
||||
return
|
||||
break
|
||||
case -3
|
||||
ex = "The index is out of range"
|
||||
return
|
||||
break
|
||||
case -4
|
||||
ex = "The data's type does not match the variable's type"
|
||||
return
|
||||
break
|
||||
default
|
||||
tx = tx + toString(".4", aux) + "|"
|
||||
break
|
||||
endSwitch
|
||||
endFor
|
||||
break
|
||||
default
|
||||
//App specific
|
||||
call onCommandTcp(cmd,args, tx, ex)
|
||||
break
|
||||
endSwitch
|
||||
last_id = msg_id
|
||||
endIf
|
||||
if len(ex) == 0
|
||||
|
||||
@@ -11,84 +11,14 @@
|
||||
<Local name="index" type="num" xsi:type="array" size="1" />
|
||||
<Local name="puck" type="num" xsi:type="array" size="1" />
|
||||
<Local name="sample" type="num" xsi:type="array" size="1" />
|
||||
<Local name="bOk" type="bool" xsi:type="array" size="1" />
|
||||
<Local name="aux" type="num" xsi:type="array" size="1" />
|
||||
<Local name="ok" type="bool" xsi:type="array" size="1" />
|
||||
<Local name="ret" type="num" xsi:type="array" size="1" />
|
||||
<Local name="count" type="num" xsi:type="array" size="1" />
|
||||
</Locals>
|
||||
<Code><![CDATA[begin
|
||||
switch(cmd)
|
||||
case "eval"
|
||||
tx=$exec(args[0])
|
||||
|
||||
// if (find(cmd,"numRet")!=-1)
|
||||
// stringReturn = stringReturn+toString("4.4",numRet)
|
||||
// call notify:setString("NumericalReturn",toString("4.4",numRet))
|
||||
// endIf
|
||||
// if (find(cmd,"Power")!=-1)
|
||||
// call notify:setBool("IsPowered",isPowered())
|
||||
// endIf
|
||||
|
||||
// for i=0 to len(stringReturn)-1 step 1
|
||||
// numericalReturn[i]=asc(stringReturn,i)
|
||||
// endFor
|
||||
|
||||
|
||||
break
|
||||
case "get_var"
|
||||
ret = getData(args[0], aux)
|
||||
switch(ret)
|
||||
case -1
|
||||
ex = "The variable does not exists"
|
||||
break
|
||||
case -2
|
||||
ex = "The variable library does not exists"
|
||||
break
|
||||
case -3
|
||||
ex = "The index is out of range"
|
||||
break
|
||||
case -4
|
||||
ex = "The data's type does not match the variable's type"
|
||||
break
|
||||
default
|
||||
tx = toString(".4", ret)
|
||||
break
|
||||
endSwitch
|
||||
break
|
||||
|
||||
case "get_arr"
|
||||
toNum(args[1], count, bOk)
|
||||
tx = ""
|
||||
for index = 0 to count
|
||||
ret = getData(args[0] + "[" + toString("", index )+ "]", aux)
|
||||
switch(ret)
|
||||
case -1
|
||||
ex = "The variable does not exists"
|
||||
return
|
||||
break
|
||||
case -2
|
||||
ex = "The variable library does not exists"
|
||||
return
|
||||
break
|
||||
case -3
|
||||
ex = "The index is out of range"
|
||||
return
|
||||
break
|
||||
case -4
|
||||
ex = "The data's type does not match the variable's type"
|
||||
return
|
||||
break
|
||||
default
|
||||
tx = tx + toString(".4", ret) + "|"
|
||||
break
|
||||
endSwitch
|
||||
endFor
|
||||
break
|
||||
|
||||
|
||||
switch(cmd)
|
||||
case "mount"
|
||||
toNum(args[0], puck, bOk)
|
||||
toNum(args[1], sample, bOk)
|
||||
toNum(args[0], puck, ok)
|
||||
toNum(args[1], sample, ok)
|
||||
tx = "Mounting sample " + toString("", puck) + ":" + toString("", sample)
|
||||
break
|
||||
default
|
||||
|
||||
Reference in New Issue
Block a user