/// <summary> /// 核心服务层同步缓存到网关的处理 /// </summary> /// <param name="masProtocol"></param> public void HandleUpdateCacheDataRequest(MasProtocol masProtocol) { UpdateCacheDataRequest request = masProtocol.Deserialize <UpdateCacheDataRequest>(); if (request == null) { return; } if (request.DeviceList != null) { HandleDeviceCache(request.DeviceList);//测点同步 } if (request.DeviceTypeList != null) { HandleDeviceTypeCache(request.DeviceTypeList);//设备类型同步 } if (request.NetworkDeviceList != null) { HandleNetworkDeviceCache(request.NetworkDeviceList);//网络模块同步 } if (request.DeviceAcrossControlList != null) { HandleDeviceAcrossControlCache(request.DeviceAcrossControlList);//交叉控制同步 } }
/// <summary> /// 结束广播任务 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse endPaTask(MasProtocol masProtocol) { EndPaTaskRequest request = masProtocol.Deserialize <EndPaTaskRequest>(); if (request == null) { return(null); } EndPaTaskResponse response = BroadCastControllerProxy.broadCastControllerProxy.endPaTask(request); return(RpcResponse.Response <EndPaTaskResponse>(response)); }
/// <summary> /// 启动音乐广播任务 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse startPaMusicTask(MasProtocol masProtocol) { StartPaMusicTaskRequest request = masProtocol.Deserialize <StartPaMusicTaskRequest>(); if (request == null) { return(null); } StartPaMusicTaskResponse response = BroadCastControllerProxy.broadCastControllerProxy.startPaMusicTask(request); return(RpcResponse.Response <StartPaMusicTaskResponse>(response)); }
/// <summary> /// 删除播放列表音乐 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse delPlayListMusic(MasProtocol masProtocol) { PlayListMusicControlRequest request = masProtocol.Deserialize <PlayListMusicControlRequest>(); if (request == null) { return(null); } PlayListMusicControlResponse response = BroadCastControllerProxy.broadCastControllerProxy.delPlayListMusic(request); return(RpcResponse.Response <PlayListMusicControlResponse>(response)); }
/// <summary> /// 查询终端 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse queryTerm(MasProtocol masProtocol) { TerminalQueryRequest request = masProtocol.Deserialize <TerminalQueryRequest>(); if (request == null) { return(null); } TerminalQueryResponse response = BroadCastControllerProxy.broadCastControllerProxy.queryTerm(request); return(RpcResponse.Response <TerminalQueryResponse>(response)); }
/// <summary> /// 监听呼叫 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse monitorCall(MasProtocol masProtocol) { MonitorCallRequest request = masProtocol.Deserialize <MonitorCallRequest>(); if (request == null) { return(null); } MonitorCallResponse response = BroadCastControllerProxy.broadCastControllerProxy.monitorCall(request); return(RpcResponse.Response <MonitorCallResponse>(response)); }
/// <summary> /// 挂断呼叫 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse hangupCall(MasProtocol masProtocol) { HangupCallRequest request = masProtocol.Deserialize <HangupCallRequest>(); if (request == null) { return(null); } HangupCallResponse response = BroadCastControllerProxy.broadCastControllerProxy.hangupCall(request); return(RpcResponse.Response <HangupCallResponse>(response)); }
/// <summary> /// 音乐管理 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse musicManage(MasProtocol masProtocol) { MusicControlRequest request = masProtocol.Deserialize <MusicControlRequest>(); if (request == null) { return(null); } if (request.InfoState == InfoState.AddNew) { addMusic(request); } if (request.InfoState == InfoState.Delete) { delMusic(request); } return(null); }
/// <summary> /// 分区管理 /// </summary> public static RpcResponse zoneManage(MasProtocol masProtocol) { PartitionControlRequest request = masProtocol.Deserialize <PartitionControlRequest>(); if (request == null) { return(null); } if (request.InfoState == InfoState.AddNew) { addZone(request); } if (request.InfoState == InfoState.Modified) { setZone(request); } if (request.InfoState == InfoState.Delete) { delZone(request); } return(null); }
/// <summary> /// 音乐播放列表下音乐管理 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse playListMusicManage(MasProtocol masProtocol) { PlayListControlRequest request = masProtocol.Deserialize <PlayListControlRequest>(); if (request == null) { return(null); } if (request.InfoState == InfoState.AddNew) { createPlayList(request); } if (request.InfoState == InfoState.Modified) { setPlayList(request); } if (request.InfoState == InfoState.Delete) { delPlayList(request); } return(null); }
/// <summary> /// 设备管理 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse termManage(MasProtocol masProtocol) { TerminalControlRequest request = masProtocol.Deserialize <TerminalControlRequest>(); if (request == null) { return(null); } if (request.InfoState == InfoState.AddNew) { addTerm(request); } if (request.InfoState == InfoState.Modified) { setTerm(request); } if (request.InfoState == InfoState.Delete) { delTerm(request); } return(null); }
/// <summary> /// 处理服务端下发的命令协议数据(对象转Buffer,下行) /// </summary> /// <param name="masProtocol">下发的协议对象</param> public void HandleProtocolData(MasProtocol masProtocol) { byte[] data = new byte[1]; //向下的数据包Buffer string deviceCode = "000"; //向下对应的MAC地址 int commPort = 1; //表示IP模块下面的串口编号 if (masProtocol == null || masProtocol.Protocol == null) //数据效验 { return; } switch (masProtocol.ProtocolType) { case ProtocolType.GetSwitchboardParamCommRequest: //获取交换机的数据处理 commPort = 1; var GetSwicthInfo = masProtocol.Deserialize <GetSwitchboardParamCommRequest>(); data = CoreBllObj.HandGetSwitchInfo(masProtocol, GetSwicthInfo, ref deviceCode); break; case ProtocolType.DeviceControlRequest: //设备控制命令 case ProtocolType.QueryRealDataRequest: //设备实时数据获取命令 case ProtocolType.QueryDeviceInfoRequest: //获取设备唯一编码信息 var deviceControl = masProtocol.Deserialize <DeviceControlRequest>(); data = CoreBllObj.HandDeviceControl(masProtocol, deviceControl, ref deviceCode, ref commPort); break; case ProtocolType.InitializeRequest: //初始化命令 var Initialize = masProtocol.Deserialize <InitializeRequest>(); data = CoreBllObj.HandInitialize(masProtocol, Initialize, ref deviceCode, ref commPort); break; case ProtocolType.QueryBatteryRealDataRequest: //查询电源箱的命令 var batteryRealData = masProtocol.Deserialize <QueryBatteryRealDataRequest>(); data = CoreBllObj.HandQueryBatteryRealData(masProtocol, batteryRealData, ref deviceCode, ref commPort); break; case ProtocolType.ResetDeviceCommandRequest: //设备复位 var resetDevice = masProtocol.Deserialize <ResetDeviceCommandRequest>(); data = CoreBllObj.HandResetDeviceCommand(masProtocol, resetDevice, ref deviceCode, ref commPort); break; case ProtocolType.TimeSynchronizationRequest: //时间同步 var timeSynchronization = masProtocol.Deserialize <TimeSynchronizationRequest>(); data = CoreBllObj.HandTimeSynchronization(masProtocol, timeSynchronization, ref deviceCode, ref commPort); break; case ProtocolType.ModificationDeviceAdressRequest: //传感器地址修改 var modificationdeviceadress = masProtocol.Deserialize <ModificationDeviceAdressRequest>(); data = CoreBllObj.HandModificationDeviceAdress(masProtocol, modificationdeviceadress, ref deviceCode, ref commPort); break; case ProtocolType.QueryHistoryControlRequest: //查询分站历史控制记录 var queryhistorycontrol = masProtocol.Deserialize <QueryHistoryControlRequest>(); data = CoreBllObj.HandQueryHistoryControl(masProtocol, queryhistorycontrol, ref deviceCode, ref commPort); break; case ProtocolType.QueryHistoryRealDataRequest: //查询分站历史4小时数据记录 var queryhistoryrealdata = masProtocol.Deserialize <QueryHistoryRealDataRequest>(); data = CoreBllObj.HandQueryHistoryRealData(masProtocol, queryhistoryrealdata, ref deviceCode, ref commPort); break; case ProtocolType.SetSensorGradingAlarmRequest: //传感器分级报警下发 var sensorgradingalarm = masProtocol.Deserialize <SetSensorGradingAlarmRequest>(); data = CoreBllObj.HandSensorGradingAlarm(masProtocol, sensorgradingalarm, ref deviceCode, ref commPort); break; case ProtocolType.CallPersonRequest: //井下人员呼叫 var callperson = masProtocol.Deserialize <CallPersonRequest>(); data = CoreBllObj.HandCallPersonCommand(masProtocol, callperson, ref deviceCode); break; case ProtocolType.GetStationUpdateStateRequest: var getStationUpdateStateRequest = masProtocol.Deserialize <GetStationUpdateStateRequest>(); data = CoreBllObj.HandGetStationUpdateState(masProtocol, getStationUpdateStateRequest, ref deviceCode); break; case ProtocolType.InspectionRequest: var inspectionResponse = masProtocol.Deserialize <InspectionRequest>(); data = CoreBllObj.HandInspection(masProtocol, inspectionResponse, ref deviceCode); break; case ProtocolType.ReductionRequest: var reductionRequest = masProtocol.Deserialize <ReductionRequest>(); data = CoreBllObj.HandReduction(masProtocol, reductionRequest, ref deviceCode); break; case ProtocolType.RestartRequest: var restartRequest = masProtocol.Deserialize <RestartRequest>(); data = CoreBllObj.HandRestart(masProtocol, restartRequest, ref deviceCode); break; case ProtocolType.StationUpdateRequest: var stationUpdateRequest = masProtocol.Deserialize <StationUpdateRequest>(); data = CoreBllObj.HandStationUpdate(masProtocol, stationUpdateRequest, ref deviceCode); break; case ProtocolType.UpdateCancleRequest: var updateCancleRequest = masProtocol.Deserialize <UpdateCancleRequest>(); data = CoreBllObj.HandUpdateCancle(masProtocol, updateCancleRequest, ref deviceCode); break; case ProtocolType.SendUpdateBufferRequest: var sendUpdateBufferRequest = masProtocol.Deserialize <SendUpdateBufferRequest>(); data = CoreBllObj.HandSendUpdateBuffer(masProtocol, sendUpdateBufferRequest, ref deviceCode); break; } if (deviceCode != "000" && data != null)//通过事件抛出向下的数据包 { LogHelper.Info("网络模块:" + deviceCode + " 分站:" + CoreBllObj.Point + " 下发:" + masProtocol.ProtocolType); if (Cache.ShowYmOut == 1) //有源码输出才进行相关的处理 { Cache.AddCommData(data, deviceCode, 2); //下发源码输出 } if (OnNetDataCreated != null) { OnNetDataCreated(null, new NetDataEventCreatedArgs() { DeviceCode = deviceCode, Data = data, DriverCode = this.DriverCode, CommPort = commPort }); } } }