Exemplo n.º 1
0
        /// <summary>Raises OnFileDistributeNotification.</summary>
        /// <param name="eventArgs">FileDistributionStatusArgs object.</param>
        /// <param name="taskId">task id.</param>
        /// <returns>true if it succeeds, false if it fails.</returns>
        public void RaiseOnFileDistributeNotificationEvent(FileDistributionStatusArgs eventArgs, int taskId)
        {
            // (1) Per taskId processing

            if (taskId > 0 && eventArgs != null && eventArgs.RequestId != Guid.Empty && _fileDistributionManager != null)
            {
                EventHandler <FileDistributionStatusArgs> handler = _fileDistributionManager.GetFileDistributionEventByTaskId(taskId);

                lock (_subscriberLock)
                {
                    NotifyEventHandlerAsync(eventArgs, handler);
                }

                // download the file from T2G ground server (asynchronously)
                if (eventArgs.DistributionCompletionPercent == 100)
                {
                    Func <int, bool> invoker = _fileDistributionManager.DownloadFile;
                    invoker.BeginInvoke(taskId, result => invoker.EndInvoke(result), null);
                }
            }

            // (2) General processing not specific to a particular request

            RaiseOnFileDistributeNotificationEvent(eventArgs);
        }
Exemplo n.º 2
0
 /// <summary>Raises OnFileDistributeNotificationEvent.</summary>
 /// <param name="eventArgs">FileDistributionStatusArgs object.</param>
 /// <returns>true if it succeeds, false if it fails.</returns>
 public void RaiseOnFileDistributeNotificationEvent(FileDistributionStatusArgs eventArgs)
 {
     lock (_subscriberLock)
     {
         NotifyEventHandlersAsync(eventArgs, _fileDistributionEventHandlers);
     }
 }
        /// <summary>
        /// Callback called when File Transfer state changes (signaled by the T2G client)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="status"></param>
        private static void OnFilesDistribution(object sender, FileDistributionStatusArgs status)
        {
            LogManager.WriteLog(TraceType.INFO, "OnFilesDistribution called, folderId=" + status.FolderId + " systemId=" + status.TaskId, "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesDistribution", null, EventIdEnum.InfotainmentJournaling);

            try
            {
                if (status.TaskStatus == TaskState.Started && status.CurrentTaskPhase == TaskPhase.Transfer)
                {
                    FileDistributionRequest lRequest = _t2gManager.T2GFileDistributionManager.GetFileDistributionRequestByTaskId(status.TaskId);
                    lock (_reqIdsListLock)
                    {
                        if (false == _reqIdsForDownloadingNotif.Contains(lRequest.RequestId))
                        {
                            if (lRequest != null)
                            {
                                SendNotificationToGroundApp(lRequest.RequestId, PIS.Ground.GroundCore.AppGround.NotificationIdEnum.InfotainmentDownloadDownloading, lRequest.SystemId);
                            }
                            _reqIdsForDownloadingNotif.Add(lRequest.RequestId);
                        }
                    }
                }
            }
            catch (System.Exception e)
            {
                LogManager.WriteLog(TraceType.ERROR, "Exception thrown", "PIS.Ground.Infotainment.Journaling.JournalingService.OnFilesDistribution", e, EventIdEnum.InfotainmentJournaling);
            }
        }
Exemplo n.º 4
0
 /// <summary>Raises the on file distribute notification event.</summary>
 /// <param name="args">The arguments.</param>
 /// <param name="RequestId">Identifier for the request.</param>
 public void RaiseOnFileDistributeNotificationEvent(FileDistributionStatusArgs args, Guid RequestId)
 {
     if (_t2gManager != null)
     {
         _t2gManager.RaiseOnFileDistributeNotificationEvent(args);
     }
 }
Exemplo n.º 5
0
 /// <summary>Raises the on file distribute notification event.</summary>
 /// <param name="args">The arguments.</param>
 /// <param name="taskId">Identifier for the task.</param>
 public void RaiseOnFileDistributeNotificationEvent(FileDistributionStatusArgs args, int taskId)
 {
     if (_t2gManager != null)
     {
         _t2gManager.RaiseOnFileDistributeNotificationEvent(args, taskId);
     }
 }
