0
Answered

IR.GetDevice(name).Send([data]) How to use in "Panel+Server" mode?

Sinan Chen 4 years ago updated by Tatiana Kiselyova (expert) 4 years ago 1

Target:

Sending a array of Hex data to device via UDP in iRIdi Script.


I have achieve goal in "only-Panel" mode by the code below:

var cmd = [0x11,0x22, 0x33];

IR.GetDevice("AV & Custom TCP/UDP Network").Send(cmd);

But I have problem in "Panel+Server" mode:

Panel:

var cmd = [0x11,0x22, 0x33];

for(var i=0;i<3;i++){

  IR.GetDevice("iRidium Server").Set("AV & Custom TCP/UDP Network.AV & Custom Systems:AV Control Command", cmd[i]);

}

Server:

IR.SubscribeTagChange("Server.Channels.AV & Custom TCP/UDP Network.AV & Custom Systems:AV Control Command");

IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(in_sName, in_sValue){

    IR.Log("Active Global Listener: " + in_sName + "\tValue: " + in_sValue);

    IR.GetDevice("AV & Custom TCP/UDP Network").Send(in_sValue);

}

The problem is the Server sending nothing to device. And I found the "in_sValue" only getting the last byte(0x33) according to the log.

What is wrong with me, please?


GOOD, I'M SATISFIED
Satisfaction mark by Sinan Chen 4 years ago
Answered

Hello.

You need to do the following:

1. Completely transfer the script for sending data from the panel to the project to the global listener of the server project:

var cmd = [0x11,0x22, 0x33];

IR.SubscribeTagChange("Server.Channels.AV & Custom TCP/UDP Network.AV & Custom Systems:AV Control Command");

IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(in_sName, in_sValue){

IR.Log("Active Global Listener: " + in_sName + "\tValue: " + in_sValue);

IR.GetDevice("AV & Custom TCP/UDP Network").Send(cmd);

})

2. From the panel project, just send any value to the driver channel (you can just send 1 via a macro)