Exemplo n.º 1
0
        protected override void DefWndProc(ref System.Windows.Forms.Message m)
        {
            switch (m.Msg)
            {
            case WM_LED_NOTIFY:
                TNotifyParam notifyparam = new TNotifyParam();
                LEDSender.Do_LED_GetNotifyParam_BufferToFile(ref notifyparam, AppDomain.CurrentDomain.BaseDirectory + "play.dat", (int)m.WParam);
                if (notifyparam.notify == LEDSender.LM_TIMEOUT)
                {
                    this.messageIndicator1.SetState(StateType.Success, "命令执行超时");
                }
                else if (notifyparam.notify == LEDSender.LM_TX_COMPLETE)
                {
                    if (notifyparam.result == LEDSender.RESULT_FLASH)
                    {
                        this.messageIndicator1.SetState(StateType.Success, "数据传送完成,正在写入Flash");
                    }
                    else
                    {
                        this.messageIndicator1.SetState(StateType.Success, "数据传送完成");
                    }
                }
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Exemplo n.º 2
0
        private void Parse2(Int32 K)
        {
            string       Text        = "";
            TNotifyParam notifyparam = new TNotifyParam();

            if (K >= 0)
            {
                LEDSender.Do_LED_GetNotifyParam(ref notifyparam, K);

                if (notifyparam.notify == LEDSender.LM_TIMEOUT)
                {
                    Text = "命令执行超时";
                }
                else if (notifyparam.notify == LEDSender.LM_TX_COMPLETE)
                {
                    if (notifyparam.result == LEDSender.RESULT_FLASH)
                    {
                        Text = "数据传送完成,正在写入Flash";
                    }
                    else
                    {
                        Text = "数据传送完成";
                    }
                }
                else if (notifyparam.notify == LEDSender.LM_RESPOND)
                {
                    if (notifyparam.command == LEDSender.PKC_GET_POWER)
                    {
                        if (notifyparam.status == LEDSender.LED_POWER_ON)
                        {
                            Text = "读取电源状态完成,当前为电源开启状态";
                        }
                        else if (notifyparam.status == LEDSender.LED_POWER_OFF)
                        {
                            Text = "读取电源状态完成,当前为电源关闭状态";
                        }
                    }
                    else if (notifyparam.command == LEDSender.PKC_SET_POWER)
                    {
                        if (notifyparam.result == 99)
                        {
                            Text = "当前为定时开关屏模式";
                        }
                        else if (notifyparam.status == LEDSender.LED_POWER_ON)
                        {
                            Text = "设置电源状态完成,当前为电源开启状态";
                        }
                        else
                        {
                            Text = "设置电源状态完成,当前为电源关闭状态";
                        }
                    }
                    else if (notifyparam.command == LEDSender.PKC_GET_BRIGHT)
                    {
                        Text = string.Format("读取亮度完成,当前亮度={0:D}", notifyparam.status);
                    }
                    else if (notifyparam.command == LEDSender.PKC_SET_BRIGHT)
                    {
                        if (notifyparam.result == 99)
                        {
                            Text = "当前为定时亮度调节模式";
                        }
                        else
                        {
                            Text = string.Format("设置亮度完成,当前亮度={0:D}", notifyparam.status);
                        }
                    }
                    else if (notifyparam.command == LEDSender.PKC_ADJUST_TIME)
                    {
                        Text = "校正显示屏时间完成";
                    }
                }
            }
            else if (K == LEDSender.R_DEVICE_INVALID)
            {
                Text = "打开通讯设备失败(串口不存在、或者串口已被占用、或者网络端口被占用)";
            }
            else if (K == LEDSender.R_DEVICE_BUSY)
            {
                Text = "设备忙,正在通讯中...";
            }
            Writlog(Text);
        }