Dynamic call
hilal
Posts: 2
Hi all,
Is there any way to make dynamic calls in Netlinx?
I have a structure which definition is as follow:
STRUCTURE _sCMD
{
char _command[16]
char _parameters[32]
char _feedback[32]
integer _cmd_type
char _dynamicCall[32] // will contain the name of a define_call procedure already defined...
_elt _guiElt
}
I wrote a define_call procedure like this:
DEFINE_CALL 'test1'
{
send_string 0, '### CALL OF TEST 1'
}
In the initialisation of one varilable of type _sCMD, I do that:
...
vProtocolCommands[1]._dynamicCall = 'test1' //name of the define_call procedure I want to call later
...
What I want to do, on a button event for example, is to call the test1 procedure this way:
call vProtocolCommands[vCurrentCMD]._dynamicCall
Is it possible to do that on Netlinx?
I tried also call "vProtocolCommands[vCurrentCMD]._dynamicCall" and then I have the following error message: C10548: SUBCALLSTATEMENT3 unsupported
Thanks
Is there any way to make dynamic calls in Netlinx?
I have a structure which definition is as follow:
STRUCTURE _sCMD
{
char _command[16]
char _parameters[32]
char _feedback[32]
integer _cmd_type
char _dynamicCall[32] // will contain the name of a define_call procedure already defined...
_elt _guiElt
}
I wrote a define_call procedure like this:
DEFINE_CALL 'test1'
{
send_string 0, '### CALL OF TEST 1'
}
In the initialisation of one varilable of type _sCMD, I do that:
...
vProtocolCommands[1]._dynamicCall = 'test1' //name of the define_call procedure I want to call later
...
What I want to do, on a button event for example, is to call the test1 procedure this way:
call vProtocolCommands[vCurrentCMD]._dynamicCall
Is it possible to do that on Netlinx?
I tried also call "vProtocolCommands[vCurrentCMD]._dynamicCall" and then I have the following error message: C10548: SUBCALLSTATEMENT3 unsupported
Thanks
0
Comments
Something akin to
CALL 'test1'
where you put a string variable in the place of the 'test1'
ex: Call s_My_Calls_List[n_Call_ID]
would be nice but is not so.;
too bad... this would have been very helpful...
thanks anyway ;-)
Pointers to functions would be nice, however, without pointers it isn't possible.
Paul
define_Function DYN_CALL (call)
{
switch(call)
{
case test1:
{
//do test one call
}
}
}
DYN_CALL(vProtocolCommands[vCurrentCMD]._dynamicCall)