Wire Codec¶
polestar_api.wire ¶
ProtoMessage base class — frozen dataclasses with automatic protobuf serialization.
Wire types are inferred from Python type hints
float → double int → int64 (varint) str → string bool → bool bytes → bytes IntEnum → enum (varint) ProtoMessage → nested message (length-delimited) X | None → optional (unwraps to X)
Float32 ¶
Marker for 32-bit float fields (protobuf 'float' vs 'double').
ProtoMessage ¶
Mixin that adds protobuf encode/decode to a frozen dataclass.
Usage::
@dataclass(frozen=True)
class Battery(ProtoMessage, schema={2: "charge_level", 4: "range_km"}):
charge_level: float = 0.0
range_km: float = 0.0