Beispiel #1
0
        static void Delete_RoSpec()
        {
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();

            msg.ROSpecID = 0;
            MSG_ERROR_MESSAGE msg_err;

            MSG_DELETE_ROSPEC_RESPONSE rsp =
                reader.DELETE_ROSPEC(msg, out msg_err, 2000);

            if (rsp != null)
            {
                // Success
                Console.WriteLine(rsp.ToString());
            }
            else if (msg_err != null)
            {
                // Error
                Console.WriteLine(msg_err.ToString());
            }
            else
            {
                // Timeout
                Console.WriteLine("Timeout Error.");
            }
        }
Beispiel #2
0
        public void DeleteRoSpec(int roSpectID)
        {
            Console.WriteLine("Stopping RoSpec\n");
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();
            MSG_ERROR_MESSAGE msg_err;

            msg.ROSpecID = (uint)roSpectID; // this better match the RoSpec we created above
            MSG_DELETE_ROSPEC_RESPONSE rsp = reader.DELETE_ROSPEC(msg, out msg_err, 12000);

            if (rsp != null)
            {
                if (rsp.LLRPStatus.StatusCode != ENUM_StatusCode.M_Success)
                {
                    Console.WriteLine(rsp.LLRPStatus.StatusCode.ToString());
                    reader.Close();
                    return;
                }
            }
            else if (msg_err != null)
            {
                Console.WriteLine(msg_err.ToString());
                reader.Close();
                return;
            }
            else
            {
                Console.WriteLine("STOP_ROSPEC Command Timed out\n");
                reader.Close();
                return;
            }
        }
Beispiel #3
0
        static void Delete_RoSpec()
        {
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();

            msg.ROSpecID = 0;
            MSG_ERROR_MESSAGE msg_err;

            MSG_DELETE_ROSPEC_RESPONSE rsp =
                readerR.DELETE_ROSPEC(msg, out msg_err, 2000);
        }
Beispiel #4
0
 public static void ResponseWriteLine(MSG_DELETE_ROSPEC_RESPONSE response, MSG_ERROR_MESSAGE errorMessage)
 {
     if (response != null)
     {
         Console.WriteLine(response.ToString());
     }
     else if (errorMessage != null)
     {
         Console.WriteLine(errorMessage.ToString());
     }
     else
     {
         Console.WriteLine("Timeout Error");
     }
 }
Beispiel #5
0
        private void Delete_RoSpec()
        {
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();

            msg.ROSpecID = 0;

            MSG_DELETE_ROSPEC_RESPONSE rsp = reader.DELETE_ROSPEC(msg, out msg_err, 3000);

            if (rsp != null)
            {
                textBox2.Text = rsp.ToString();
            }
            else if (msg_err != null)
            {
                textBox2.Text = msg_err.ToString();
            }
            else
            {
                textBox2.Text = "Command time out!";
            }
        }
Beispiel #6
0
        /// <summary>
        /// Deletes the ROSpec at the Reader corresponding to ROSpecID passed in this message.
        /// </summary>
        public void Delete_RoSpec()
        {
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();

            msg.ROSpecID = 0;   // Deletes ROSpec for the given id

            MSG_DELETE_ROSPEC_RESPONSE rsp = client.DELETE_ROSPEC(msg, out msg_err, 3000);

            if (rsp != null)
            {
                //textBox2.Text = rsp.ToString();
                WriteMessage(rsp.ToString(), "Delete_RoSpec");
            }
            else if (msg_err != null)
            {
                WriteMessage("Delete_RoSpec " + msg_err.ToString());
            }
            else
            {
                WriteMessage("Delete_RoSpec Command time out!");
            }
        }
Beispiel #7
0
        private bool Delete_RoSpec()
        {
            MSG_DELETE_ROSPEC msg = new MSG_DELETE_ROSPEC();

            msg.ROSpecID = 0;

            MSG_DELETE_ROSPEC_RESPONSE rsp = reader.DELETE_ROSPEC(msg, out msg_err, 12000);

            if (rsp != null)
            {
                //return rsp.ToString();
                return(true);
            }
            else if (msg_err != null)
            {
                //return msg_err.ToString();
                return(false);
            }
            else
            {
                //return "Command time out!";
                return(false);
            }
        }
