RTI and AMX Integration via IP
RicardoSiqueira
Posts: 373
For those that are interested, I was playing last night with a RTI XP6 controller, a T2x RTI remote and an AMX NI-4100 and wrote a basic RTI_IP_CONTROL module for AMX using some code that Vining helped me before to setup the AMX RTI Serial communications. The problem with the Serial communications is that the RF remotes communicate on a single bus and during ramping commands like volume ramping only one remote works at a time.
In this case, the RTI Wi-Fi remotes communicate wireless with the XP6 or any network capable RTI controller. In RTI you will need to use the Two Way Strings RTI driver and from any RTI remote send the string CHxxx%0D for the code below to work. Also you need to setup your RTI Two Way Strings driver to communicate with the AMX Master IP and assigned port. I haven't tested multiple RTI remotes yet, since I have only one T2x available, but by using a module, each remote will have its own TCPIP socket and port to communicate and theoretically it should work better. Also there is no need to connect cables between the RTI controller and the AMX controller. They only need to be on the same network subnet.
Few free to use the module, make comments and improve on it. Since this is my first TCPI exercise, I am not sure if there are needed error checking to make this a better module. Have fun and let me know if there is anything to add to improve it.
DEVICE DEFINITIONS
Module
In this case, the RTI Wi-Fi remotes communicate wireless with the XP6 or any network capable RTI controller. In RTI you will need to use the Two Way Strings RTI driver and from any RTI remote send the string CHxxx%0D for the code below to work. Also you need to setup your RTI Two Way Strings driver to communicate with the AMX Master IP and assigned port. I haven't tested multiple RTI remotes yet, since I have only one T2x available, but by using a module, each remote will have its own TCPIP socket and port to communicate and theoretically it should work better. Also there is no need to connect cables between the RTI controller and the AMX controller. They only need to be on the same network subnet.
Few free to use the module, make comments and improve on it. Since this is my first TCPI exercise, I am not sure if there are needed error checking to make this a better module. Have fun and let me know if there is anything to add to improve it.
DEVICE DEFINITIONS
(***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE vdvRemote1 = 0:7:0 vdvRemote2 = 0:8:0 vdvRemote3 = 0:9:0 //Virtual Devices////////////////////////////////////////////////////////// vdvRemote1_Family = 33001:1:0 // Virtual vdvRemote2_Office = 33002:1:0 // Virtual vdvRemote3_Master = 33003:1:0 // Virtual (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE //Port for RTI Remotes IP Control VOLATILE INTEGER svPORT1 = 81 VOLATILE INTEGER svPORT2 = 82 VOLATILE INTEGER svPORT3 = 83 (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START DEFINE_MODULE 'RTI_IP_Control' Remote_1 (vdvRemote1,vdvRemote1_Family,svPORT1) DEFINE_MODULE 'RTI_IP_Control' Remote_2 (vdvRemote2,vdvRemote2_Office,svPORT2) DEFINE_MODULE 'RTI_IP_Control' Remote_3 (vdvRemote3,vdvRemote3_Master,svPORT2)
Module
MODULE_NAME='RTI_IP_Control'(DEV vdvRemote, DEV dvRemote, INTEGER nPORT) (***********************************************************) (* DEVICE NUMBER DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_DEVICE dvMASTER = 0:1:0 (***********************************************************) (* VARIABLE DEFINITIONS GO BELOW *) (***********************************************************) DEFINE_VARIABLE INTEGER RTI_CMD CHAR RTI_BUFFER[64] //Holds 5 Characters from String: CHxxx (***********************************************************) (* STARTUP CODE GOES BELOW *) (***********************************************************) DEFINE_START CREATE_BUFFER vdvRemote, RTI_BUFFER (***********************************************************) (* THE EVENTS GO BELOW *) (***********************************************************) DEFINE_EVENT DATA_EVENT[dvMASTER] { ONLINE : { IP_SERVER_OPEN(vdvRemote.PORT,nPORT,IP_TCP) } } DATA_EVENT[vdvRemote] { ONLINE : { SEND_STRING dvMASTER,"'CONNECT',nPORT" } STRING: { SEND_STRING 0, "'RTI, RX-[ ', DATA.TEXT,' ]'"; CANCEL_WAIT 'RTI_DUMP_BUFFER';//prevent dumping buffer if data is coming in, might dump data before data event fires WHILE(FIND_STRING(RTI_BUFFER,"$0D",1))//delimiter. { STACK_VAR INTEGER nFBS; STACK_VAR CHAR cStr[64]; cStr = REMOVE_STRING(RTI_BUFFER, "$0D",1); SEND_STRING 0, "'RTI, Parsing Segment-[ ', cStr,' ]'"; //SET_LENGTH_STRING(cStr,length_string(cStr)-1);//get rid of $0D nFBS = find_string(cStr,'CH',1); if(nFBS) { GET_BUFFER_STRING(cStr,2);//dump CH and anyting before it RTI_CMD = atoi(GET_BUFFER_STRING(cStr,3)); SEND_STRING 0, "'RTI, PARSED: CH-[ ', itoa(RTI_CMD),']'"; //Process Command Received DO_PUSH_TIMED(dvRemote,RTI_CMD,1);//use timed, otherwise another push won't work for .5 seconds DO_RELEASE(dvRemote,RTI_CMD);//immediately release to allow next push } ELSE { SEND_STRING 0, "'RTI, Parsing ERROR-[ No CH Found ]'"; WAIT 50 'RTI_DUMP_BUFFER' { CLEAR_BUFFER RTI_BUFFER; } } } WAIT 50 'RTI_DUMP_BUFFER' { if(length_string(RTI_BUFFER)) { SEND_STRING 0, "'RTI, Dumping buffer remains, BUFFER-[ ',RTI_BUFFER,' ]'"; CLEAR_BUFFER RTI_BUFFER; } } } OFFLINE: { SEND_STRING dvMASTER,"'DISCONNECT',nPORT" IP_SERVER_OPEN(vdvRemote.PORT,nPORT,IP_TCP) } }
1
Comments
You can keep the wifi connection up maybe?
Doing some communication wifi the AMX.
But the batterie might be down reall fast ?
On my testing setup, I am going through a RTI XP6 controller first. In other words, The RTI remote communicates with the RTI controller (XP6) via Wi-Fi, which then communicates with AMX via TCPIP. Maybe someone can come up with a solution in which the RTI communicate straight to AMX, without the need for the RTI controller as the bridge, which uses the 2-WAY RTI string driver to send commands to AMX. Most of other Wi-Fi remotes that I've used take about a second to reconnect including (CRES$TRON) when operating via Wi-Fi, which is not noticeable by the end user as he/she picks up the remote. I wish AMX had a Wi-Fi remote with the looks of a RTI remote to fulfill the residential market need for an attractive Wi-Fi remote.
RTI Remote (Wi-Fi) --> RTI Controller(TCPIP) --> AMX Controller