/// <summary>Sets mission real time information.</summary>
        /// <param name="missionCode">The mission code.</param>
        /// <param name="missionDelay">The mission delay.</param>
        /// <param name="missionWeather">The mission weather.</param>
        void IRTPISDataStore.SetMissionRealTimeInformation(string missionCode, RealTimeDelayType missionDelay, RealTimeWeatherType missionWeather)
        {
            bool dataUpdated = false;

            if (!string.IsNullOrEmpty(missionCode))
            {
                lock (_missionData)
                {
                    RealTimeInformationType update;
                    bool found = _missionData.TryGetValue(missionCode, out update);
                    if (!found)
                    {
                        update      = new RealTimeInformationType();
                        dataUpdated = true;
                    }

                    if (missionDelay != null)
                    {
                        update.MissionDelay            = missionDelay.Clone();
                        update.MissionDelay.UpdateDate = DateTime.Now;
                        dataUpdated = true;
                    }
                    else if (update.MissionDelay != null)
                    {
                        update.MissionDelay = null;
                        dataUpdated         = true;
                    }

                    if (missionWeather != null)
                    {
                        update.MissionWeather            = missionWeather.Clone();
                        update.MissionWeather.UpdateDate = DateTime.Now;
                        dataUpdated = true;
                    }
                    else if (update.MissionWeather != null)
                    {
                        update.MissionWeather = null;
                        dataUpdated           = true;
                    }

                    if (!found)
                    {
                        _missionData.Add(missionCode, update);
                    }

                    ///Call event
                    if (dataUpdated)
                    {
                        OnChanged(new RTPISDataStoreEventArgs(missionCode, null));
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// This function allows the GroundApp to set the Mission Real Time information for a mission.
        /// </summary>
        /// <param name="sessionId">Identifier for the session.</param>
        /// <param name="missionCode">The mission code.</param>
        /// <param name="missionDelay">The mission delay.</param>
        /// <param name="missionWeather">The mission weather.</param>
        /// <returns>Error code according to success or not of the request.</returns>
        RealTimeSetMissionRealTimeInformationResult IRealTimeService.SetMissionRealTimeInformation(Guid sessionId, string missionCode, RealTimeDelayType missionDelay, RealTimeWeatherType missionWeather)
        {
            var result = new RealTimeSetMissionRealTimeInformationResult();

            result.ResultCode = RealTimeServiceErrorEnum.ErrorInvalidSessionId;
            result.RequestId  = Guid.Empty;

            if (_sessionManager.IsSessionValid(sessionId))
            {
                if (!string.IsNullOrEmpty(missionCode))
                {
                    string error = _sessionManager.GenerateRequestID(sessionId, out result.RequestId);

                    if (string.IsNullOrEmpty(error))
                    {
                        RealTimeService._rtpisDataStore.SetMissionRealTimeInformation(missionCode, missionDelay, missionWeather);

                        if (missionDelay == null)
                        {
                            if (missionWeather == null)
                            {
                                result.ResultCode = RealTimeServiceErrorEnum.InfoNoData;
                            }
                            else
                            {
                                result.ResultCode = RealTimeServiceErrorEnum.InfoNoDelayData;
                            }
                        }
                        else if (missionWeather == null)
                        {
                            result.ResultCode = RealTimeServiceErrorEnum.InfoNoWeatherData;
                        }
                        else
                        {
                            result.ResultCode = RealTimeServiceErrorEnum.RequestAccepted;
                        }
                    }
                    else
                    {
                        result.ResultCode = RealTimeServiceErrorEnum.ErrorRequestIdGeneration;
                    }
                }
                else
                {
                    result.RequestId  = Guid.Empty;
                    result.ResultCode = RealTimeServiceErrorEnum.ErrorInvalidMissionCode;
                }
            }
            else
            {
                result.ResultCode = RealTimeServiceErrorEnum.ErrorInvalidSessionId;
            }

            return(result);
        }