예제 #1
0
 /// <summary>
 /// Метод обрабатывающий сообщения от декодера USB
 /// </summary>
 /// <param name="msg">Сообщение</param>
 void onMessageFunc(MsgBase msg)
 {
     ProtocolMsgEventArgs msg1 = msg as ProtocolMsgEventArgs;
     if (msg1 != null)
     {
         switch (msg1.Addr)
         {
             case TIME_ADDR_GET:
                 Array.Copy(msg1.Data, 0, ETime.Data, 0, 6);
                 break;
             case TM_DATA_GET :
                 Tm.Update(msg1.Data);
                 ControlValuesList[XsanConst.POWER_CTRL_IDX].UsbValue = msg1.Data[6];
                 break;
             case HSI_XSAN_DATA_GET:
                 HSIInt.XSANStat.Update(msg1.Data, msg1.DataLen);
                 break;
             case HSI_BUNI_DATA_GET:
                 HSIInt.BUNIStat.Update(msg1.Data, _xsanDataLogStream, _xsanChannelForWriting);
                 break;
             case HSI_BUNI_CTRL_GET:
                 ControlValuesList[XsanConst.BUNI_CTRL_IDX].UsbValue = msg1.Data[0];
                 break;
             case HSI_XSAN_CTRL_GET:
                 ControlValuesList[XsanConst.XSAN_CTRL_IDX].UsbValue = msg1.Data[0];
                 break;
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Обработчик ошибок протокола декодера USB
        /// </summary>
        /// <param name="errMsg"></param>
        void onErrorFunc(MsgBase errMsg)
        {
            ProtocolErrorEventArgs msg = errMsg as ProtocolErrorEventArgs;
            string bufferStr = Converter.ByteArrayToHexStr(msg.Data);

            LogsClass.Instance.Files[LogsClass.ErrorsIdx].LogText = msg.Msg+" ("+bufferStr+", на позиции: "+msg.ErrorPos.ToString()+")";
        }