Example #1
0
        public void ProcessOCRMessage(string msgString)
        {
            string guidString = null;

            // Don't allow shutdown while still processing a message
            try
            {
                lock (this)
                {
                    OCRMessageType messageType = OCRMessageUtils
                                                   .GetMessageInfo(msgString,
                                                                   out guidString
                                                                  );
                    object ocrMessage = null;

                    switch (messageType)
                    {
                        case OCRMessageType.OCR_MASTER:
                            ocrMessage = new Messages.ocr_master.message();
                            break;

                        case OCRMessageType.OCR_ULD:
                            ocrMessage = new Messages.ocr_uld.message();
                            break;

                        case OCRMessageType.OCR_NEW_EVENT:
                            ocrMessage = new Messages.ocr_new_event.message();
                            break;

                        case OCRMessageType.REGISTER:
                            ocrMessage = new Messages.ocr_register.message();
                            break;

                        case OCRMessageType.UNREGISTER:
                            ocrMessage = new Messages.ocr_unregister.message();
                            break;

                        case OCRMessageType.PING:
                            ocrMessage = new Messages.ocr_ping.message();
                            break;

                        case OCRMessageType.ACK:
                            ocrMessage = new Messages.ocr_ack.message();
                            break;

                        default:
                            // If something is unrecognized or corrupt,
                            // just ignore it per the ICD
                            break;
                    }

                    OCRMessageRespond(DeserializeToTypedMessage(ocrMessage, msgString), messageType);
                }
            }
            catch (Exception) //XML parser and ProcessMasterMessage will throw in invalid message
            {
                // Per the ICD, if something is corrupt or unrecognized,
                // just NACK it.
                SendNACK(guidString);
            }
        }
Example #2
0
        public void ProcessOCRMessage(string msgString)
        {
            string guidString = null;

            // Don't allow shutdown while still processing a message
            try
            {
                lock (this)
                {
                    OCRMessageType messageType = OCRMessageUtils
                                                 .GetMessageInfo(msgString,
                                                                 out guidString
                                                                 );
                    object ocrMessage = null;

                    switch (messageType)
                    {
                    case OCRMessageType.OCR_MASTER:
                        ocrMessage = new Messages.ocr_master.message();
                        break;

                    case OCRMessageType.OCR_ULD:
                        ocrMessage = new Messages.ocr_uld.message();
                        break;

                    case OCRMessageType.OCR_NEW_EVENT:
                        ocrMessage = new Messages.ocr_new_event.message();
                        break;

                    case OCRMessageType.REGISTER:
                        ocrMessage = new Messages.ocr_register.message();
                        break;

                    case OCRMessageType.UNREGISTER:
                        ocrMessage = new Messages.ocr_unregister.message();
                        break;

                    case OCRMessageType.PING:
                        ocrMessage = new Messages.ocr_ping.message();
                        break;

                    case OCRMessageType.ACK:
                        ocrMessage = new Messages.ocr_ack.message();
                        break;

                    default:
                        // If something is unrecognized or corrupt,
                        // just ignore it per the ICD
                        break;
                    }

                    OCRMessageRespond(DeserializeToTypedMessage(ocrMessage, msgString), messageType);
                }
            }
            catch (Exception) //XML parser and ProcessMasterMessage will throw in invalid message
            {
                // Per the ICD, if something is corrupt or unrecognized,
                // just NACK it.
                SendNACK(guidString);
            }
        }