Beispiel #8
0
    public static void ParseXMLToLLRPMessage(string xmlstr, out object msg, out ENUM_LLRP_MSG_TYPE type)
    {
        XmlDocument xdoc = new XmlDocument();

        xdoc.LoadXml(xmlstr);
        XmlNode node = (XmlNode)xdoc.DocumentElement;

        switch (node.Name)
        {
        case "CUSTOM_MESSAGE":
            msg  = (object)MSG_CUSTOM_MESSAGE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE;
            return;

        case "GET_READER_CAPABILITIES":
            msg  = (object)MSG_GET_READER_CAPABILITIES.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES;
            return;

        case "GET_READER_CAPABILITIES_RESPONSE":
            msg  = (object)MSG_GET_READER_CAPABILITIES_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES_RESPONSE;
            return;

        case "ADD_ROSPEC":
            msg  = (object)MSG_ADD_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC;
            return;

        case "ADD_ROSPEC_RESPONSE":
            msg  = (object)MSG_ADD_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ADD_ROSPEC_RESPONSE;
            return;

        case "DELETE_ROSPEC":
            msg  = (object)MSG_DELETE_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC;
            return;

        case "DELETE_ROSPEC_RESPONSE":
            msg  = (object)MSG_DELETE_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC_RESPONSE;
            return;

        case "START_ROSPEC":
            msg  = (object)MSG_START_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.START_ROSPEC;
            return;

        case "START_ROSPEC_RESPONSE":
            msg  = (object)MSG_START_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.START_ROSPEC_RESPONSE;
            return;

        case "STOP_ROSPEC":
            msg  = (object)MSG_STOP_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC;
            return;

        case "STOP_ROSPEC_RESPONSE":
            msg  = (object)MSG_STOP_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.STOP_ROSPEC_RESPONSE;
            return;

        case "ENABLE_ROSPEC":
            msg  = (object)MSG_ENABLE_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC;
            return;

        case "ENABLE_ROSPEC_RESPONSE":
            msg  = (object)MSG_ENABLE_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC_RESPONSE;
            return;

        case "DISABLE_ROSPEC":
            msg  = (object)MSG_DISABLE_ROSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC;
            return;

        case "DISABLE_ROSPEC_RESPONSE":
            msg  = (object)MSG_DISABLE_ROSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC_RESPONSE;
            return;

        case "GET_ROSPECS":
            msg  = (object)MSG_GET_ROSPECS.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS;
            return;

        case "GET_ROSPECS_RESPONSE":
            msg  = (object)MSG_GET_ROSPECS_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_ROSPECS_RESPONSE;
            return;

        case "ADD_ACCESSSPEC":
            msg  = (object)MSG_ADD_ACCESSSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC;
            return;

        case "ADD_ACCESSSPEC_RESPONSE":
            msg  = (object)MSG_ADD_ACCESSSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC_RESPONSE;
            return;

        case "DELETE_ACCESSSPEC":
            msg  = (object)MSG_DELETE_ACCESSSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC;
            return;

        case "DELETE_ACCESSSPEC_RESPONSE":
            msg  = (object)MSG_DELETE_ACCESSSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC_RESPONSE;
            return;

        case "ENABLE_ACCESSSPEC":
            msg  = (object)MSG_ENABLE_ACCESSSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC;
            return;

        case "ENABLE_ACCESSSPEC_RESPONSE":
            msg  = (object)MSG_ENABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC_RESPONSE;
            return;

        case "DISABLE_ACCESSSPEC":
            msg  = (object)MSG_DISABLE_ACCESSSPEC.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC;
            return;

        case "DISABLE_ACCESSSPEC_RESPONSE":
            msg  = (object)MSG_DISABLE_ACCESSSPEC_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC_RESPONSE;
            return;

        case "GET_ACCESSSPECS":
            msg  = (object)MSG_GET_ACCESSSPECS.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS;
            return;

        case "GET_ACCESSSPECS_RESPONSE":
            msg  = (object)MSG_GET_ACCESSSPECS_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS_RESPONSE;
            return;

        case "GET_READER_CONFIG":
            msg  = (object)MSG_GET_READER_CONFIG.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG;
            return;

        case "GET_READER_CONFIG_RESPONSE":
            msg  = (object)MSG_GET_READER_CONFIG_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG_RESPONSE;
            return;

        case "SET_READER_CONFIG":
            msg  = (object)MSG_SET_READER_CONFIG.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG;
            return;

        case "SET_READER_CONFIG_RESPONSE":
            msg  = (object)MSG_SET_READER_CONFIG_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG_RESPONSE;
            return;

        case "CLOSE_CONNECTION":
            msg  = (object)MSG_CLOSE_CONNECTION.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION;
            return;

        case "CLOSE_CONNECTION_RESPONSE":
            msg  = (object)MSG_CLOSE_CONNECTION_RESPONSE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION_RESPONSE;
            return;

        case "GET_REPORT":
            msg  = (object)MSG_GET_REPORT.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.GET_REPORT;
            return;

        case "RO_ACCESS_REPORT":
            msg  = (object)MSG_RO_ACCESS_REPORT.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.RO_ACCESS_REPORT;
            return;

        case "KEEPALIVE":
            msg  = (object)MSG_KEEPALIVE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.KEEPALIVE;
            return;

        case "KEEPALIVE_ACK":
            msg  = (object)MSG_KEEPALIVE_ACK.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.KEEPALIVE_ACK;
            return;

        case "READER_EVENT_NOTIFICATION":
            msg  = (object)MSG_READER_EVENT_NOTIFICATION.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.READER_EVENT_NOTIFICATION;
            return;

        case "ENABLE_EVENTS_AND_REPORTS":
            msg  = (object)MSG_ENABLE_EVENTS_AND_REPORTS.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ENABLE_EVENTS_AND_REPORTS;
            return;

        case "ERROR_MESSAGE":
            msg  = (object)MSG_ERROR_MESSAGE.FromString(xmlstr);
            type = ENUM_LLRP_MSG_TYPE.ERROR_MESSAGE;
            return;

        default:
            msg  = null;
            type = 0;
            return;
        }
    }
