Code Based Notifications
njenkins
Posts: 6
If anyone familiar with a way to have code put a text string in the Notifications of the Output Bar in NetLinx Studio when you are connected to a system.
What I am trying to accomplish is to have a line of code in a DEFINE_CALL that will send just a notification with a custom string to the notifications when connected. Something like "Define_call XYZ was run" so it would have a timestamp for debugging/monitoring/troubleshooting timelines and other events.
The only way I can think of is to SEND_STRING to the master with my custom message or to a fake defined device. There must be a better way though. Suggestions?
Thanks.
What I am trying to accomplish is to have a line of code in a DEFINE_CALL that will send just a notification with a custom string to the notifications when connected. Something like "Define_call XYZ was run" so it would have a timestamp for debugging/monitoring/troubleshooting timelines and other events.
The only way I can think of is to SEND_STRING to the master with my custom message or to a fake defined device. There must be a better way though. Suggestions?
Thanks.
0
Comments
I wasn't sure if that was the correct way.
I know there is a #WARN for compile time, couldn't find anything for a run-time notification by code.
Thanks for the suggestion.
Here is a quick function that will do almost the same thing, but will save the message, with date and time stamp, to a text file that can be downloaded from the master with a FTP program.
Those two tools should cover both realtime debugging/monitoring and monitoring/logging when you need to troubleshoot a problem that occurs when you are not actively connected and watching the telnet window.
When you send a string to the master (ie. Send_string 0, cString; ), you can look at it in the telnet session.
Open the Telnet session to the master ( o 192.168.1.11), when it connects to the master, type the MSG ON command to the Netlinx. All strings sent to the master are displayed in the Telnet window. I send the strings to a Debug function, that I can enable/disable with a variable. That way I can minimize data I have to look at based on turning on/off various code sections.
If I want to capture the data going to the telnet session, I turn the Telnet logfile on before I connect to the master.
"set logfile c:\logfile.txt" - Turns logging on
"o 192.168.1.11" - Opens the telnet session
"msg on" - tells the Netlinx to pring it's send_string data to the screen (and therefore the logfile).
It allows me to capture most of the Netlinx startup data on reboots too, so I don't have to be so fast at enableing the Netlinx notifications.
ROO
Then through out a particular device's code where appropriate I use something like this:
Now if I'm working on a particular device and I want debug info printed to the diagnostic screen I just open up the debug window put in that devices debug variable and set it to 1. Some modules I write I have different debug levels like 1 for just the .axi, 2 for just the .axs (module) or 3 for everything.
Notice I use the __LINE__ function so when it prints to the screen I know where in the code, what line it originated from. Makes life a little easier.
I then use "DEBUG: in the printed line so it can be filtered from the daily log that is collected and set out daily to the office. I've been using Dave Hawthorne's DevTermLogger module for that which is available on the forum and he created a filter array just for such purposes. That way I can work on a system with out the daily log getting filled with a bunch of crap from that day's testing or troubleshooting.