forked from nanoframework/nanoFramework.IoT.Device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInformation.cs
67 lines (58 loc) · 2.69 KB
/
Information.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Iot.Device.Vl53L0X
{
/// <summary>
/// Store the information regarding the sensor.
/// </summary>
public class Information
{
/// <summary>
/// Initializes a new instance of the <see cref="Information" /> class.
/// </summary>
/// <param name="moduleId">Module ID.</param>
/// <param name="revision">The revision number.</param>
/// <param name="productId">The product ID.</param>
/// <param name="signalRateMeasFixed1104_400_Micrometers">Raw measurement of the signal rate fixed point 400 micrometers.</param>
/// <param name="distMeasFixed1104_400_Micrometers">Raw measurement of the distance measurement fixed point 400 micrometers.</param>
public Information(byte moduleId, Version revision, string productId, uint signalRateMeasFixed1104_400_Micrometers, uint distMeasFixed1104_400_Micrometers)
{
ModuleId = moduleId;
Revision = revision;
ProductId = productId;
SignalRateMeasFixed1104_400_Micrometers = signalRateMeasFixed1104_400_Micrometers;
DistMeasFixed1104_400_Micrometers = distMeasFixed1104_400_Micrometers;
}
/// <summary>
/// Gets or sets Module ID.
/// </summary>
public byte ModuleId { get; set; }
/// <summary>
/// Gets or sets the revision number.
/// </summary>
public Version Revision { get; set; }
/// <summary>
/// Gets or sets the product ID.
/// </summary>
public string ProductId { get; set; }
/// <summary>
/// Gets or sets raw measurement of the signal rate fixed point 400 micrometers.
/// </summary>
private uint SignalRateMeasFixed1104_400_Micrometers { get; set; }
/// <summary>
/// Gets or sets raw measurement of the distance measurement fixed point 400 micrometers.
/// </summary>
private uint DistMeasFixed1104_400_Micrometers { get; set; }
/// <summary>
/// Gets the offset in micrometers
/// Formula from the official API.
/// </summary>
public int OffsetMicrometers => SignalRateMeasFixed1104_400_Micrometers != 0 ? ((((int)SignalRateMeasFixed1104_400_Micrometers - ((400 << 4) * 1000)) >> 4) * -1) : 0;
/// <summary>
/// Gets the signal rate measurement fixed point 400 micrometers
/// Formula from the official API.
/// </summary>
public uint SignalRateMeasuementFixed400Micrometers => SignalRateMeasFixed1104_400_Micrometers << 9;
}
}