namespace RobotNet10.CANOpen.CiA402.Models; public readonly struct Controlword { public ushort Value { get; init; } public Controlword(ushort value) { Value = value; } public bool SwitchOn => (Value & 0x0001) != 0; public bool EnableVoltage => (Value & 0x0002) != 0; public bool QuickStop => (Value & 0x0004) != 0; public bool EnableOperation => (Value & 0x0008) != 0; public bool FaultReset => (Value & 0x0080) != 0; public bool Halt => (Value & 0x0100) != 0; public static Controlword Shutdown => new(0x0006); public static Controlword SwitchOnCmd => new(0x0007); public static Controlword DisableVoltage => new(0x0000); public static Controlword QuickStopCmd => new(0x0002); public static Controlword DisableOperation => new(0x0007); public static Controlword EnableOperationCmd => new(0x000F); public static Controlword FaultResetCmd => new(0x0080); public override string ToString() => $"0x{Value:X4}"; public static implicit operator ushort(Controlword cw) => cw.Value; public static implicit operator Controlword(ushort value) => new(value); }