コード例 #1
0
        private bool GetResponse(LedPanel panel, string id)
        {
            bool          flag          = false;
            LedPanelCloud ledPanelCloud = panel as LedPanelCloud;
            DateTime      now           = DateTime.Now;

            while ((DateTime.Now - now).TotalSeconds < 10.0)
            {
                SingleCommandInfo singleCommandInfo = new SingleCommandService().Get(LedGlobal.CloudAccount.SessionID, ledPanelCloud.CloudID, id);
                if (singleCommandInfo != null)
                {
                    byte[] receiveData = singleCommandInfo.ReceiveData;
                    byte[] sendData    = singleCommandInfo.SendData;
                    if (receiveData != null && receiveData.Length > 0 && sendData != null && sendData.Length > 0)
                    {
                        IList <Unpack_Results> list = protocol_single_cmd.Rec_Unpack(receiveData, sendData);
                        if (list != null && list.Count > 0 && list[0].Result_Type == 2 && list[0].Info_Erroneous_Data == info_error_type.Null)
                        {
                            if (list[0].Cmd_Type != LedCmdType.Send_Panel_Parameter)
                            {
                                flag = true;
                                break;
                            }
                            TerminalInfo terminalInfo = new TerminalService().Get(LedGlobal.CloudAccount.SessionID, ledPanelCloud.DeviceID);
                            if (terminalInfo != null && ledPanelCloud.IsEquals(terminalInfo.ToParameterArray()))
                            {
                                flag = true;
                                break;
                            }
                            break;
                        }
                    }
                }
                if (flag)
                {
                    break;
                }
                Thread.Sleep(1000);
            }
            return(flag);
        }