Exemplo n.º 6
0
        /// <summary>Raises OnFileDistributeNotification.</summary>
        /// <param name="eventArgs">FileDistributionStatusArgs object.</param>
        /// <param name="RequestId">Request id.</param>
        /// <returns>true if it succeeds, false if it fails.</returns>
        public void RaiseOnFileDistributeNotificationEvent(FileDistributionStatusArgs eventArgs, Guid RequestId)
        {
            if (RequestId != Guid.Empty && _fileDistributionManager != null)
            {
                EventHandler <FileDistributionStatusArgs> handler = _fileDistributionManager.GetFileDistributionEventByRequestId(RequestId);

                lock (_subscriberLock)
                {
                    NotifyEventHandlerAsync(eventArgs, handler);
                }
            }
        }
        /// <summary>Process File Transfer Notification.</summary>
        /// <param name="taskId">task id.</param>
        /// <param name="taskState">task state.</param>
        /// <param name="taskPhase">task phase.</param>
        /// <param name="activeFileTransferCount">file transfer count.</param>
        /// <param name="errorCount">error count.</param>
        /// <param name="acquisitionCompletionPercent">acquisition complete percentage.</param>
        /// <param name="transferCompletionPercent">transfer complete percentage.</param>
        /// <param name="distributionCompletionPercent">distribute complete percentage.</param>
        public void OnFileTransferNotification(
            int taskId,
            taskStateEnum taskState,
            taskPhaseEnum taskPhase,
            ushort activeFileTransferCount,
            ushort errorCount,
            sbyte acquisitionCompletionPercent,
            sbyte transferCompletionPercent,
            sbyte distributionCompletionPercent)
        {
            if (_fileDistributionManager != null)
            {
                lock (_lock)
                {
                    FileDistributionStatusArgs fdsArgs = new FileDistributionStatusArgs();

                    fdsArgs.TaskId    = taskId;
                    fdsArgs.RequestId = _fileDistributionManager.GetFileDistributionRequestIdByTaskId(taskId);
                    fdsArgs.ActiveFileTransferCount      = activeFileTransferCount;
                    fdsArgs.AcquisitionCompletionPercent = acquisitionCompletionPercent;
                    fdsArgs.TransferCompletionPercent    = transferCompletionPercent;
                    fdsArgs.ErrorCount = errorCount;
                    fdsArgs.DistributionCompletionPercent = distributionCompletionPercent;
                    fdsArgs.TaskStatus       = T2GDataConverter.BuildTaskState(taskState);
                    fdsArgs.CurrentTaskPhase = T2GDataConverter.BuildTaskPhase(taskPhase);

                    if (LogManager.IsTraceActive(TraceType.INFO))
                    {
                        StringBuilder msg = new StringBuilder(200);
                        msg.Append("OnFileTransferNotification(");
                        msg.Append("task=").Append(fdsArgs.TaskId);
                        msg.Append(",request=").Append(fdsArgs.RequestId);
                        msg.Append(",aftc=").Append(fdsArgs.ActiveFileTransferCount);
                        msg.Append(",acp=").Append(fdsArgs.AcquisitionCompletionPercent);
                        msg.Append(",dcp=").Append(fdsArgs.DistributionCompletionPercent);
                        msg.Append(",tcp=").Append(fdsArgs.TransferCompletionPercent);
                        msg.Append(",TaskStatus=").Append(fdsArgs.TaskStatus);
                        msg.Append(",CurrentTaskPhase=").Append(fdsArgs.CurrentTaskPhase);
                        msg.Append(")");

                        LogManager.WriteLog(TraceType.INFO, msg.ToString(), "PIS.Ground.Core.T2G.T2GNotificationProcessor.OnFileTransferNotification", null, EventIdEnum.GroundCore);
                    }

                    _notifierTarget.RaiseOnFileDistributeNotificationEvent(fdsArgs, taskId);
                }
            }
        }
 public new void UpdateBaselineProgressFromFileTransferNotification(
     FileDistributionStatusArgs notification,
     ref TrainBaselineStatusExtendedData TrainBaselineStatusData)
 {
     base.UpdateBaselineProgressFromFileTransferNotification(notification, ref TrainBaselineStatusData);
 }