Example #1
0
 public static bool GetRssiStatus(out ushort val, out string errInfo)
 {
     errInfo = "";
     val     = 30;
     Invengo.NetAPI.Protocol.IRP1.SysQuery_800 msg = new SysQuery_800(0x14);
     if (RfReader.Send(msg))
     {
         if (msg.ReceivedMessage != null &&
             msg.ReceivedMessage.QueryData != null &&
             msg.ReceivedMessage.QueryData.Length > 0)
         {
             val = (ushort)msg.ReceivedMessage.QueryData[0];
         }
         return(true);
     }
     else
     {
         if (msg.ErrInfo == null || msg.ErrInfo == "")
         {
             errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
         }
         else
         {
             errInfo = msg.ErrInfo;
         }
     }
     return(false);
 }
Example #2
0
        /// <summary>
        /// Get Hardware Version
        /// </summary>
        /// <param name="ver"></param>
        /// <param name="errInfo"></param>
        /// <returns></returns>
        public static bool GetHardwareVersion(out string ver, out string errInfo)
        {
            ver     = "";
            errInfo = "";
            SysQuery_800 msg = new SysQuery_800(0x25, 0x00);

            if (RfReader.Send(msg))
            {
                if (msg.ReceivedMessage.QueryData != null && msg.ReceivedMessage.QueryData.Length > 0)
                {
                    ver = Encoding.Default.GetString(msg.ReceivedMessage.QueryData, 0, msg.ReceivedMessage.QueryData.Length);
                    return(true);
                }
                return(false);
            }
            else
            {
                if (msg.ErrInfo == null || msg.ErrInfo == "")
                {
                    errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
                }
                else
                {
                    errInfo = msg.ErrInfo;
                }
            }
            return(false);
        }
Example #3
0
        /// <summary>
        /// Get Frequency Band
        /// </summary>
        /// <param name="freqBand"></param>
        /// <param name="errInfo"></param>
        /// <returns></returns>
        public static bool GetFrequencyBand(out string freqBand, out string errInfo)
        {
            freqBand = "";
            errInfo  = "";

            bool ret = false;

            Invengo.NetAPI.Protocol.IRP1.SysQuery_800 msg = new SysQuery_800(0x15);
            if (RfReader.Send(msg))
            {
                if (msg.ReceivedMessage.QueryData != null && msg.ReceivedMessage.QueryData.Length > 0)
                {
                    byte band = msg.ReceivedMessage.QueryData[0];
                    switch (band)
                    {
                    case 0x00:
                        freqBand = "CN";
                        break;

                    case 0x01:
                        freqBand = "FCC";
                        break;

                    case 0x02:
                        freqBand = "EU";     //"ESTI";
                        break;

                    case 0x03:
                        freqBand = "KOREA";
                        break;

                    case 0x04:
                        freqBand = "JAPEN";
                        break;

                    case 0x05:
                        freqBand = "CN2";
                        break;
                    }
                    ret = true;
                }
            }
            else
            {
                if (msg.ErrInfo == null || msg.ErrInfo == "")
                {
                    errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
                }
                else
                {
                    errInfo = msg.ErrInfo;
                }
            }
            return(ret);
        }
Example #4
0
        /// <summary>
        /// Get Frequency
        /// </summary>
        /// <param name="freq"></param>
        /// <param name="errInfo"></param>
        /// <returns></returns>
        public static bool GetFrequency(out byte[] freq, out string errInfo)
        {
            freq    = null;
            errInfo = "";
            SysQuery_800 msg = new SysQuery_800(0x04, 0x00);

            if (RfReader.Send(msg))
            {
                freq = msg.ReceivedMessage.QueryData;
                return(true);
            }
            else
            {
                if (msg.ErrInfo == null || msg.ErrInfo == "")
                {
                    errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
                }
                else
                {
                    errInfo = msg.ErrInfo;
                }
            }
            return(false);
        }
Example #5
0
        /// <summary>
        /// Get Power List
        /// </summary>
        /// <param name="val"></param>
        /// <param name="errInfo"></param>
        /// <returns></returns>
        public static bool GetPowerList(out byte[] val, out string errInfo)
        {
            errInfo = "";
            val     = null;
            SysQuery_800 msg = new SysQuery_800(0x30);

            if (RfReader.Send(msg))
            {
                val = msg.ReceivedMessage.QueryData;
                return(true);
            }
            else
            {
                if (msg.ErrInfo == null || msg.ErrInfo == "")
                {
                    errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
                }
                else
                {
                    errInfo = msg.ErrInfo;
                }
            }
            return(false);
        }
Example #6
0
        /// <summary>
        /// Get Antenna Power
        /// </summary>
        /// <param name="powerlist"></param>
        /// <param name="errInfo"></param>
        /// <returns></returns>
        public static bool GetAntennaPower(out byte[] powerlist, out string errInfo)
        {
            errInfo   = "";
            powerlist = null;
            SysQuery_800 msg = new SysQuery_800(0x03, 0x00);

            if (RfReader.Send(msg))
            {
                powerlist = msg.ReceivedMessage.QueryData;
                return(true);
            }
            else
            {
                if (msg.ErrInfo == null || msg.ErrInfo == "")
                {
                    errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2"));
                }
                else
                {
                    errInfo = msg.ErrInfo;
                }
            }
            return(false);
        }