0
Beantwoord

GC script command example

r riksma 6 jaar geleden in iRidium Script / AV and Driver scripts bijgewerkt door Oksana (expert) 5 jaar geleden 4
Good afternoon,
Could you please post an example showing how to send a native Global Cache command with a script?

For modbus i use this to send the value 1.

IR.GetDevice("Modbus TCP").Set("Command1",1);<br>



Let's say i want to send commands to an Apple TV, could i use Set, or Send like this?

IR.GetDevice("Modbus TCP").Set("CURSOR UP",X);<br>IR.GetDevice("Modbus TCP").Send([X]);<br>


What value should go where the X is now?
Hi,

Consider the following,  when you use .Set you are using an existing command defined in the driver and passing a value to that command;  take your example,  IR.GetDevice("Modbus TCP").Set("CURSOR UP",X);  The IR.GetDevice method looks in the "Modbus TCP" driver for a command called "CURSOR UP".  When the command in the driver exists then the method will instruct the driver to Set the channel, which causes the driver to send the command with the passed value of X.

Now consider a  Send method,  IR.GetDevice("Modbus TCP").Send([X]);

The Send method is passed the value of X as an array.  The driver then sends the contents of the array one element at a time.  The difference being here is that the value of X needs to be an command which the Global Cache device understands, eg ["sendir,1:1,1,38004,1,1,342,170,22,21,22,64,22,21,22,21,22,64,22,64,22,21,22,21,22,64,22,21,22,64,22,64,22,21,22,21,22,64,22,64,22,64,22,21,22,21,22,21,22,21,22,21,22,21,22,64,22,21,22,64,22,64,22,64,22,64,22,64,22,64,22,21,22,3800",0x0D]

Therefore the easiest option  will be to use the first. (.Set). Given that with global cache for IR is already defined in the command,  I would try the following, asuming that you have a global cache driver in the project which is called "global cache".

IR.GetDevice("Global Cache").Set("CURSOR UP",null);


Thanks,



Roger
Hi Roger,

Thanks for your thorough explanation.
Setting the second parameter of the .Set method to null makes sense.
I'll try as soon as I'm back at the office, but I'm sure this will work.
Hi Rens,

Your Welcome. Please remember also, for now anyway the new Global cache driver is not yet written for the iTach Flex models.  It will be fine on all the older models.

Thanks,


Roger