forked from nanoframework/nanoFramework.IoT.Device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBme680HeaterProfileConfig.cs
57 lines (51 loc) · 2.19 KB
/
Bme680HeaterProfileConfig.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using UnitsNet;
namespace Iot.Device.Bmxx80
{
/// <summary>
/// The heater profile configuration saved on the device.
/// </summary>
public class Bme680HeaterProfileConfig
{
/// <summary>
/// Gets or sets chosen heater profile slot, ranging from 0-9.
/// </summary>
public Bme680HeaterProfile HeaterProfile { get; set; }
/// <summary>
/// Gets or sets heater resistance.
/// </summary>
public ushort HeaterResistance { get; set; }
/// <summary>
/// Gets or sets heater duration.
/// </summary>
public Duration HeaterDuration { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Bme680HeaterProfileConfig" /> class.
/// </summary>
/// <param name="profile">The used heater profile.</param>
/// <param name="heaterResistance">The heater resistance in Ohm.</param>
/// <param name="heaterDuration">The heating duration.</param>
/// <exception cref="ArgumentOutOfRangeException">Unknown profile setting used.</exception>
public Bme680HeaterProfileConfig(Bme680HeaterProfile profile, ushort heaterResistance, Duration heaterDuration)
{
if ((profile != Bme680HeaterProfile.Profile1) &&
(profile != Bme680HeaterProfile.Profile2) &&
(profile != Bme680HeaterProfile.Profile3) &&
(profile != Bme680HeaterProfile.Profile4) &&
(profile != Bme680HeaterProfile.Profile5) &&
(profile != Bme680HeaterProfile.Profile6) &&
(profile != Bme680HeaterProfile.Profile7) &&
(profile != Bme680HeaterProfile.Profile8) &&
(profile != Bme680HeaterProfile.Profile9) &&
(profile != Bme680HeaterProfile.Profile10))
{
throw new ArgumentOutOfRangeException();
}
HeaterProfile = profile;
HeaterResistance = heaterResistance;
HeaterDuration = heaterDuration;
}
}
}