pyebus.msgdefs module

Message Defintions.

class pyebus.msgdefs.Pattern(circuit, name, setprio, fieldname)[source]

Bases: Pattern

Message Definition and Field Definition Search Pattern.

Create new instance of Pattern(circuit, name, setprio, fieldname)

static from_str(pattern)[source]

Create Pattern from pattern string.

class pyebus.msgdefs.MsgDefs[source]

Bases: object

Message Definitions Container.

>>> from .msgdef import MsgDef, FieldDef
>>> from .types import Type
>>> msgdefs = MsgDefs()
>>> msgdefs.add(MsgDef('mc', 'Status0a', (
...     FieldDef(0, 'temp', Type(), '°C'),
...     FieldDef(1, 'mixer', Type(), None),
...     FieldDef(2, 'onoff-0', Type(), None),
...     FieldDef(3, 'onoff-1', Type(), None),
...     FieldDef(4, 'temp0', Type(), '°C'),
... ), read=True))
>>> msgdefs.add(MsgDef('hc', 'Status0', (
...     FieldDef(0, 'temp', Type(), '°C'),
...     FieldDef(1, 'temp0', Type(), '°C'),
... ), read=True))
>>> msgdefs.get('mc', 'Status0a')
MsgDef('mc', 'Status0a', (FieldDef(0, 'temp', ...'°C'), FieldDef(1, 'mixer', ..., unit='°C')), read=True)
>>> list(msgdefs)
[MsgDef('mc', 'Status0a', (FieldDef(0, 'temp', ...'°C'), FieldDef(1, 'mixer', ..., unit='°C')), read=True)]
>>> msgdefs.summary()
'2 messages (2 read, 0 update, 0 write) with 7 fields'
clear()[source]

Remove All Stored Message Definitions.

add(msgdef)[source]

Add Message Definition.

get(circuit, name)[source]

Get message with circuit and name.

Returns

MsgDef: Message Definition

get_ident(ident)[source]

Get message with ident.

Returns

MsgDef: Message Definition

find(circuit, name='*')[source]

Find all message definitions matching circuit and name, wildcards and placeholder are accepted.

Returns:

Message Definitions

Return type:

MsgDefs

resolve(patterns, filter_=None)[source]

Resolve patterns and filter message definitions.

Returns:

Message Definitions

Return type:

MsgDefs

set_defaultprio(defaultprio)[source]

Set Priorities of all messages without a priority value.

summary()[source]

Summary.

Returns:

Summary.

Return type:

str