Configuration
Parsing of the controller's ConfigurationTable (C.O. 24575) and bulk decode
of ValuesAll / SetpointsAll blobs. The Controller calls
these internally — you only need them directly when working with raw blobs.
Descriptions
pycomap.configuration.ValueDescription
dataclass
ValueDescription(
number: int,
category: ValueCategory,
data_type: DataType,
data_length: int,
decimal_places: int,
data_index: int,
state_index: int | None,
name: str,
dimension: str,
group: str | None,
low_limit: int,
high_limit: int,
var_low_limit: bool,
var_high_limit: bool,
bit_name_index: int | None,
)
One entry from the controller's ConfigurationTable describing a single value.
pycomap.configuration.SetpointDescription
dataclass
pycomap.configuration.ValueState
dataclass
Protection state for one value, decoded from a ValueStatesAll byte.
Each field is a ProtectionState flag combination — check for activity with
state.level1 & ProtectionState.ACTIVE. NOT_CONFIRMED is a combinable flag:
ACTIVE | NOT_CONFIRMED (value 6) means the alarm is active but not yet
acknowledged by the operator pressing Fault Reset.
Source: ComAp.Controller.DataTypes.ValueState in ComAp.Controller.dll::
Level1 = bits 0-2, direct ProtectionState cast
Level2 = bits 3-5, direct ProtectionState cast
SensorFail = bits 6-7, left-shifted by 1 (raw 1 → ACTIVE, raw 2 → NOT_CONFIRMED)
Enums
pycomap.configuration.ValueCategory
Bases: IntEnum
ComAp ValueCategory enum.
FIRST/SECOND/THIRD are refresh-rate tiers (each with its own poll period, read
from the table); ONE_TIME values aren't included in ValuesAll/
ValueStatesAndDataAll at all.
pycomap.configuration.SetpointCategory
Bases: IntEnum
ComAp SetpointCategory enum. Unlike values, every setpoint is included in
SetpointsAll regardless of category, and setpoints have no associated state.
pycomap.configuration.NamesCategory
Bases: Enum
Subset of ComAp's NamesCategory enum -- only the categories needed to resolve a
value's name/dimension/group, alarm reason/prefix, and history reason/prefix are implemented.
Values are arbitrary (used only as a dict key into _NAMES_CATEGORY_LAYOUT), not
wire values.
Functions
pycomap.configuration.parse_configuration_table
Parse the value-description section of a raw ConfigurationTable blob.
pycomap.configuration.parse_names_heap
cached
Decode one category of the controller's "unified names heap" (first/default
language only). Returned list is indexed directly by a value record's name_index/
dim_index field.
pycomap.configuration.decode_values_all
Decode a ValuesAll (or the data portion of ValueStatesAndDataAll) blob.
Returns a mapping of value number -> decoded value for every
ValueCategory.FIRST/SECOND/THIRD value. ONE_TIME values are excluded
— they are not present in ValuesAll and must be read individually.
pycomap.configuration.decode_setpoints_all
Decode a SetpointsAll blob into a mapping of setpoint number -> decoded value.
Unlike values, every setpoint (both P and R categories) is included.
pycomap.configuration.decode_states_all
Decode a ValueStatesAll blob (or the state portion of ValueStatesAndDataAll).
Returns a mapping of value number -> ValueState for every value that has a
state_index (i.e. ValueDescription.state_index is not None). Values with no
state (state_index is None) are omitted.
For ValueStatesAndDataAll (C.O. 24529): the blob is the data region (size =
max data_index + data_length across non-OneTime values) followed immediately by
the state region — pass only the state suffix to this function, or slice it yourself:
data[data_region_size:].
pycomap.configuration.decode_history_snapshot
Decode the value snapshot from a HistoryRecord.data field.
Alarm/event history records carry a snapshot of the first N bytes of the
ValuesAll blob captured at the moment the event occurred. The layout is
identical to ValuesAll (each value at its data_index byte offset) but
truncated to len(snapshot) — values whose data would extend beyond the
snapshot are silently omitted.
Returns {number: decoded_value} for every value that fits, using the same
type/decimal-places decoding as
decode_values_all. ONE_TIME values
are never included. Returns an empty dict if snapshot is empty (text records).