Add protocolCommons classes and enhance RadioService with support for CalibrationFactor, VersionType, ReadingUnits, and FlipMode operations. Add corresponding unit tests for validation. Update project files.
224 lines
7.2 KiB
C#
224 lines
7.2 KiB
C#
using TBF.Rig.TestMethods.iPerlCommunication.communication.C4.diagnosticLed;
|
||
|
||
namespace TBF.Rig.TestMethods.iPerlCommunication.communication.C4.protocolCommons
|
||
{
|
||
/// <summary>
|
||
/// Device-specific TouchRead sub-commands.
|
||
/// These sub-commands are used together with the
|
||
/// <see cref="TouchReadCommand.DeviceSpecific"/> (0xFD) command.
|
||
/// </summary>
|
||
public enum ProtocolDeviceSubCommand : byte
|
||
{
|
||
// ==========================================================
|
||
// System / Time
|
||
// ==========================================================
|
||
|
||
/// <summary>
|
||
/// View system time.
|
||
/// Returns uint32 seconds since 2000-01-01 00:00:00.
|
||
/// </summary>
|
||
ViewSystemTime = 0x10,
|
||
|
||
/// <summary>
|
||
/// Set system time.
|
||
/// Payload: uint32 seconds since 2000-01-01.
|
||
/// If set to zero, the meter resets and erases data.
|
||
/// Protected by meter seal.
|
||
/// </summary>
|
||
SetSystemTime = 0x11,
|
||
|
||
// ==========================================================
|
||
// Alarm Mask / Alarm Configuration
|
||
// ==========================================================
|
||
|
||
/// <summary>View alarm mask (lower 16 bits).</summary>
|
||
ViewAlarmMask = 0x31,
|
||
|
||
/// <summary>Set alarm mask (lower 16 bits).</summary>
|
||
SetAlarmMask = 0x32,
|
||
|
||
/// <summary>View alarm persistence period (days).</summary>
|
||
ViewPersistence = 0x33,
|
||
|
||
/// <summary>Set alarm persistence period (days).</summary>
|
||
SetPersistence = 0x34,
|
||
|
||
/// <summary>View leak duration (hours).</summary>
|
||
ViewLeakDuration = 0x35,
|
||
|
||
/// <summary>Set leak duration (hours).</summary>
|
||
SetLeakDuration = 0x36,
|
||
|
||
/// <summary>View current alarm states.</summary>
|
||
ViewAlarms = 0x37,
|
||
|
||
/// <summary>Set alarm states (protected by meter seal).</summary>
|
||
SetAlarms = 0x38,
|
||
|
||
// ==========================================================
|
||
// Manufacture / Counters
|
||
// ==========================================================
|
||
|
||
/// <summary>View manufacture date.</summary>
|
||
ViewManufactureDate = 0x39,
|
||
|
||
/// <summary>Set manufacture date (protected by meter seal).</summary>
|
||
SetManufactureDate = 0x3A,
|
||
|
||
/// <summary>View seconds idle.</summary>
|
||
ViewSecondsIdle = 0x3B,
|
||
|
||
/// <summary>View seconds active.</summary>
|
||
ViewSecondsActive = 0x3D,
|
||
|
||
/// <summary>View seconds used.</summary>
|
||
ViewSecondsUsed = 0x3F,
|
||
|
||
// ==========================================================
|
||
// Snapshot / Datalog
|
||
// ==========================================================
|
||
|
||
/// <summary>View snapshot data.</summary>
|
||
ViewSnapshotData = 0x41,
|
||
|
||
/// <summary>View datalog duration.</summary>
|
||
ViewDatalogDuration = 0x43,
|
||
|
||
/// <summary>Set datalog duration.</summary>
|
||
SetDatalogDuration = 0x44,
|
||
|
||
/// <summary>Read datalog.</summary>
|
||
ReadDatalog = 0x45,
|
||
|
||
/// <summary>Clear datalog.</summary>
|
||
ClearDatalog = 0x46,
|
||
|
||
// ==========================================================
|
||
// History
|
||
// ==========================================================
|
||
|
||
/// <summary>View history mask.</summary>
|
||
ViewHistoryMask = 0x47,
|
||
|
||
/// <summary>Set history mask.</summary>
|
||
SetHistoryMask = 0x48,
|
||
|
||
/// <summary>Read history.</summary>
|
||
ReadHistory = 0x49,
|
||
|
||
/// <summary>Clear history.</summary>
|
||
ClearHistory = 0x4A,
|
||
|
||
// ==========================================================
|
||
// Diagnostics / Status
|
||
// ==========================================================
|
||
|
||
/// <summary>View diagnostics.</summary>
|
||
ViewDiagnostics = 0x4B,
|
||
|
||
/// <summary>Reset diagnostics.</summary>
|
||
ResetDiagnostics = 0x4C,
|
||
|
||
/// <summary>View status file.</summary>
|
||
ViewStatusFile = 0x4F,
|
||
|
||
/// <summary>Set status file (protected by meter seal).</summary>
|
||
SetStatusFile = 0x50,
|
||
|
||
// ==========================================================
|
||
// Calibration / Configuration
|
||
// ==========================================================
|
||
|
||
/// <summary>View calibration structure.</summary>
|
||
ViewCalibrationStructure = 0x51,
|
||
|
||
/// <summary>Set calibration structure (protected by meter seal).</summary>
|
||
SetCalibrationStructure = 0x52,
|
||
|
||
/// <summary>
|
||
/// View calibration factor.
|
||
/// Response payload: uint16 little-endian calibration factor.
|
||
/// Nominal value 4096 represents 100.0 %.
|
||
/// </summary>
|
||
ViewCalibration = 0x53,
|
||
|
||
/// <summary>
|
||
/// Set calibration factor.
|
||
/// Payload: uint16 little-endian calibration factor.
|
||
/// Protected by meter seal.
|
||
/// </summary>
|
||
SetCalibration = 0x54,
|
||
|
||
/// <summary>View reboot count.</summary>
|
||
ViewRebootCount = 0x55,
|
||
|
||
/// <summary>Set reboot count (protected by meter seal).</summary>
|
||
SetRebootCount = 0x56,
|
||
|
||
/// <summary>View temperature.</summary>
|
||
ViewTemperature = 0x57,
|
||
|
||
/// <summary>Set temperature (protected by meter seal).</summary>
|
||
SetTemperature = 0x58,
|
||
|
||
// ==========================================================
|
||
// Flip mode
|
||
// ==========================================================
|
||
|
||
/// <summary>
|
||
/// View randomized field flip-rate mode.
|
||
/// Response payload:
|
||
/// 0x00 = randomized flip rate disabled,
|
||
/// 0x01 = randomized flip rate enabled.
|
||
/// </summary>
|
||
ViewFlipMode = 0xB9,
|
||
|
||
// ==========================================================
|
||
// Diagnostic LED / Hardware
|
||
// ==========================================================
|
||
|
||
/// <summary>
|
||
/// Set diagnostic LED state.
|
||
/// Enables or disables high-speed LED serial output.
|
||
/// <para>
|
||
/// See <see cref="DiagnosticLedState"/>
|
||
/// diagnostic LED output modes.
|
||
/// </para>
|
||
/// </summary>
|
||
SetDiagnosticLEDState = 0x60,
|
||
|
||
|
||
// ==========================================================
|
||
// Build / Firmware Info
|
||
// ==========================================================
|
||
|
||
/// <summary>View iPERL build information.</summary>
|
||
ViewIPerlBuild = 0x65,
|
||
|
||
/// <summary>Set iPERL build (protected by meter seal).</summary>
|
||
SetIPerlBuild = 0x66,
|
||
|
||
// ==========================================================
|
||
// Bootloader (DANGEROUS – use with care)
|
||
// ==========================================================
|
||
|
||
/// <summary>Enter bootloader mode.</summary>
|
||
EnterBootloader = 0x81,
|
||
|
||
/// <summary>Read FLASH memory.</summary>
|
||
ReadFlash = 0x82,
|
||
|
||
/// <summary>Erase all FLASH memory.</summary>
|
||
EraseAll = 0x83,
|
||
|
||
/// <summary>Erase FLASH segment.</summary>
|
||
EraseSegment = 0x84,
|
||
|
||
/// <summary>Update firmware code.</summary>
|
||
UpdateCode = 0x85,
|
||
|
||
/// <summary>Exit bootloader mode.</summary>
|
||
ExitBootloader = 0x86
|
||
}
|
||
}
|