예제 #1
0
        private void HandleIdentifyController(clsOmniLinkMessageQueueItem M, byte[] B, bool Timeout)
        {
            if (Timeout)
            {
                return;
            }

            if ((B.Length > 3) && (B[2] == (byte)enuOmniLink2MessageType.SystemInformation))
            {
                clsOL2MsgSystemInformation MSG = new clsOL2MsgSystemInformation(Controller.Connection, B);

                foreach (enuModel enu in Enum.GetValues(typeof(enuModel)))
                {
                    if (enu == MSG.ModelNumber)
                    {
                        Controller.Model = enu;
                        break;
                    }
                }

                if (Controller.Model == MSG.ModelNumber)
                {
                    Controller.CopySystemInformation(MSG);
                    log.Info("CONTROLLER IS: " + Controller.GetModelText() + " (" + Controller.GetVersionText() + ")");

                    _ = Connected();

                    return;
                }

                log.Error("Model does not match file");
                Controller.Connection.Disconnect();
            }
        }
예제 #2
0
        private void HandleIdentifyController(clsOmniLinkMessageQueueItem M, byte[] B, bool Timeout)
        {
            if (Timeout)
            {
                return;
            }

            if ((B.Length > 3) && (B[2] == (byte)enuOmniLink2MessageType.SystemInformation))
            {
                clsOL2MsgSystemInformation MSG = new clsOL2MsgSystemInformation(Controller.Connection, B);

                foreach (enuModel enu in Enum.GetValues(typeof(enuModel)))
                {
                    if (enu == MSG.ModelNumber)
                    {
                        Controller.Model = enu;
                        break;
                    }
                }

                if (Controller.Model == MSG.ModelNumber)
                {
                    Controller.CopySystemInformation(MSG);

                    using (LogContext.PushProperty("Telemetry", "Controller"))
                        log.Information("Controller is {ControllerModel} firmware {ControllerVersion}",
                                        Controller.GetModelText(), Controller.GetVersionText());

                    _ = Connected();

                    return;
                }

                log.Error("Model does not match file");
                Controller.Connection.Disconnect();
            }
        }