Package legume :: Module messages :: Class BaseMessage
[frames] | no frames]

Class BaseMessage

object --+
         |
        BaseMessage
Known Subclasses:


Data packets must inherit from this base class. A subclass must have a
static property called MessageTypeID set to a integer value to uniquely
identify the packet within a single PacketFactory.

Instance Methods
 
__init__(self, *values)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
get_header_format(self)
Returns the header format as a struct compatible string.
 
get_header_values(self)
Returns a list containing the values used to construct the packet header.
 
get_data_format(self)
Returns a struct compatible format string of the packet data
 
get_message_values(self)
Returns a list containing the header+packet values used...
 
get_message_format(self)
Returns a struct compatible format string of the message...
 
get_packet_bytes(self)
Returns a string containing the header and data.
 
set_message_values_to_defaults(self)
Override this method to assign default values.
 
read_from_byte_buffer(self, byteBuffer)
Reconstitute the packet from a ByteBuffer instance

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods
 
read_header_from_byte_buffer(byteBuffer)
Read a packet header from an instance of ByteBuffer.
Class Variables
  HEADER_FORMAT = 'B'
  MessageTypeID = None
  MessageValues = None
  UseDefaultValues = True
Properties

Inherited from object: __class__

Method Details

__init__(self, *values)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

get_message_values(self)

 

Returns a list containing the header+packet values used
to construct the packet

get_message_format(self)

 

Returns a struct compatible format string of the message
header and data

get_packet_bytes(self)

 

Returns a string containing the header and data. This
string can be passed to .loadFromString(...).

read_header_from_byte_buffer(byteBuffer)
Static Method

 

Read a packet header from an instance of ByteBuffer. This
method will return a tuple containing the header
values.