public RadioStatusReply GetRadioStatus(XCMPStatus statusType) { //Console.WriteLine("Getting Radio Status {0}...", statusType); RadioStatusRequest req = new RadioStatusRequest(statusType); this.SendPacket(req); //Console.WriteLine("Sent Packet..."); while (true) { //Console.WriteLine("Waiting for Packet..."); XCMPPacket pkt = this.WaitForPacket(); //Console.WriteLine("Got Packet {0}", pkt); if (pkt.OpCode == XCMPOpCode.RadioStatusReply) { RadioStatusReply rsr = (RadioStatusReply)pkt; if (rsr.StatusType == statusType) { return(rsr); } } //Requeue this packet it wasn't for us... this.receivedQueue.Add(pkt); //TODO Timeout } }
public RadioStatusReply(byte[] data) : base(data) { this.statusType = (XCMPStatus)data[3]; this.data = data.Skip(4).ToArray(); }
public RadioStatusRequest(XCMPStatus statusType) : base(XCMPOpCode.RadioStatusRequest) { this.statusType = statusType; this.data = new byte[1]; this.data[0] = (byte)statusType; }