//Things to note: //I am making a "custom" packet type for this shit. //Basically, it will look like this: // [0x13] [0x37] are the start bits // Next we have a number for the packet type // 1 = temperature response // 2 = geolocation response // For a 1 (which is all we're implementing at the moment) // We will have a T, followed by a number then "t", an H, followed by a number then "h" // an M, followed by a number then "m", and then a B followed by a number and "b", // then an E. // The T is temperature // The H is humidity // The M is moisture // The B is battery level // The E means it's the end of the packet public void ParseReceiveFrameData(WATR_XBeeReceivePacketFrameData data) { //Check the first two bytes; make sure they are 0x13 0x37, and that the last byte is E if (data.ReceiveData[customPacketIndicatorStart] == 0x13 && data.ReceiveData[customPacketIndicatorStart + 1] == 0x37 && data.ReceiveData[data.ReceiveData.Length - 1] == 'E') { //See what kind of packet type it is switch (data.ReceiveData[customPacketTypeStart]) { case 0x01: { parseRFDataTemperatureRecord(data.SourceAddress, data.ReceiveData); break; } default: { //Shit.. this shouldn't happen :c break; } } } }
public WATR_RxPacketGetArgs(WATR_XBeeReceivePacketFrameData data) { FrameData = data; }