/// <summary>
 /// Create from service model
 /// </summary>
 /// <param name="model"></param>
 public ReadValuesDetailsApiModel(ReadValuesDetailsModel model)
 {
     if (model == null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     StartTime    = model.StartTime;
     EndTime      = model.EndTime;
     NumValues    = model.NumValues;
     ReturnBounds = model.ReturnBounds;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create api model
 /// </summary>
 public static ReadValuesDetailsApiModel ToApiModel(
     this ReadValuesDetailsModel model)
 {
     if (model == null)
     {
         return(null);
     }
     return(new ReadValuesDetailsApiModel {
         EndTime = model.EndTime,
         StartTime = model.StartTime,
         NumValues = model.NumValues,
         ReturnBounds = model.ReturnBounds
     });
 }
Exemplo n.º 3
0
 /// <summary>
 /// Convert read raw modified details
 /// </summary>
 /// <param name="codec"></param>
 /// <param name="details"></param>
 /// <returns></returns>
 public static JToken Encode(this IVariantEncoder codec, ReadValuesDetailsModel details)
 {
     if (details == null)
     {
         throw new ArgumentNullException(nameof(details));
     }
     if (details.EndTime == null && details.StartTime == null)
     {
         throw new ArgumentException("Start time and end time cannot both be null", nameof(details));
     }
     if ((details.StartTime == null || details.EndTime == null) && ((details.NumValues ?? 0) == 0))
     {
         throw new ArgumentException("Value bound must be set", nameof(details.NumValues));
     }
     return(codec.Encode(new ExtensionObject(new ReadRawModifiedDetails {
         EndTime = details.EndTime ?? DateTime.MinValue,
         StartTime = details.StartTime ?? DateTime.MinValue,
         IsReadModified = false,
         ReturnBounds = details.ReturnBounds ?? false,
         NumValuesPerNode = details.NumValues ?? 0
     })));
 }