Update status on Panel online event
alexsquared
Posts: 166
Hello all, I worked with AMX to get a simple include file that I use for AMX control of Vantage Infusion systems. This is a simple (less than 100 lines) piece of code, that issues commands to toggle a load based on the touchpanel button having the same # as the vantage VID (essentially button.input.channel). It also uses updates feedback based on LED status of the Vantage system. So, if a keypad/button is added to the vantage system, all that needs to be done is add the button on the touchpanel file with the matching channel # and it works perfectly.
This is working perfectly, but I want to take it to the next level. For the panels that reside in the system all the time, I have no complaints. The problem is that now i have implemented two iphone panels via TPcontrol. These are only connected to the system from time to time, and as such are never really tracking the feedback. Ie. when I open TPcontrol and connect, all my buttons are in the off state, until the load state changes again, so if there are lights currently on, I have no clue. I'd like to be able to somehow track this data in the master and then on a panel online event update that panel (or my panel array I created) with the CURRENT state of all the loads. Any thoughts on how to do this?
This is working perfectly, but I want to take it to the next level. For the panels that reside in the system all the time, I have no complaints. The problem is that now i have implemented two iphone panels via TPcontrol. These are only connected to the system from time to time, and as such are never really tracking the feedback. Ie. when I open TPcontrol and connect, all my buttons are in the off state, until the load state changes again, so if there are lights currently on, I have no clue. I'd like to be able to somehow track this data in the master and then on a panel online event update that panel (or my panel array I created) with the CURRENT state of all the loads. Any thoughts on how to do this?
PROGRAM_NAME='VANTAGE_INFUSION' Define_Device dvVantageController=0:6:0 dvLIGHTMVP =10002:15:0 dviPHONE1TP_LT = 10006:15:0 //MR-IPHONE TOUCHPANEL dviPHONE2TP_LT = 10007:15:0 //Mrs-IPHONE TOUCHPANEL DEFINE_VARIABLE Volatile CHAR cVantageBuffer[100] VOLATILE CHAR cVantageIP[15]='xxx.xxx.xxx.xxx' VOLATILE LONG lVantagePort=3001 DEV dvlightingTP[]= { dvLIGHTMVP, dviPHONE1TP_LT, dviPHONE2TP_LT } DEFINE_START IP_CLIENT_OPEN(dvVantageController.Port,cVantageIP,lVantagePort,1) CREATE_BUFFER dvVantageController,cVantageBuffer DEFINE_FUNCTION fnVantageStringProcess(CHAR cStringToProcess[]) { STACK_VAR INTEGER nLEDNum STACK_VAR INTEGER nLEDSTATUS IF(FIND_STRING(cStringToProcess,'S:LED ',1))//LED Feedback { REMOVE_STRING(cStringToProcess,'S:LED ',1) nLEDNum=ATOI(cStringToProcess) SEND_STRING 0,"'LED Number is',ITOA(nLEDNum)" REMOVE_STRING(cStringToProcess,ITOA(nLEDNum),1) nLEDStatus=ATOI(cStringToProcess) SEND_STRING 0,"'LED Number ',ITOA(nLEDNum),' LED Status is ',ITOA(nLEDStatus)" //REMOVE_STRING(cStringToProcess,ITOA(nLEDStatus),1) [dvLightingTP,nLEDNum]=nLEDStatus } IF(FIND_STRING(cStringToProcess,'R:STATUS LED',1))//Tells us it received the fact that LED trackign is on { Send_String 0, 'LEDs Are Tracking Now' } } DEFINE_EVENT BUTTON_EVENT [dvLightingTP,0] { Push: { SEND_STRING dvVantageController,"'BTNPRESS ',ITOA(BUTTON.INPUT.CHANNEL),$0D,$0A" } RELEASE: { SEND_STRING dvVantageController,"'BTNRELEASE ',ITOA(BUTTON.INPUT.CHANNEL),$0D,$0A" } } DATA_EVENT[dvVantageController] { Online: { SEND_STRING 0,"'Vantage LED Tracking Online'" WAIT 400 { //SEND_STRING dvVantageController, "'STATUS LED',$0D,$0A"//make it start feeding back } } Offline: { SEND_STRING 0,"'Vantage LED Tracking Offline'" } STRING: { Send_String 0, "'Vantage String - ',DATA.TEXT" While (FIND_STRING(cVantageBuffer,"$0D",1)) { SEND_STRING 0, 'In The Vantage String Processing While loop' fnVantageStringProcess(REMOVE_STRING(cVantageBuffer,"$0D",1)) } } }
0
Comments