/// <summary> /// 设备类请求处理 /// </summary> /// <param name="rpcRequest"></param> /// <returns></returns> private RpcResponse HandleDeviceRequest(RpcRequest rpcRequest) { var masProtocol = rpcRequest.ToRequest <GatewayRpcRequest>().MasProtocol; //调用驱动 处理业务 DeviceProtocol deviceProtocol = masProtocol.Deserialize <DeviceProtocol>(); string driverCode = GatewayMapper.GetDriverCodeByDeviceCode(deviceProtocol.DeviceCode); GatewayManager.DriverManager.HandleProtocolData(driverCode, masProtocol); return(RpcResponse.Response <GatewayRpcResponse>(new GatewayRpcResponse())); }
/// <summary> /// 业务类请求处理 /// </summary> /// <param name="rpcRequest"></param> /// <returns></returns> private RpcResponse HandleBusinessRequest(RpcRequest rpcRequest) { var masProtocol = rpcRequest.ToRequest <GatewayRpcRequest>().MasProtocol; //处理业务 switch (masProtocol.ProtocolType) { case ProtocolType.UpdateCacheDataRequest: //安全监控、人员定位缓存同步 GatewayManager.CacheManager.HandleUpdateCacheDataRequest(masProtocol); break; //新增广播系统服务端业务请求处理 20171229 case ProtocolType.EndPaTaskRequest: //结束广播任务 return(BroadCastBusinessManager.endPaTask(masProtocol)); case ProtocolType.HangupCallRequest: //挂断呼叫 return(BroadCastBusinessManager.hangupCall(masProtocol)); case ProtocolType.MakeCallRequest: //发起呼叫 return(BroadCastBusinessManager.makeCall(masProtocol)); case ProtocolType.MonitorCallRequest: //监听呼叫 return(BroadCastBusinessManager.monitorCall(masProtocol)); case ProtocolType.MusicControlRequest: //音乐管理 return(BroadCastBusinessManager.musicManage(masProtocol)); case ProtocolType.PartitionControlRequest: //分区管理 return(BroadCastBusinessManager.zoneManage(masProtocol)); case ProtocolType.PlayListControlRequest: //播放列表管理 return(BroadCastBusinessManager.playListManage(masProtocol)); case ProtocolType.PlayListMusicControlRequest: //播放列表音乐管理 return(BroadCastBusinessManager.playListMusicManage(masProtocol)); case ProtocolType.StartPaMusicTaskRequest: //启动音乐广播任务 return(BroadCastBusinessManager.startPaMusicTask(masProtocol)); case ProtocolType.StartPaTtsTaskRequest: //启动文字广播任务 return(BroadCastBusinessManager.startPaTtsTask(masProtocol)); case ProtocolType.StartPaVoiceTaskRequest: //启动喊话广播任务 return(BroadCastBusinessManager.startPaVoiceTask(masProtocol)); case ProtocolType.TerminalControlRequest: //终端管理 return(BroadCastBusinessManager.termManage(masProtocol)); case ProtocolType.QureyTerminalRequest: //查询终端 return(BroadCastBusinessManager.queryTerm(masProtocol)); } return(RpcResponse.Response <GatewayRpcResponse>(new GatewayRpcResponse())); }
/// <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="rpcRequest"></param> /// <returns></returns> private static RpcResponse HandleDeviceRequest(RpcRequest rpcRequest) { var masProtocol = rpcRequest.ToRequest <GatewayRpcRequest>().MasProtocol; //todo if (OnDeviceMessageArrived != null) { OnDeviceMessageArrived(masProtocol); } return(RpcResponse.Response <GatewayRpcResponse>(new GatewayRpcResponse())); }
/// <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 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 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 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="rpcRequest"></param> /// <returns></returns> private static RpcResponse HandleBusinessRequest(RpcRequest rpcRequest) { var masProtocol = rpcRequest.ToRequest <GatewayRpcRequest>().MasProtocol; //todo 处理业务 if (masProtocol.ProtocolType == ProtocolType.QueryCacheDataRequest) //网关请求获取缓存信息 { QueryCacheDataResponse queryCacheDataResponse = QueryCacheDataToGateway.QueryServiceCacheDataToGateway(); return(RpcResponse.Response <QueryCacheDataResponse>(queryCacheDataResponse)); } return(RpcResponse.Response <GatewayRpcResponse>(new GatewayRpcResponse())); }
/// <summary> /// 删除分区 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse delZone(PartitionControlRequest request) { PartitionControlResponse response = BroadCastControllerProxy.broadCastControllerProxy.delZone(request); return(RpcResponse.Response <PartitionControlResponse>(response)); }
/// <summary> /// 删除播放列表 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse delPlayList(PlayListControlRequest request) { PlayListControlResponse response = BroadCastControllerProxy.broadCastControllerProxy.delPlayList(request); return(RpcResponse.Response <PlayListControlResponse>(response)); }
/// <summary> /// 删除音乐 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse delMusic(MusicControlRequest request) { MusicControlResponse response = BroadCastControllerProxy.broadCastControllerProxy.delMusic(request); return(RpcResponse.Response <MusicControlResponse>(response)); }
/// <summary> /// 删除终端 /// </summary> /// <param name="masProtocol"></param> /// <returns></returns> public static RpcResponse delTerm(TerminalControlRequest request) { TerminalControlResponse response = BroadCastControllerProxy.broadCastControllerProxy.delTerm(request); return(RpcResponse.Response <TerminalControlResponse>(response)); }