/// <summary> /// Gets the parameter meta data. /// </summary> /// <param name="nodeKey">The node key.</param> /// <param name="metaKey">The meta key.</param> /// <returns></returns> public static string GetParameterMetaData(string nodeKey, string metaKey, string vechileType) { lock (_cache) { var ans = _cache.Get(nodeKey + metaKey + vechileType) as string; if (ans != null) { return(ans); } } if (vechileType == "PX4") { return(ParameterMetaDataRepositoryPX4.GetParameterMetaData(nodeKey, metaKey, vechileType)); } else { var answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, vechileType); if (answer == string.Empty) { answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, "SITL"); } if (answer == string.Empty) { answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, "AP_Periph"); } // add fallback if (answer == string.Empty) { answer = ParameterMetaDataRepositoryAPM.GetParameterMetaData(nodeKey, metaKey, vechileType); } if (answer == string.Empty) { return(String.Empty); } lock (_cache) { try { var ci = _cache.CreateEntry(nodeKey + metaKey + vechileType); ci.Value = answer; ci.Size = ((string)ci.Value).Length; // evict after no access ci.SlidingExpiration = TimeSpan.FromMinutes(5); ci.Dispose(); } catch { } } return(answer); } }
/// <summary> /// Gets the parameter meta data. /// </summary> /// <param name="nodeKey">The node key.</param> /// <param name="metaKey">The meta key.</param> /// <returns></returns> public static string GetParameterMetaData(string nodeKey, string metaKey, string vechileType) { if (vechileType == "PX4") { return(ParameterMetaDataRepositoryPX4.GetParameterMetaData(nodeKey, metaKey, vechileType)); } else { var answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, vechileType); if (answer == string.Empty) { answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, "SITL"); } if (answer == string.Empty) { answer = ParameterMetaDataRepositoryAPMpdef.GetParameterMetaData(nodeKey, metaKey, "AP_Periph"); } // return ParameterMetaDataRepositoryAPM.GetParameterMetaData(nodeKey, metaKey, vechileType); return(answer); } }