Files
laatzen/Common/OmniPlus/Features/ChamberCalibrationResponse.cs
T

57 lines
1.8 KiB
C#

namespace OmniPlus.Features
{
using System;
public class ChamberCalibrationResponse : FeatureRequest
{
public const byte TEST_ACTIVATED = 0x00;
public const byte TEST_FAILED = 0x01;
public const byte TEST_COMPLETED = 0x02;
const int LENGTH = 7;
public ChamberCalibrationResponse() : base(LENGTH)
{
}
public ChamberCalibrationResponse(byte[] response) : base(response, LENGTH)
{
}
/// <summary>
/// 0 Test Activation Successful
/// 1 Test Failed (Timeout)
/// 2 Test Successfully Completed
/// </summary>
public byte Control
{
get => this.bytes[0];
set => this.bytes[0] = value;
}
/// <summary>
/// Response: Number of rotations collected
/// On Test Activation, this field echoes the number of rotations requested.
/// On Test Failed and Test Successfully Completed, returns the number of rotations collected.
/// </summary>
public ushort Rotations
{
get => BitConverter.ToUInt16(this.bytes, 1);
set => BitConverter.GetBytes(value).CopyTo(this.bytes, 1);
}
/// <summary>
/// Response: Total Time it took to collect the indicated rotations. Each count is equal to 30.5176us.
/// On Test Activation Successful, returns number of seconds test is allowed to take.
/// On Test Failed, this field will show 0 indicating that the tested failed.
/// </summary>
public uint Duration
{
get => BitConverter.ToUInt32(this.bytes, 3);
set => BitConverter.GetBytes(value).CopyTo(this.bytes, 3);
}
public double DurationSec => this.Duration * (1D / 32768);
}
}