Example #1
0
        private static void Client_FrameRecieved(object sender, Frame e)
        {
            switch ((CommandList)e.CommandID)
            {
            case CommandList.ReplySID:
                SoftwareID id = (SoftwareID)BitConverter.ToUInt32(e.Data, 0);
                LogRecievedCommand(e, id.ToString());
                if (id == SoftwareID.DPS50xx)
                {
                    dps.ID = e.TxID;
                }


                break;
            }
        }
Example #2
0
        void Work()
        {
            while (true)
            {
                Frame frame = pendingFrames.Take();
                if (frame != null)
                {
                    CommandList cmd = (CommandList)frame.CommandID;
                    switch (cmd)
                    {
                    case CommandList.RequestLease:
                        HandleRequestLease(frame);
                        break;

                    case CommandList.RequestID:
                        UInt16 id = BitConverter.ToUInt16(frame.Data, 0);
                        if (id == this.lease.ID)
                        {
                            Frame f = Frame.ReplyID(this.lease.ID);
                            SendFrame(f);
                        }
                        break;

                    case CommandList.RequestSID:
                        SoftwareID sid = (SoftwareID)BitConverter.ToUInt32(frame.Data, 0);
                        if (sid == SoftwareID.Unknown || sid == softwareID)
                        {
                            Frame f = Frame.ReplySID(this.softwareID);
                            SendFrame(f);
                        }
                        break;

                    case CommandList.ReplyID:
                        break;

                    case CommandList.ReplyLease:
                        break;

                    default:
                        Logger.LOGW($"Command not handled '{frame.Options.ToString()}', '{cmd.ToString()}'");
                        break;
                    }
                }
            }
        }