jmri_core.beans.loco_cv_state
LocoCvState — per-locomotive CV state.
JMRI stores decoder CV values per locomotive, typically inside the
<values> block of roster/<id>.xml or (in some installs) as a
separate file at rosters/<id>.xml. Either way, the conceptual
model is one decoder's CVs as a map keyed by CV number.
We model the standalone file (rosters/<id>.xml) and let
~jmri_server.loco_cv_store.LocoCvStore lazy-load it when the
programmer page opens for a specific loco. The roster page itself
doesn't read this file — that lazy load is the point.
1"""``LocoCvState`` — per-locomotive CV state. 2 3JMRI stores decoder CV values per locomotive, typically inside the 4``<values>`` block of ``roster/<id>.xml`` or (in some installs) as a 5separate file at ``rosters/<id>.xml``. Either way, the conceptual 6model is *one decoder's CVs as a map keyed by CV number*. 7 8We model the standalone file (``rosters/<id>.xml``) and let 9:class:`~jmri_server.loco_cv_store.LocoCvStore` lazy-load it when the 10programmer page opens for a specific loco. The roster page itself 11doesn't read this file — that lazy load is the point. 12""" 13from __future__ import annotations 14 15from pydantic import BaseModel, ConfigDict, Field 16 17 18class LocoCvState(BaseModel): 19 """Decoder CV state for one locomotive. 20 21 Keys are CV names (strings, because JMRI uses ``"17.18"`` notation 22 for split CVs and similar non-integer cases). Values are byte 23 integers 0..255. 24 """ 25 26 model_config = ConfigDict(populate_by_name=True) 27 28 loco_id: str 29 cv_values: dict[str, int] = Field(default_factory=dict)
class
LocoCvState(pydantic.main.BaseModel):
19class LocoCvState(BaseModel): 20 """Decoder CV state for one locomotive. 21 22 Keys are CV names (strings, because JMRI uses ``"17.18"`` notation 23 for split CVs and similar non-integer cases). Values are byte 24 integers 0..255. 25 """ 26 27 model_config = ConfigDict(populate_by_name=True) 28 29 loco_id: str 30 cv_values: dict[str, int] = Field(default_factory=dict)
Decoder CV state for one locomotive.
Keys are CV names (strings, because JMRI uses "17.18" notation
for split CVs and similar non-integer cases). Values are byte
integers 0..255.