I'm receiving an api frame from an XBee endpoint to an XBee coordinator that's connected to my computer through a com port.
This API frame I'm receiving is a change detect that's sent when a change is detected (simply enough). There's no set interval for this change detect.
When this api frame is received I want to be able to read it in my C# application, for the following reason:
When the frame is like this: 7E 00 0A 83 00 00 1C 00 01 00 81 00 80 5E (12th position is 80) I want to indicate that the light is off.
When the frame is like this: 7E 00 0A 83 00 00 2B 00 01 00 81 00 81 4E (12th position is 81) I want to indicate that the light is on.
My code for this is very simple - all I am missing is getting a hold of the frame in C#. Here's my code:
byte switch_indicator = somehow_read_the_frame;
if (switch_indicator = 0x81)
textBox1_TextChanged.BackColor = System.Drawing.Color.Green;
if (switch_indicator = 0x80)
textBox1_TextChanged.BackColor = System.Drawing.Color.Red;
How would I go about getting this frame?
I've thought about somehow getting it from the com port but I am not sure how to do this.
Any ideas or suggestions would be highly appreciated.