/// <summary>
        /// 处理D命令主函数
        /// </summary>
        /// <param name="data">输入的数据体</param>
        /// <param name="deviceCommunicationType">D命令类别</param>
        /// <param name="startIndex">分站号的开始位置</param>
        /// <param name="protocol">传输对象</param>
        /// <param name="extendCommandType">分站类型:即=0x26最新分站,还是老分站</param>
        private void ControlExtendCommand(byte extendCommandType, byte[] data, MasProtocol protocol, ushort startIndex, byte deviceCommunicationType)
        {
            extendCommandType &= 0x7F;//去掉最高位;
            switch (extendCommandType)
            {
            case 0:    //获取历史控制记录
                QueryHistoryControlResponseCommand queryhistorycontrol = new QueryHistoryControlResponseCommand();
                queryhistorycontrol.HandleQueryHistoryControl(data, protocol, startIndex, deviceCommunicationType, def.Point);
                break;

            case 1:    //获取电源箱的状态(D1)
                BatteryRealDataResponseCommand batterycommand = new BatteryRealDataResponseCommand();
                batterycommand.HandleBatteryRealData(data, protocol, startIndex, deviceCommunicationType, def.Point);
                break;

            case 2:    //修改传感器地址号(D2)
                ModificationDeviceAdressResponseCommand modideviceaddress = new ModificationDeviceAdressResponseCommand();
                modideviceaddress.HandleModificationDeviceAdressData(data, protocol, startIndex, deviceCommunicationType, def.Point);
                break;

            case 11:                                      //
                int exFlag = (data[startIndex + 7] >> 4); //分站响应标记 Bit7~bit4:数据交互标志
                UpdateStationDataProc(exFlag, data, protocol, startIndex, def.Point);
                break;

            case 3:    //获取分站4小时历史数据(D5)
                QueryHistoryRealDataResponseCommand queryhistoryrealdata = new QueryHistoryRealDataResponseCommand();
                queryhistoryrealdata.HandleHistoryRealData(data, protocol, startIndex, deviceCommunicationType, def.Point);
                break;

            case 4:    //下发传感器的分级报警控制(D7)
                SetSensorGradingAlarmResponseCommand sensorgradingalarm = new SetSensorGradingAlarmResponseCommand();
                sensorgradingalarm.HandleSetSensorGradingAlarm(data, protocol, startIndex, deviceCommunicationType, def.Point);
                break;
            }
        }
        /// <summary>
        /// 数据包命令判断---监控系统
        /// </summary>
        /// <param name="data">数据包体</param>
        /// <param name="protocol">应回发的对象</param>
        /// <param name="newsType">信息类别=1表示网口,=2表示串口</param>
        /// <param name="orderVersion">分类的驱动类型</param>
        private void DataControlByMonitor(byte[] data, MasProtocol protocol, byte orderVersion)
        {
            ushort startindex = 32760;         //数据开始位置
            int    receivelength = 0;          //下标|接收数据长度
            ushort crcvalue = 0, receivevalue; //crc累加和 回发累加和
            byte   commandtype;                //接受命令

            if (data[0] == def.Fzh)
            {
                startindex = 0;
            }
            if (startindex == 32760)
            {
                RealDataCreateByState(protocol, ItemState.EquipmentInterrupted);
                LogHelper.Error("【DataControlByMonitor】" + "没有长到分站地址引导符【" + def.Fzh + "】");
                return;
            }
            receivelength = CommandUtil.ConvertByteToInt16(data, startindex + 2, false);
            if (receivelength > data.Length)
            {
                RealDataCreateByState(protocol, ItemState.EquipmentInterrupted);
                LogHelper.Error("【DataControlByMonitor】" + "回发长度不足【" + startindex + receivelength + 3 + "】" + "【" + data.Length + "】");
                return;
            }
            receivevalue = CommandUtil.ConvertByteToInt16(data, startindex + receivelength - 2, false);
            crcvalue     = CommandUtil.AddSumToBytes(data, startindex, startindex + receivelength);
            if (crcvalue != receivevalue)
            {
                RealDataCreateByState(protocol, ItemState.EquipmentBiterror);
                LogHelper.Error("【DataControlByMonitor】" + "通讯误码【" + crcvalue + "】" + "【" + receivevalue + "】");
                return;
            }
            commandtype = data[startindex + 1];//StartIndex当前为分站的下标索引
            switch (commandtype)
            {
            case CommandCodes.InitializeCommand:    //I初始化命令
                InitializeResponseCommand InitCommandObject = new Commands.InitializeResponseCommand();
                crcvalue = CommandUtil.ConvertByteToInt16(data, startindex + 5, false);
                InitCommandObject.SendInitializeAffirmToCenter(protocol, def.Point, crcvalue);
                break;

            case 0x46:    //F取数命令
                RealDataResponseCommand RealCommandObject = new Commands.RealDataResponseCommand();
                RealCommandObject.def = def;
                RealCommandObject.HandleRealData(data, protocol, startindex, orderVersion);
                break;

            case 0x41:    //A请求初始化命令
                InitializeResponseCommand InitRequstCommandObject = new Commands.InitializeResponseCommand();
                InitRequstCommandObject.SendInitializeRequestToCenter(protocol, def.Point);
                break;

            case 0x55:
                BatteryRealDataResponseCommand batterycommand = new BatteryRealDataResponseCommand();
                batterycommand.HandleBatteryRealData(data, protocol, startindex, 0x00, def.Point);
                break;

            case 0x58:    //X命令
                ControlExtendCommand(data[startindex + 5], data, protocol, startindex, data[startindex + 5]);
                break;

            case 0x45:    //分站回发接收错误,后续修改为,错误不回发
            case 0x50:    //分站回发接收错误,后续修改为,错误不回发
                break;

            case 0x52:    //复位
                ResetDeviceResponseCommand ResetDeviceCommandObject = new Commands.ResetDeviceResponseCommand();
                ResetDeviceCommandObject.SendResetDeviceAffirmToCenter(protocol, def.Point);
                break;

            case 0x5A:    //分站中断
                LogHelper.Info("【DataControlByMonitor】" + "监控分站数据回发5A分站中断【" + def.Point + "】");
                break;

            default:
                LogHelper.Info("【DataControlByMonitor】" + "非法命令【" + commandtype + "】");
                break;
            }
        }