SELKIELogger  1.0.0
SELKIELogger.SLMessages.SLMessage Class Reference

Python representation of a logged message. More...

Collaboration diagram for SELKIELogger.SLMessages.SLMessage:

Public Member Functions

def __init__ (self, sourceID, channelID, data)
 Create message with specified source, channel and data. More...
 
def unpack (cl, data)
 Unpack raw messagepack bytes or list into SLMessage. More...
 
def pack (self)
 Return packed binary representation of message. More...
 
def __repr__ (self)
 Represent class as packed binary data. More...
 
def __str__ (self)
 

Public Attributes

 SourceID
 Message Source. More...
 
 ChannelID
 Message Channel. More...
 
 Data
 Message value / embedded data.
 

Static Private Attributes

list __slots__ = ["SourceID", "ChannelID", "Data"]
 Explicitly define members.
 

Detailed Description

Python representation of a logged message.

Represent messages stored by the Logger program and generated by devices with compatible firmware.

Messages are 4 element MessagePacked arrays, with the first element a constant 0x55, second and third elements identifying the source and message IDs and the final element containing the data for that message.

Definition at line 75 of file SLMessages.py.

Constructor & Destructor Documentation

◆ __init__()

def SELKIELogger.SLMessages.SLMessage.__init__ (   self,
  sourceID,
  channelID,
  data 
)

Create message with specified source, channel and data.

Note that the C library and utilities only support a limited range of types within these messages. Check the library documentation for details.

Parameters
sourceIDMessage Source
channelIDMessage Channel
dataMessage value / data
See also
library/base/sources.h

Definition at line 88 of file SLMessages.py.

Member Function Documentation

◆ __repr__()

def SELKIELogger.SLMessages.SLMessage.__repr__ (   self)

Represent class as packed binary data.

Todo:
Replace with standards compliant repr
Returns
Message, as bytes

Definition at line 143 of file SLMessages.py.

◆ __str__()

def SELKIELogger.SLMessages.SLMessage.__str__ (   self)
Returns
printable representation of message

Definition at line 151 of file SLMessages.py.

◆ pack()

def SELKIELogger.SLMessages.SLMessage.pack (   self)

Return packed binary representation of message.

Returns
Bytes representing message in messagepack form

Definition at line 136 of file SLMessages.py.

◆ unpack()

def SELKIELogger.SLMessages.SLMessage.unpack (   cl,
  data 
)

Unpack raw messagepack bytes or list into SLMessage.

If a list is provided, it's expected to correspond to each member of the raw array, i.e. [0x55, sourceID, channelID, data]

Parameters
clClass to be created (classmethod)
dataRaw bytes or a list of values.
Returns
New message instance

Definition at line 119 of file SLMessages.py.

Member Data Documentation

◆ ChannelID

SELKIELogger.SLMessages.SLMessage.ChannelID

Message Channel.

See also
Logger Channel IDs

Definition at line 114 of file SLMessages.py.

◆ SourceID

SELKIELogger.SLMessages.SLMessage.SourceID

Message Source.

See also
Logger Source IDs

Definition at line 112 of file SLMessages.py.


The documentation for this class was generated from the following file: