/// <summary>Executes the message changed action.</summary> /// <param name="systemId">System id.</param> /// <param name="messageId">Identifier for the message.</param> /// <param name="lVersion">The software version information.</param> internal void OnMessageChanged(string systemId, string messageId, PisVersion pisVersion) { LogManager.WriteLog(TraceType.INFO, "OnMessageChanged called, systemId=" + systemId + ", messageId=" + messageId, "PIS.Ground.Core.T2G.LocalDataStorage.OnMessageChanged", null, EventIdEnum.GroundCore); lock (_systemListLock) { SystemInfo existingSystemInfo; if (_systemList.TryGetValue(systemId, out existingSystemInfo)) { // Update existing system // Add updated info SystemInfo updatedSystemInfo = new SystemInfo( existingSystemInfo.SystemId, existingSystemInfo.MissionId, existingSystemInfo.VehiclePhysicalId, existingSystemInfo.Status, existingSystemInfo.IsOnline, existingSystemInfo.CommunicationLink, existingSystemInfo.ServiceList, existingSystemInfo.PisBaseline, pisVersion, existingSystemInfo.PisMission, existingSystemInfo.IsPisBaselineUpToDate && existingSystemInfo.IsOnline); _systemList[systemId] = updatedSystemInfo; } } DumpCurrentSystemList(TraceType.DEBUG, "After OnMessageChanged called:", "PIS.Ground.Core.T2G.LocalDataStorage.OnMessageChanged"); }
/// <summary>Process Message Notification.</summary> /// <param name="systemId">system id.</param> /// <param name="messageId">message id.</param> /// <param name="fieldList">field list.</param> public void OnMessageNotification(string systemId, string messageId, fieldStruct[] fieldList) { lock (_lock) { if (!string.IsNullOrEmpty(systemId) && !string.IsNullOrEmpty(messageId) && fieldList != null && fieldList.Length != 0) { if (messageId == T2GDataConverter.PisBaseline) { PisBaseline baseline = T2GDataConverter.BuildPisBaseLine(fieldList); if (baseline != null) { _localDataStorage.OnMessageChanged(systemId, messageId, baseline); } } else if (messageId == T2GDataConverter.PisVersion) { PisVersion version = T2GDataConverter.BuildPisVersion(fieldList); if (version != null) { _localDataStorage.OnMessageChanged(systemId, messageId, version); } } else if (messageId == T2GDataConverter.PisMission || messageId == T2GDataConverter.SivngMission) { PisMission mission = T2GDataConverter.BuildPisMission(fieldList); if (mission != null) { _localDataStorage.OnMessageChanged(systemId, messageId, mission); } } ElementEventArgs elementEventArgs = _localDataStorage.BuildElementInfoChangedEvent(systemId); if (elementEventArgs != null) { _notifierTarget.RaiseOnElementInfoChangeEvent(elementEventArgs); } } } }
/// <summary>Build PisVersion.</summary> /// <param name="fieldList">FieldList for a message.</param> /// <returns>PisVersion object if it succeeds, null if it fails.</returns> internal static PisVersion BuildPisVersion(fieldStruct[] fieldList) { PisVersion version = null; if (fieldList != null && fieldList.Length > 0) { version = new PisVersion(); // CR: atvcm00614906 - [PIS-GROUND URBAN] Gap 2277: missing notification when mission code not defined in t2gvehicleinfo.xml // Must verify if all expected items are in the message... If not, we will log a trace. List <string> expectedItemsInMessage = new List <string>() { VersionPISSoftware }; foreach (fieldStruct lObjfieldStruct in fieldList) { if (VersionPISSoftware == lObjfieldStruct.id) { version.VersionPISSoftware = lObjfieldStruct.value; if (lObjfieldStruct.type != fieldTypeEnum.unknown) { expectedItemsInMessage.Remove(VersionPISSoftware); } continue; } } // CR: atvcm00614906 - [PIS-GROUND URBAN] Gap 2277: missing notification when mission code not defined in t2gvehicleinfo.xml // Log an error if the message did not contain all expected items. if (expectedItemsInMessage.Count > 0) { LogNotificationMessageItemMissingError(expectedItemsInMessage, T2GDataConverter.PisVersion); } } return(version); }
public static SystemInfo CreateSystem(string systemId, ushort vehicleId, bool isOnline, PisVersion version, PisBaseline baseline) { SystemInfo createdSystem = new SystemInfo(systemId, DefaultMissionName, vehicleId, DefaultStatus, isOnline, DefaultCommunicationLink, EmptyServiceList, baseline, version, DefaultMission, baseline.CurrentValidOut == Boolean.TrueString || baseline.FutureValidOut == Boolean.TrueString || baseline.ArchivedValidOut == Boolean.TrueString); return(createdSystem); }
public static SystemInfo CreateSystem(string systemId, ushort vehicleId, bool isOnline, PisVersion version) { return(CreateSystem(systemId, vehicleId, isOnline, version, DefaultBaseline)); }