Problem in getting Data events
rizwan
Posts: 4
Hi forum members,
We are facing a problem in getting data events. I am enclosing the code underneath. For the time being we are trying that a when a button is pressed in Macro button page a string gets displayed. We are looking forward to display status of fire alarm system on the interface connected on RS-232.
DEFINE_VARIABLE
TP1Buffer[1024]
DEFINE_START
CREATE_BUFFER dvTP1, TP1Buffer
DEFINE_EVENT
BUTTON_EVENT[dvTP1_FEATURE_MacroButtons1, 261]
{
PUSH:
{
SEND_STRING dvTP1, "'It is a test'"
//SEND_COMMAND vdvLIGHTSYSTEM1, 'LIGHTSYSTEMSTATE-16:4,OFF'
}
}
DATA_EVENT[dvTP1]
{
STRING:
{
TP1Buffer = DATA.TEXT
SEND_STRING 0, "'String send was =', Data.TEXT"
}
}
Best Regards
We are facing a problem in getting data events. I am enclosing the code underneath. For the time being we are trying that a when a button is pressed in Macro button page a string gets displayed. We are looking forward to display status of fire alarm system on the interface connected on RS-232.
DEFINE_VARIABLE
TP1Buffer[1024]
DEFINE_START
CREATE_BUFFER dvTP1, TP1Buffer
DEFINE_EVENT
BUTTON_EVENT[dvTP1_FEATURE_MacroButtons1, 261]
{
PUSH:
{
SEND_STRING dvTP1, "'It is a test'"
//SEND_COMMAND vdvLIGHTSYSTEM1, 'LIGHTSYSTEMSTATE-16:4,OFF'
}
}
DATA_EVENT[dvTP1]
{
STRING:
{
TP1Buffer = DATA.TEXT
SEND_STRING 0, "'String send was =', Data.TEXT"
}
}
Best Regards
0
Comments
TP1Buffer = DATA.TEXT
CREATE_BUFFER will automatically fill TP1Buffer with incoming data. I'm not sure what will be in data.text but you're overwriting TP1Buffer I think!
CREATE_BUFFER is typically used if you're expecting large amounts of data. Either remove the line TP1Buffer = DATA.TEXT or remove CREATE_BUFFER dvTP1, TP1Buffer.
You would be better off abstracting the process with a virtual device. Use your macro to send a command to the virtual, and use the COMMAND handler to do whatever parsing might be necessary to display it.
However, I'm guessing that the text that you are sending to the touchpanel doesn't show up on the touchpanel either. This is because you have to send the text to a button using the ^TXT command. Instead of a send_string dvTP1, you'll want to use a send_command dvTP1, '^TXT-a,b,It is a test', where a is the address of the button you want to send the text too and b is the state you want to send it to, with 0 being all states.
Hope that helps.
You are also able to see any commands sent to a physical device in Netlinx Notifications so this code is not actually necessary if all you want it for is debugging.
I have used this type of code in the past to catch events sent from within AMX modules to a touchpanel, for instance the easiest way to see current RMS meeting info is to catch the text events sent to the touchpanel.
The additions that I have made are that I have changes the type of button with channel number 262 to a test INPUT. and defines ButtonAddress = 11 as the address field shows 11 in TPDesign.
Then a DEFINE_COMBINE (vdvTP1, dvTP1) was defined.
and the two functions for 261 macro button and the data event for vdvTP1 are added below. Still no success. If I debug the cursor comes to the SEND_COMMAND line but on running forward it does not triggers the dat even for vdvTP1. There is no indication in the notification area even.
DEFINE_CONSTANT
INTEGER ButtonAddress = 11
DEFINE_EVENT
BUTTON_EVENT[dvTP1_FEATURE_MacroButtons1, 261]
{
PUSH:
{
SEND_COMMAND vdvTP1, "'^TXT-',ITOA(ButtonAddress),',0,It is a test'"
}
}
DATA_EVENT[vdvTP1]
{
COMMAND:
{
SEND_STRING 0, "'vdvTP1 sent command was : ', DATA.TEXT"
}
}
Besst Regards,
I think that you are still making the same basic mistake that David Hawthorne explained. You are expecting something sent TO a touch panel to trigger a data_event for that touch panel. You can't do that, as far as I know. The data_event[dvTP] will respond to stuff created by the touch panel. If the touch panel reports a page flip (when you turn on page tracking), the touch panel data_event is where you will track it. If the touch panel sends a string to the processor, you can see it in the data_event. Touch panels coming on line: you'll see it in the online: handler in the data_event. But, strings and commands sent to the touch panel will not echo back to the processor and trigger a handler in the data_event.