Data Types
Wire type definitions and the raw value encode/decode codec used by the
configuration parser and by ComApClient directly.
pycomap.datatypes.DataType
Bases: IntEnum
ComAp DataTypeIdentifier enum.
pycomap.datatypes.ProtectionState
Bases: IntFlag
ComAp ProtectionState enum (ValueState.Level1/Level2/SensorFail).
Delay, Active, and NotConfirmed are combinable: Active | NotConfirmed
(value 6) means the alarm is active but not yet acknowledged by the operator.
Source: ComAp.Controller.DataTypes.ProtectionState in ComAp.Controller.dll.
pycomap.datatypes.decode_raw_value
Decode raw bytes (len(raw) == _DATA_TYPE_LENGTH[data_type]) per data_type.
Only numeric and binary(bitfield) types are decoded to Python numbers; string/domain/ timer/date types are returned as raw bytes.
pycomap.datatypes.encode_raw_value
Encode value into the raw bytes decode_raw_value would decode it back from.
Only numeric and binary(bitfield) types can be encoded -- there's no encoder for
string/domain/timer/date types (write raw bytes directly via client.write_object
instead). The controller itself enforces the setpoint's min/max (returning
ControllerError.BAD_WRITE_VALUE on rejection), so this doesn't validate limits.
pycomap.datatypes.decode_fdate
Decode a 3-byte FDate payload [BCD(day), BCD(month), BCD(year-2000)].
Returns None for invalid/unset values (all 0xFF, or day byte == 0).
pycomap.datatypes.encode_fdate
Encode a datetime.date as a 3-byte FDate payload.
pycomap.datatypes.decode_ftime
Decode a 3-byte FTime payload [BCD(hour), BCD(minute), BCD(second)].
Returns None for invalid/unset values (hour byte ≥ 0x36 per source check).