コード例 #1
0
        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
            }
        }
コード例 #2
0
        private void HandleXNLDataPacket(object sender, XNLEventArgs e)
        {
            XNLPacket pkt = e.Packet;

            if (pkt.IsXCMP)
            {
                DataPacket dp   = (DataPacket)pkt;
                XCMPPacket xcmp = dp.XCMP;
                switch (xcmp.OpCode)
                {
                case XCMPOpCode.DeviceinitStatusBroadcast:
                    DeviceInitStatusBroadcast disb = (DeviceInitStatusBroadcast)xcmp;
                    version = disb.Version;
                    if (disb.InitComplete)
                    {
                        this.ready = true;
                    }
                    break;

                default:
                    //Console.WriteLine("Got Unknown XCMP Packet {0}", dp.XCMP);
                    this.receivedQueue.Add(xcmp);
                    break;
                }
            }
        }
コード例 #3
0
        public VersionInfoReply GetVersionInfo()
        {
            XCMPPacket req = new VersionInfoRequest();

            this.SendPacket(req);
            while (true)
            {
                XCMPPacket pkt = this.WaitForPacket();
                if (pkt.OpCode == XCMPOpCode.VersionInfoReply)
                {
                    VersionInfoReply vir = (VersionInfoReply)pkt;
                    return(vir);
                }
                //Requeue this packet it wasn't for us...
                this.receivedQueue.Add(pkt);
                //TODO Timeout
            }
        }
コード例 #4
0
        public AlarmStatusReply GetAlarmStatus()
        {
            AlarmStatusRequest req = new AlarmStatusRequest();

            this.SendPacket(req);
            while (true)
            {
                XCMPPacket pkt = this.WaitForPacket();
                if (pkt.OpCode == XCMPOpCode.AlarmStatusReply)
                {
                    AlarmStatusReply asr = (AlarmStatusReply)pkt;
                    return(asr);
                }
                //Requeue this packet it wasn't for us...
                this.receivedQueue.Add(pkt);
                //TODO Timeout
            }
        }
コード例 #5
0
        public void SendPacket(XCMPPacket pkt)
        {
            DataPacket dp = new DataPacket(pkt);

            this.client.SendPacket(dp);
        }