Beispiel #9
0
        public Message TransactMessage(Message msg, int time_out)
        {
            bool[] bit_array = msg.ToBitArray();
            byte[] data      = Util.ConvertBitArrayToByteArray(bit_array);
            try
            {
                transactEvt = new ManualResetEvent(false);
                Transaction.Send(cI, data);

                msg_id = (int)msg.MSG_ID;

                if (msg.MSG_TYPE != (uint)ENUM_LLRP_MSG_TYPE.CUSTOM_MESSAGE)
                {
                    msg_type = (short)(msg.MSG_TYPE + 10);
                }
                else
                {
                    msg_type = (short)msg.MSG_TYPE;
                }

                if (transactEvt.WaitOne(time_out, false))
                {
                    BitArray bArr;
                    int      length;
                    int      cursor = 0;
                    switch ((ENUM_LLRP_MSG_TYPE)msg_type)
                    {
                    case ENUM_LLRP_MSG_TYPE.GET_READER_CAPABILITIES_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_GET_READER_CAPABILITIES_RESPONSE r_msg = MSG_GET_READER_CAPABILITIES_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.ADD_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_ADD_ROSPEC_RESPONSE r_msg = MSG_ADD_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.DELETE_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_DELETE_ROSPEC_RESPONSE r_msg = MSG_DELETE_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.START_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_START_ROSPEC_RESPONSE r_msg = MSG_START_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.STOP_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_STOP_ROSPEC_RESPONSE r_msg = MSG_STOP_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.ENABLE_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_ENABLE_ROSPEC_RESPONSE r_msg = MSG_ENABLE_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.DISABLE_ROSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_DISABLE_ROSPEC_RESPONSE r_msg = MSG_DISABLE_ROSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.GET_ROSPECS_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_GET_ROSPECS_RESPONSE r_msg = MSG_GET_ROSPECS_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.ADD_ACCESSSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_ADD_ACCESSSPEC_RESPONSE r_msg = MSG_ADD_ACCESSSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.DELETE_ACCESSSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_DELETE_ACCESSSPEC_RESPONSE r_msg = MSG_DELETE_ACCESSSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.ENABLE_ACCESSSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_ENABLE_ACCESSSPEC_RESPONSE r_msg = MSG_ENABLE_ACCESSSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.DISABLE_ACCESSSPEC_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_DISABLE_ACCESSSPEC_RESPONSE r_msg = MSG_DISABLE_ACCESSSPEC_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.GET_ACCESSSPECS_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_GET_ACCESSSPECS_RESPONSE r_msg = MSG_GET_ACCESSSPECS_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.GET_READER_CONFIG_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_GET_READER_CONFIG_RESPONSE r_msg = MSG_GET_READER_CONFIG_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.SET_READER_CONFIG_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_SET_READER_CONFIG_RESPONSE r_msg = MSG_SET_READER_CONFIG_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    case ENUM_LLRP_MSG_TYPE.CLOSE_CONNECTION_RESPONSE:
                    {
                        bArr   = Util.ConvertByteArrayToBitArray(data);
                        length = bArr.Count;
                        MSG_CLOSE_CONNECTION_RESPONSE r_msg = MSG_CLOSE_CONNECTION_RESPONSE.FromBitArray(ref bArr, ref cursor, length);
                        return(r_msg);
                    }

                    default:
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch
            {
                throw new Exception("Transaction Failed");
            }
        }