コード例 #1
0
        /// <summary>Process the mission data sending.</summary>
        /// <param name="elementId">Identifier for the element.</param>
        /// <param name="missionCode">The mission code.</param>
        private static void ProcessMissionDataSending(string elementId, string missionCode)
        {
            ServiceInfo         serviceInfo = null;
            T2GManagerErrorEnum t2gResult   = _t2gManager.GetAvailableServiceData(elementId, (int)eServiceID.eSrvSIF_RealTimeServer, out serviceInfo);

            if (t2gResult == T2GManagerErrorEnum.eSuccess)
            {
                string endpoint = "http://" + serviceInfo.ServiceIPAddress + ":" + serviceInfo.ServicePortNumber;
                try
                {
                    // Call RealTime train service and send the request.
                    using (Train.RealTime.RealTimeTrainServiceClient lTrainClient = new Train.RealTime.RealTimeTrainServiceClient("RealTimeTrainEndpoint", endpoint))
                    {
                        try
                        {
                            Train.RealTime.DelayType   rtinfoDelay   = null;
                            Train.RealTime.WeatherType rtinfoWeather = null;

                            RealTimeUtils.ConvertGroundMissionDataToTrainMissionData(
                                _rtpisDataStore.GetMissionRealTimeInformation(missionCode),
                                out rtinfoDelay,
                                out rtinfoWeather);

                            Train.RealTime.SetMissionRealTimeRequest request = new Train.RealTime.SetMissionRealTimeRequest(
                                missionCode,
                                rtinfoDelay != null ? Train.RealTime.ActionTypeEnum.Set : Train.RealTime.ActionTypeEnum.Delete,
                                rtinfoDelay,
                                rtinfoWeather != null ? Train.RealTime.ActionTypeEnum.Set : Train.RealTime.ActionTypeEnum.Delete,
                                rtinfoWeather);
                            Train.RealTime.SetMissionRealTimeResponse response = ((Train.RealTime.IRealTimeTrainService)lTrainClient).SetMissionRealTime(request);

                            ProcessCommandResultList(elementId, missionCode, response.ResultList);
                        }
                        catch (Exception ex)
                        {
                            LogManager.WriteLog(TraceType.EXCEPTION, string.Format(CultureInfo.CurrentCulture, Logs.ERROR_FAILED_SEND_REQUEST_TO_EMBEDDED, elementId), "PIS.Ground.RealTime.RealTimeService.ProcessMissionDataSending", ex, EventIdEnum.RealTime);
                        }
                        finally
                        {
                            if (lTrainClient.State == CommunicationState.Faulted)
                            {
                                lTrainClient.Abort();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    LogManager.WriteLog(TraceType.EXCEPTION, string.Format(CultureInfo.CurrentCulture, Logs.ERROR_FAILED_SEND_REQUEST_TO_EMBEDDED, elementId), "PIS.Ground.RealTime.RealTimeService.ProcessMissionDataSending", ex, EventIdEnum.RealTime);
                }
            }
            else if (t2gResult == T2GManagerErrorEnum.eElementNotFound)
            {
                LogManager.WriteLog(TraceType.WARNING, string.Format(CultureInfo.CurrentCulture, Logs.ERROR_GET_SERVICE_DATA_FOR_ELEMENT, elementId, t2gResult), "PIS.Ground.RealTime.RealTimeService.ProcessMissionDataSending", null, EventIdEnum.RealTime);
            }
            else if (LogManager.IsTraceActive(TraceType.DEBUG))
            {
                LogManager.WriteLog(TraceType.DEBUG, string.Format(CultureInfo.CurrentCulture, Logs.DEBUG_GET_SERVICE_DATA_FOR_ELEMENT, elementId, t2gResult), "PIS.Ground.RealTime.RealTimeService.ProcessMissionDataSending", null, EventIdEnum.RealTime);
            }
        }
コード例 #2
0
        private static void SendStartStreamingCommandToProperStatusElements(string url)
        {
            try
            {
                // Get the list of all currently available trains
                ElementList <AvailableElementData> elements = new ElementList <AvailableElementData>();
                T2GManagerErrorEnum rqstResult = _t2gManager.GetAvailableElementDataList(out elements);

                switch (rqstResult)
                {
                case T2GManagerErrorEnum.eSuccess:
                    // Send notification to all clients
                    LiveVideoControlService.SendNotificationToGroundApp(
                        Guid.Empty,
                        PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlAutomaticMode,
                        url);

                    // Send a start command to each train that is online and in mission
                    foreach (AvailableElementData element in elements)
                    {
                        TargetAddressType target = new TargetAddressType();
                        target.Type = AddressTypeEnum.Element;
                        target.Id   = element.ElementNumber;

                        _dicVideoHistory[target]            = url;
                        _dicVideoHistorySentService[target] = null;

                        if (element.OnlineStatus == true && element.MissionState == MissionStateEnum.MI)
                        {
                            ServiceInfo availableService;
                            if (_t2gManager.GetAvailableServiceData(element.ElementNumber, (int)eServiceID.eSrvSIF_LiveVideoControlServer, out availableService) == T2GManagerErrorEnum.eSuccess)
                            {
                                _dicVideoHistorySentService[target] = availableService;
                            }

                            SendStartStreamingCommand(Guid.Empty, target, url);
                        }
                    }
                    break;

                case T2GManagerErrorEnum.eT2GServerOffline:
                    LogManager.WriteLog(TraceType.ERROR, "T2G Server: Offline",
                                        "PIS.Ground.LiveVideoControl.LiveVideoControlService.ProcessAutomaticMode",
                                        null, EventIdEnum.LiveVideoControl);
                    break;

                default:
                    LogManager.WriteLog(TraceType.ERROR, "Element not found",
                                        "PIS.Ground.LiveVideoControl.LiveVideoControlService.ProcessAutomaticMode", null, EventIdEnum.LiveVideoControl);
                    break;
                }
            }
            catch (System.Exception exception)
            {
                LogManager.WriteLog(TraceType.EXCEPTION, exception.Message,
                                    "PIS.Ground.LiveVideoControl.LiveVideoControlService.ProcessAutomaticMode", exception, EventIdEnum.LiveVideoControl);
            }
        }
コード例 #3
0
        protected void WaitTrainOnlineWithPISGround(string trainName, bool waitForDataPackage, int delay)
        {
            bool isOnline;

            Assert.That(() => _t2gManager.IsElementOnline(trainName, out isOnline) == T2GManagerErrorEnum.eSuccess && isOnline == true, Is.True.After(delay, ONE_SECOND / 5), "The train '{0}' is not online with PIS-Ground as expected", trainName);

            if (waitForDataPackage)
            {
                PIS.Ground.Core.Data.ServiceInfo serviceInfo;
                Assert.That(_t2gManager.GetAvailableServiceData(trainName, (int)eServiceID.eSrvSIF_DataPackageServer, out serviceInfo) == T2GManagerErrorEnum.eSuccess, Is.True.After(delay, ONE_SECOND / 5), "The service DataPackageService is not available with PIS-Ground as expected on train '{0}'", trainName);
            }
        }
コード例 #4
0
        /// <summary>Process the distribute request described by request.</summary>
        /// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
        /// <param name="request">The request.</param>
        private void ProcessDistributeRequest(IRequestContext request)
        {
            BaselineDistributingRequestContext requestContext = request as BaselineDistributingRequestContext;

            if (requestContext == null)
            {
                throw new ArgumentException(Logs.ERROR_INVALID_BASELINE_DISTRIBUTE_REQUEST_CONTEXT, "request");
            }

            List <string> parametersList = new List <string>()
            {
                requestContext.ElementId,
                requestContext.BaselineVersion
            };

            using (StringWriter stringWriter = new StringWriter())
            {
                _stringListXmlSerializer.Serialize(stringWriter, parametersList);

                if (requestContext.TransferAttemptsDone == 1)
                {
                    DataPackageService.sendNotificationToGroundApp(
                        request.RequestId,
                        PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageDistributionPending,
                        stringWriter.ToString());
                }

                if (_trainToGroundManager.IsElementOnlineAndPisBaselineUpToDate(requestContext.ElementId))
                {
                    ServiceInfo serviceInfo;
                    if (T2GManagerErrorEnum.eSuccess == _trainToGroundManager.GetAvailableServiceData(requestContext.ElementId, (int)Core.Common.eServiceID.eSrvSIF_DataPackageServer, out serviceInfo))
                    {
                        // Rebuild the url of the service in case that it has changed since the last invocation.
                        requestContext.Endpoint = "http://" + serviceInfo.ServiceIPAddress + ":" + serviceInfo.ServicePortNumber;
                        try
                        {
                            using (PIS.Ground.DataPackage.DataPackageTrainServiceClient lTrainDataPackageClient = new PIS.Ground.DataPackage.DataPackageTrainServiceClient("DataPackageEndpoint", requestContext.Endpoint))
                            {
                                try
                                {
                                    List <RecipientId> recipients = new List <RecipientId>()
                                    {
                                        new RecipientId()
                                        {
                                            ApplicationId = ConfigurationSettings.AppSettings["ApplicationId"],
                                            SystemId      = requestContext.ElementId,
                                            MissionId     = string.Empty
                                        }
                                    };

                                    DataPackageService.mWriteLog(TraceType.INFO, System.Reflection.MethodBase.GetCurrentMethod().Name, null, Logs.INFO_FUTURE_BASELINE, requestContext.ElementId, requestContext.BaselineVersion);

                                    if (!string.IsNullOrEmpty(requestContext.BaselineVersion))
                                    {
                                        List <PackageParams> packagesParamsList;
                                        List <string>        filesUrlsList;
                                        if (GetBaselineFilesURLs(requestContext.RequestId, requestContext.ElementId, requestContext.BaselineVersion, requestContext.IsIncremental, true, out filesUrlsList, out packagesParamsList))
                                        {
                                            try
                                            {
                                                using (IRemoteDataStoreClient remoteDataStore = _remoteDataStoreFactory.GetRemoteDataStoreInstance())
                                                {
                                                    filesUrlsList.Add(ConfigurationSettings.AppSettings["RemoteDataStoreUrl"]
                                                                      + remoteDataStore.createBaselineFile(
                                                                          requestContext.RequestId,
                                                                          requestContext.ElementId,
                                                                          requestContext.BaselineVersion,
                                                                          requestContext.BaselineActivationDate.ToString(),
                                                                          requestContext.BaselineExpirationDate.ToString()));
                                                }
                                            }
                                            catch (Exception ex)
                                            {
                                                DataPackageService.mWriteLog(TraceType.EXCEPTION, System.Reflection.MethodBase.GetCurrentMethod().Name, ex, Logs.ERROR_REMOTEDATASTORE_FAULTED);
                                            }

                                            if (filesUrlsList.Count > 0)
                                            {
                                                UploadFileDistributionRequest uploadFilesRequestContext = new UploadFileDistributionRequest(
                                                    requestContext.RequestId,
                                                    requestContext.RequestId.ToString(),
                                                    requestContext.DistributionAttributes.transferExpirationDate,
                                                    filesUrlsList,
                                                    requestContext.DistributionAttributes.fileCompression,
                                                    recipients,
                                                    requestContext.DistributionAttributes.transferDate,
                                                    "Distribute baseline for element " + requestContext.ElementId,
                                                    requestContext.DistributionAttributes.TransferMode,
                                                    requestContext.DistributionAttributes.priority,
                                                    new EventHandler <FileDistributionStatusArgs>(DataPackageService.OnFileDistributeNotification),
                                                    new EventHandler <FileDistributionTaskCreatedArgs>(_baselineStatusUpdater.OnFileDistributionTaskCreated));

                                                DataPackageService.sendNotificationToGroundApp(requestContext.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageFutureBaselineDefinition, stringWriter.ToString());

                                                string logMessage = "Distribute baseline for element " + requestContext.ElementId;
                                                logMessage += ". Files to upload : ";
                                                foreach (string file in filesUrlsList)
                                                {
                                                    logMessage += file + ", ";
                                                }

                                                logMessage = logMessage.Substring(0, logMessage.Length - 2);
                                                DataPackageService.mWriteLog(TraceType.INFO, System.Reflection.MethodBase.GetCurrentMethod().Name, null, logMessage);

                                                AvailableElementData elementData;
                                                T2GManagerErrorEnum  lRqstResult = _trainToGroundManager.GetAvailableElementDataByElementNumber(requestContext.ElementId, out elementData);

                                                if (lRqstResult == T2GManagerErrorEnum.eSuccess &&
                                                    elementData != null && elementData.PisBaselineData != null)
                                                {
                                                    _baselineStatusUpdater.ProcessDistributeBaselineRequest(
                                                        elementData.ElementNumber,
                                                        requestContext.RequestId,
                                                        elementData.OnlineStatus,
                                                        elementData.PisBaselineData.CurrentVersionOut,
                                                        elementData.PisBaselineData.FutureVersionOut,
                                                        requestContext.BaselineVersion);
                                                }
                                                else
                                                {
                                                    DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, null, Logs.ERROR_ELEMENT_INFO, requestContext.ElementId);
                                                }

                                                DataPackageService.mAddBaselineVersionToDictionary(requestContext.RequestId, requestContext.ElementId, requestContext.BaselineVersion);
                                                DataPackageService.mAddPackagesToUsedPackagesList(packagesParamsList);
                                                _trainToGroundManager.T2GFileDistributionManager.AddUploadRequest(uploadFilesRequestContext);
                                                requestContext.TransmissionStatus = true;
                                                DataPackageService.mRemovePackagesFromUsedPackagesList(packagesParamsList);
                                            }
                                        }
                                        else
                                        {
                                            requestContext.CompletionStatus = true;
                                            DataPackageService.sendNotificationToGroundApp(requestContext.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageDistributionFailed, stringWriter.ToString());
                                            DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, null, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, Logs.ERROR_GETTING_URL_LIST);
                                        }
                                    }
                                    else
                                    {
                                        requestContext.CompletionStatus = true;
                                        DataPackageService.sendNotificationToGroundApp(requestContext.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageDistributionFailed, stringWriter.ToString());
                                        DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, null, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED_UNKNOW_BASELINE_VERSION, requestContext.ElementId);
                                    }
                                }
                                catch (Exception ex)
                                {
                                    if (false == requestContext.OnCommunicationError(ex))
                                    {
                                        requestContext.CompletionStatus = true;
                                        DataPackageService.sendNotificationToGroundApp(requestContext.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageDistributionFailedRejectedByElement, stringWriter.ToString());
                                        DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, ex, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, ex.Message);
                                    }
                                    else
                                    {
                                        DataPackageService.mWriteLog(TraceType.DEBUG, System.Reflection.MethodBase.GetCurrentMethod().Name, ex, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, ex.Message);
                                    }
                                }
                                finally
                                {
                                    if (lTrainDataPackageClient.State == CommunicationState.Faulted)
                                    {
                                        lTrainDataPackageClient.Abort();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            if (false == requestContext.OnCommunicationError(ex))
                            {
                                requestContext.CompletionStatus = true;
                                DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, ex, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, ex.Message);
                                DataPackageService.sendNotificationToGroundApp(requestContext.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.DataPackageDistributionFailed, stringWriter.ToString());
                            }
                            else
                            {
                                DataPackageService.mWriteLog(TraceType.DEBUG, System.Reflection.MethodBase.GetCurrentMethod().Name, ex, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, ex.Message);
                            }
                        }
                    }
                    else
                    {
                        DataPackageService.mWriteLog(TraceType.ERROR, System.Reflection.MethodBase.GetCurrentMethod().Name, null, Logs.ERROR_DISTRIBUTE_BASELINE_FAILED, requestContext.BaselineVersion, requestContext.ElementId, "Cannot get embedded DataPackage service data.");
                        requestContext.TransmissionStatus = false;
                    }
                }
                else
                {
                    requestContext.TransmissionStatus = false;
                }
            }
        }
コード例 #5
0
        private static void TransmitGetReportRequest(GetReportRequestContext request)
        {
            bool lTransmitted = false;

            ServiceInfo         serviceInfo;
            T2GManagerErrorEnum lRqstResult = _t2gManager.GetAvailableServiceData(request.ElementId, (int)eServiceID.eSrvSIF_ReportExchangeServer, out serviceInfo);

            switch (lRqstResult)
            {
            case T2GManagerErrorEnum.eSuccess:
            {
                String lEndpoint = "http://" + serviceInfo.ServiceIPAddress + ":" + serviceInfo.ServicePortNumber;

                // Check if target element is online
                bool lIsElementOnline;
                lRqstResult = _t2gManager.IsElementOnline(request.ElementId, out lIsElementOnline);

                switch (lRqstResult)
                {
                case T2GManagerErrorEnum.eSuccess:
                    if (true == lIsElementOnline)
                    {
                        // Call Report Exchange train service
                        using (ReportExchange.ReportExchangeServiceClient client = new ReportExchange.ReportExchangeServiceClient("ReportExchangeEndpoint", lEndpoint))
                        {
                            try
                            {
                                String requestIdStr = request.RequestId.ToString();

                                // Call onboard train Report Exchange Web service
                                ReportExchange.ResultType result;
                                client.GetInfotainmentJournal(ref requestIdStr, out result);

                                // TODO (???) extract Folder ID from request - Check with Malik request.FolderId = result.folderId

                                switch (result)
                                {
                                case ReportExchange.ResultType.ServiceInhibited:
                                    SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadInhibited, request.ElementId);
                                    break;

                                case ReportExchange.ResultType.Failure:
                                    SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.Failed, request.ElementId);
                                    break;

                                case ReportExchange.ResultType.NoEntryFound:
                                    SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadNoReportEntryFound, request.ElementId);
                                    lTransmitted = true;
                                    break;

                                case ReportExchange.ResultType.Success:
                                    lTransmitted = true;
                                    break;

                                default:
                                    LogManager.WriteLog(TraceType.ERROR,
                                                        String.Format("Unexpected return value from WebService client: {0}", result),
                                                        "PIS.Ground.Infotainment.Journaling.JournalingService.TransmitGetReportRequest",
                                                        null, EventIdEnum.InfotainmentJournaling);
                                    break;
                                }
                            }
                            catch (Exception ex)
                            {
                                LogManager.WriteLog(TraceType.ERROR,
                                                    String.Format("Unexpected error from WebService client: {0}", ex.Message),
                                                    "PIS.Ground.Infotainment.Journaling.JournalingService.TransmitGetReportRequest",
                                                    ex, EventIdEnum.InfotainmentJournaling);
                            }
                            finally
                            {
                                if (client.State == CommunicationState.Faulted)
                                {
                                    client.Abort();
                                }
                            }
                        }
                    }
                    break;

                case T2GManagerErrorEnum.eT2GServerOffline:
                    SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentT2GServerOffline, "");
                    break;

                case T2GManagerErrorEnum.eElementNotFound:
                    SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadElementNotFound, request.ElementId);
                    break;

                default:
                    break;
                }
            }
            break;

            case T2GManagerErrorEnum.eT2GServerOffline:
                SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentT2GServerOffline, "");
                break;

            case T2GManagerErrorEnum.eElementNotFound:
                SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadElementNotFound, request.ElementId);
                break;

            case T2GManagerErrorEnum.eServiceInfoNotFound:
                SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadServiceNotFound, eServiceID.eSrvSIF_ReportExchangeServer.ToString());
                break;

            default:
                LogManager.WriteLog(TraceType.INFO, "Failed to obtain service data from T2G", "PIS.Ground.Infotainment.Journaling.JournalingService.TransmitGetReportRequest", null, EventIdEnum.InfotainmentJournaling);
                break;
            }

            request.TransmissionStatus = lTransmitted;
        }
