Esempio n. 1
0
        public formOcrMonitor()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Get runtime settings from our .config file.
            IPAddress OCR_Host          = IPAddress.Parse((string)ConfigurationManager.AppSettings["OCR_host"]);
            Int32     OCR_Port          = Int32.Parse(ConfigurationManager.AppSettings["OCR_port"]);
            string    OCR_MessagePrefix = ConfigurationManager.AppSettings["OCR_MessagePrefix"];
            string    CargoSenderName   = ConfigurationManager.AppSettings["CargoSenderName"];
            bool      ConnectAsListener = Boolean.Parse(ConfigurationManager.AppSettings["ConnectAsListener"]);

            m_OCRMonitor = new OCRMonitor(OCR_Host,
                                          OCR_Port,
                                          ConnectAsListener,
                                          OCR_MessagePrefix,
                                          CargoSenderName
                                          );
            // Register for OCR connection status updates.
            m_OCRMonitor.UpdateConnectionStatus +=
                new OCRMonitor.OCRConnectionStatusNotifier(ConnectionStatusUpdate);
            // Register for notification of receipt of OCR messages.
            m_OCRMonitor.NotifyRxACK +=
                new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxNACK +=
                new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxOCR_MASTER +=
                new OCRMonitor.OCRMessageHandler(ReceivedOCR_MASTER);
            m_OCRMonitor.NotifyRxOCR_NEW_EVENT +=
                new OCRMonitor.OCRMessageHandler(ReceivedOCR_NEW_EVENT);
            m_OCRMonitor.NotifyRxOCR_ULD +=
                new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxPING +=
                new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxREGISTER +=
                new OCRMonitor.OCRMessageHandler(ReceivedREGISTER);
            m_OCRMonitor.NotifyRxUNREGISTER +=
                new OCRMonitor.OCRMessageHandler(ReceivedUNREGISTER);

            m_OCRMonitor.Start();

            _logger = new EventLoggerAccess();

            //if (m_OCRMonitor.IsRunning)
            {
                m_cargoHostIF = new CargoHostInterface(_logger);
            }
        }
Esempio n. 2
0
        public formOcrMonitor()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Get runtime settings from our .config file.
            IPAddress OCR_Host = IPAddress.Parse((string)ConfigurationManager.AppSettings["OCR_host"]);
            Int32 OCR_Port = Int32.Parse(ConfigurationManager.AppSettings["OCR_port"]);
            string OCR_MessagePrefix = ConfigurationManager.AppSettings["OCR_MessagePrefix"];
            string CargoSenderName = ConfigurationManager.AppSettings["CargoSenderName"];
            bool ConnectAsListener = Boolean.Parse(ConfigurationManager.AppSettings["ConnectAsListener"]);

            m_OCRMonitor = new OCRMonitor(OCR_Host,
                                          OCR_Port,
                                          ConnectAsListener,
                                          OCR_MessagePrefix,
                                          CargoSenderName
                                         );
            // Register for OCR connection status updates.
            m_OCRMonitor.UpdateConnectionStatus +=
                         new OCRMonitor.OCRConnectionStatusNotifier(ConnectionStatusUpdate);
            // Register for notification of receipt of OCR messages.
            m_OCRMonitor.NotifyRxACK +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxNACK +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxOCR_MASTER +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOCR_MASTER);
            m_OCRMonitor.NotifyRxOCR_NEW_EVENT +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOCR_NEW_EVENT);
            m_OCRMonitor.NotifyRxOCR_ULD +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxPING +=
                         new OCRMonitor.OCRMessageHandler(ReceivedOcrMessage);
            m_OCRMonitor.NotifyRxREGISTER +=
                         new OCRMonitor.OCRMessageHandler(ReceivedREGISTER);
            m_OCRMonitor.NotifyRxUNREGISTER +=
                         new OCRMonitor.OCRMessageHandler(ReceivedUNREGISTER);

            m_OCRMonitor.Start();

            _logger = new EventLoggerAccess();

            //if (m_OCRMonitor.IsRunning)
            {
                m_cargoHostIF = new CargoHostInterface(_logger);
            }
        }