示例#1
0
 public MsgUhfBandConfig(FrequencyArea band)
 {
     this.band        = band;
     msgBody          = new byte[2];
     msgBody[0]       = 0;
     msgBody[1]       = (byte)band;
     base.OnExecuted += MsgUhfBandConfig_OnExecuted;
 }
示例#2
0
        public ConnectResponse Connect()
        {
            ConnectResponse connectResponse = new ConnectResponse();

            try
            {
                Connect(out connectResponse.ErrorInfo);
                if (base.IsConnected)
                {
                    if (isRs485)
                    {
                        RS485Item[] rS485Items = RS485Items;
                        foreach (RS485Item rS485Item in rS485Items)
                        {
                            MsgRfidStatusQuery msgRfidStatusQuery = new MsgRfidStatusQuery();
                            if (rS485Item.Send(msgRfidStatusQuery))
                            {
                                rS485Item.UhfBand = msgRfidStatusQuery.ReceivedMessage.UhfBand;
                            }
                            Msg6CTagFieldConfig msg6CTagFieldConfig = new Msg6CTagFieldConfig();
                            if (rS485Item.Send(msg6CTagFieldConfig))
                            {
                                rS485Item.isEnableAntenna = msg6CTagFieldConfig.ReceivedMessage.IsEnableAntenna;
                                rS485Item.isEnableRSSI    = msg6CTagFieldConfig.ReceivedMessage.IsEnableRSSI;
                            }
                            MsgReaderVersionQuery msgReaderVersionQuery = new MsgReaderVersionQuery();
                            if (rS485Item.Send(msgReaderVersionQuery))
                            {
                                rS485Item.modelNumber = msgReaderVersionQuery.ReceivedMessage.ModelNumber;
                            }
                        }
                    }
                    else if (!(base.CommPort is UdpPort))
                    {
                        MsgRfidStatusQuery msgRfidStatusQuery2 = new MsgRfidStatusQuery();
                        if (Send(msgRfidStatusQuery2))
                        {
                            UhfBand = msgRfidStatusQuery2.ReceivedMessage.UhfBand;
                        }
                        Msg6CTagFieldConfig msg6CTagFieldConfig2 = new Msg6CTagFieldConfig();
                        if (Send(msg6CTagFieldConfig2))
                        {
                            isEnableAntenna = msg6CTagFieldConfig2.ReceivedMessage.IsEnableAntenna;
                            isEnableRSSI    = msg6CTagFieldConfig2.ReceivedMessage.IsEnableRSSI;
                        }
                        MsgReaderVersionQuery msgReaderVersionQuery2 = new MsgReaderVersionQuery();
                        if (Send(msgReaderVersionQuery2))
                        {
                            modelNumber = msgReaderVersionQuery2.ReceivedMessage.ModelNumber;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                connectResponse.ErrorInfo = new ErrInfo("FF01", ex.Message);
                Log.Error(ex.Message);
            }
            connectResponse.IsSucessed = base.IsConnected;
            return(connectResponse);
        }