コード例 #6
0
        /// <summary>Transmit request to embedded system.</summary>
        /// <param name="request">The request to send to embedded.</param>
        private static void TransmitRequest(RequestContext request)
        {
            bool requestIsTransmitted = false;

            ServiceInfo serviceInfo;

            // Check if target element is online
            bool elementIsOnline;
            T2GManagerErrorEnum rqstResult = _train2groundManager.IsElementOnline(request.ElementId, out elementIsOnline);

            switch (rqstResult)
            {
            case T2GManagerErrorEnum.eSuccess:
                if (elementIsOnline == true)
                {
                    T2GManagerErrorEnum result = _train2groundManager.GetAvailableServiceData(request.ElementId, (int)eServiceID.eSrvSIF_LiveVideoControlServer, out serviceInfo);
                    switch (result)
                    {
                    case T2GManagerErrorEnum.eSuccess:
                    {
                        string endpoint = "http://" + serviceInfo.ServiceIPAddress + ":" + serviceInfo.ServicePortNumber;
                        try
                        {
                            // Call LiveVideoControl train service
                            using (LiveVideoControlServiceClient trainClient = new LiveVideoControlServiceClient("LiveVideoControlEndpoint", endpoint))
                            {
                                try
                                {
                                    if (request is ProcessStopVideoStreamingCommandRequestContext)
                                    {
                                        RequestProcessor.TransmitStopVideoStreamingCommandRequest(trainClient, request as ProcessStopVideoStreamingCommandRequestContext);
                                    }
                                    else if (request is ProcessStartVideoStreamingCommandRequestContext)
                                    {
                                        RequestProcessor.TransmitStartVideoStreamingCommandRequest(trainClient, request as ProcessStartVideoStreamingCommandRequestContext);
                                    }
                                    else if (request is ProcessSendVideoStreamingStatusRequestContext)
                                    {
                                        RequestProcessor.TransmitSendVideoStreamingStatusRequest(trainClient, request as ProcessSendVideoStreamingStatusRequestContext);
                                    }
                                    else
                                    {
                                        // No other request type supported
                                    }

                                    requestIsTransmitted = true;
                                }
                                catch (Exception ex)
                                {
                                    if (!RequestProcessor.ShouldContinueOnTransmissionError(ex))
                                    {
                                        // Assume transmitted (no reason to retry)
                                        requestIsTransmitted = true;
                                    }
                                }
                                finally
                                {
                                    if (trainClient.State == CommunicationState.Faulted)
                                    {
                                        trainClient.Abort();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            if (!RequestProcessor.ShouldContinueOnTransmissionError(ex))
                            {
                                // Assume transmitted (no reason to retry)
                                requestIsTransmitted = true;
                            }
                        }
                    }

                    break;

                    case T2GManagerErrorEnum.eT2GServerOffline:
                        RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlT2GServerOffline, string.Empty);
                        break;

                    case T2GManagerErrorEnum.eElementNotFound:
                        RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlElementNotFound, request.ElementId);
                        break;

                    case T2GManagerErrorEnum.eServiceInfoNotFound:
                        RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlServiceNotFound, request.ElementId);
                        break;

                    default:
                        break;
                    }
                }

                break;

            case T2GManagerErrorEnum.eT2GServerOffline:
                RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlT2GServerOffline, string.Empty);
                break;

            case T2GManagerErrorEnum.eElementNotFound:
                requestIsTransmitted = true;
                RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlElementNotFound, request.ElementId);
                break;

            default:
                break;
            }

            request.TransmissionStatus = requestIsTransmitted;

            if (request.State == RequestState.WaitingRetry && request.TransferAttemptsDone == 1)
            {
                // first attempt failed, send notification
                RequestProcessor.SendNotificationToGroundApp(request.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.LiveVideoControlDistributionWaitingToSend, request.ElementId);
            }
        }