/// <summary>Sends a start streaming command.</summary> /// <param name="sessionId">The session identifier.</param> /// <param name="targetAddress">Addressee information.</param> /// <param name="url">The streaming URL to be used.</param> /// <returns>Response <see cref="LiveVideoControlElementListResult"/>.</returns> private static LiveVideoControlResult SendStartStreamingCommand( Guid sessionId, TargetAddressType targetAddress, string url) { LiveVideoControlResult result = new LiveVideoControlResult(); result.RequestId = Guid.Empty; result.ResultCode = LiveVideoControlErrorEnum.InternalError; Guid requestId = Guid.Empty; string error; if (sessionId != Guid.Empty) { error = _sessionManager.GenerateRequestID(sessionId, out requestId); } else { error = _sessionManager.GenerateRequestID(out requestId); } if (requestId != Guid.Empty) { ElementList <AvailableElementData> elements; T2GManagerErrorEnum rqstResult = _t2gManager.GetAvailableElementDataByTargetAddress(targetAddress, out elements); switch (rqstResult) { case T2GManagerErrorEnum.eSuccess: Guid notificationRequestId = requestId; List <RequestContext> newRequests = new List <RequestContext>(); foreach (AvailableElementData element in elements) { if (_dicVideoHistorySentService.ContainsKey(targetAddress)) { ServiceInfo availableService; if (_t2gManager.GetAvailableServiceData(element.ElementNumber, (int)eServiceID.eSrvSIF_LiveVideoControlServer, out availableService) == T2GManagerErrorEnum.eSuccess) { _dicVideoHistorySentService[targetAddress] = availableService; } } LiveVideoControlService.SendNotificationToGroundApp(requestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlDistributionProcessing, element.ElementNumber); ProcessStartVideoStreamingCommandRequestContext request = new ProcessStartVideoStreamingCommandRequestContext( element.ElementNumber, requestId, sessionId, url); newRequests.Add(request); } _requestProcessor.AddRequestRange(newRequests); result.RequestId = requestId; result.ResultCode = LiveVideoControlErrorEnum.RequestAccepted; break; case T2GManagerErrorEnum.eT2GServerOffline: LogManager.WriteLog(TraceType.ERROR, "T2G Offline", "PIS.Ground.LiveVideoControl.LiveVideoControlService.SendStartStreamingCommand", null, EventIdEnum.LiveVideoControl); result.ResultCode = LiveVideoControlErrorEnum.T2GServerOffline; break; case T2GManagerErrorEnum.eElementNotFound: LogManager.WriteLog(TraceType.ERROR, "Element not found", "PIS.Ground.LiveVideoControl.LiveVideoControlService.SendStartStreamingCommand", null, EventIdEnum.LiveVideoControl); result.ResultCode = LiveVideoControlService.GetInvalidTargetAddressResponse(targetAddress); break; default: LogManager.WriteLog(TraceType.ERROR, "Problem looking for an element. T2GClient returned: " + rqstResult.ToString(), "PIS.Ground.LiveVideoControl.LiveVideoControlService.SendStartStreamingCommand", null, EventIdEnum.LiveVideoControl); result.ResultCode = LiveVideoControlErrorEnum.InternalError; break; } } else { LogManager.WriteLog(TraceType.ERROR, error, "PIS.Ground.LiveVideoControl.LiveVideoControlService.SendStartStreamingCommand", null, EventIdEnum.LiveVideoControl); result.ResultCode = LiveVideoControlErrorEnum.InvalidRequestID; } return(result); }
/// <summary>Transmit start video streaming command request.</summary> /// <exception cref="FaultException">Thrown when a Fault error condition occurs.</exception> /// <param name="client">The emebedded web service client.</param> /// <param name="request">The request to send to embedded.</param> private static void TransmitStartVideoStreamingCommandRequest(LiveVideoControlServiceClient client, ProcessStartVideoStreamingCommandRequestContext request) { LiveVideoControlRspEnumType result = LiveVideoControlRspEnumType.StopVideoStreamingCommandReceived; try { result = client.StartVideoStreamingCommand(request.RequestId.ToString(), request.Url); } catch (FaultException) { // When there is a SOAP fault while sending, we still notify that we sent the request RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlDistributionSent, request.ElementId); throw; } RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlDistributionSent, request.ElementId); if (result == LiveVideoControlRspEnumType.StartVideoStreamingCommandReceived) { RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlDistributionReceived, request.ElementId); } else { RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlErrorUndefined, request.ElementId); } request.TransmissionStatus = true; }