tslumd.messages
¶
-
class
tslumd.messages.
Display
(index: int, rh_tally: tslumd.common.TallyColor = <TallyColor.OFF: 0>, txt_tally: tslumd.common.TallyColor = <TallyColor.OFF: 0>, lh_tally: tslumd.common.TallyColor = <TallyColor.OFF: 0>, brightness: int = 3, text: str = '', control: bytes = b'', type: tslumd.common.MessageType = <MessageType.display: 1>)[source]¶ Bases:
object
A single tally “display”
-
rh_tally
: tslumd.common.TallyColor = 0¶ Right hand tally indicator
-
txt_tally
: tslumd.common.TallyColor = 0¶ Text tally indicator
-
lh_tally
: tslumd.common.TallyColor = 0¶ Left hand tally indicator
-
type
: tslumd.common.MessageType = 1¶ The message type. One of
display
orcontrol
.For
display
(the default), the message containstext
information and thecontrol
field must be empty.For
control
, the message containscontrol
data and thetext
field must be empty
New in version 0.0.2.
-
is_broadcast
: bool¶ True
if the display is to a “broadcast”, meaning sent to all display indices.(if the
index
is0xffff
)New in version 0.0.2.
-
classmethod
broadcast
(**kwargs) → tslumd.messages.Display[source]¶ Create a
broadcast
display(with
index
set to0xffff
)New in version 0.0.2.
-
classmethod
from_dmsg
(flags: tslumd.messages.Flags, dmsg: bytes) → Tuple[tslumd.messages.Display, bytes][source]¶ Construct an instance from a
DMSG
portion of received message.Any remaining message data after the relevant
DMSG
is returned along with the instance.
-
static
_unpack_control_data
(data: bytes) → bytes[source]¶ Unpack control data (if control bit 15 is set)
- Parameters
data – The portion of the
dmsg
at the start of the “Control Data” field- Returns
- remaining
The remaining message data after the control data field
- Return type
Note
This is undefined as of UMDv5.0 and its implementation is the author’s “best guess” based off of other areas of the protocol
New in version 0.0.2.
-
static
_pack_control_data
(data: bytes) → bytes[source]¶ Pack control data (if control bit 15 is set)
- Parameters
data – The control data to pack
- Returns
- packed
The packed control data
- Return type
Note
This is undefined as of UMDv5.0 and its implementation is the author’s “best guess” based off of other areas of the protocol
New in version 0.0.2.
-
to_dmsg
(flags: tslumd.messages.Flags) → bytes[source]¶ Build
dmsg
bytes to be included in a message (called fromMessage.build_message()
)
-
classmethod
from_tally
(tally: tslumd.tallyobj.Tally, msg_type: tslumd.common.MessageType = <MessageType.display: 1>) → tslumd.messages.Display[source]¶ Create a
Display
from the givenTally
New in version 0.0.2: The msg_type argument
-
-
class
tslumd.messages.
Message
(version: int = 0, flags: int = <Flags.NO_FLAGS: 0>, screen: int = 0, displays: List[tslumd.messages.Display] = <factory>, scontrol: bytes = b'', type: tslumd.common.MessageType = <MessageType.display: 1>)[source]¶ Bases:
object
A single UMDv5 message packet
-
displays
: List[tslumd.messages.Display]¶ A list of
Display
instances
-
type
: tslumd.common.MessageType = 1¶ The message type. One of
display
orcontrol
.For
display
(the default), the contents ofdisplays
are used and thescontrol
field must be empty.For
control
, thescontrol
field is used anddisplays
must be empty.
New in version 0.0.2.
-
is_broadcast
: bool¶ True
if the message is to be “broadcast” to all screens.(if
screen
is0xffff
)New in version 0.0.2.
-
classmethod
broadcast
(**kwargs) → tslumd.messages.Message[source]¶ Create a
broadcast
message(with
screen
set to0xffff
)New in version 0.0.2.
-
-
exception
tslumd.messages.
ParseError
(msg: str, value: bytes)[source]¶ Bases:
Exception
Raised on errors during message parsing
New in version 0.0.2.
-
exception
tslumd.messages.
MessageParseError
(msg: str, value: bytes)[source]¶ Bases:
tslumd.messages.ParseError
Raised on errors while parsing
Message
objectsNew in version 0.0.2.
-
exception
tslumd.messages.
DmsgParseError
(msg: str, value: bytes)[source]¶ Bases:
tslumd.messages.ParseError
Raised on errors while parsing
Display
objectsNew in version 0.0.2.
-
exception
tslumd.messages.
DmsgControlParseError
(msg: str, value: bytes)[source]¶ Bases:
tslumd.messages.ParseError
Raised on errors when parsing
Display.control
dataNew in version 0.0.2.