dmcomm.protocol.digirom

Handling of DigiROM formats.

Note: This API is still under development and may change at any time.

class dmcomm.protocol.digirom.Result(signal_type)

Describes the result of the communication.

append(segment)
__str__()

Returns text formatted for the serial protocol.

class dmcomm.protocol.digirom.ResultView(result, turn)

Describes the result of one side of the communication.

Parameters
  • result – The Result to view.

  • turn – 1 for the side who went first, 2 for the side who went second.

class dmcomm.protocol.digirom.BaseResultSegment(sent: bool, data)

Describes the result of one segment of the communication.

Parameters
  • sent – True if this represents data sent, False if data received.

  • data – The data sent or received. If sent is False, can be null_value to indicate nothing was received before timeout.

null_value = None

Subclasses can override.

str_data()
__str__()

Returns text formatted for the serial protocol.

class dmcomm.protocol.digirom.BaseDigiROM(signal_type: str, turn: int, segments=None, text_segments=None)

Base class for describing the communication and recording the results.

Caller should provide segments or text_segments or neither, but not both.

command_segment_class = None

Subclasses must override.

result_segment_class = None

Subclasses must override.

append(c)
prepare()
_pre_send(segment)
send()
receive(data)
class dmcomm.protocol.digirom.ClassicCommandSegment(bits, copy_mask=0, invert_mask=0, checksum_target=None, check_digit_LSB_pos=12)

Describes how to carry out one segment of the communication for 16-bit protocols.

classmethod from_string(text)

Creates a ClassicCommandSegment from one of the dash-separated parts of a text command.

class dmcomm.protocol.digirom.ClassicResultSegment(sent: bool, data)

Describes the result of one segment of the communication for 16-bit protocols.

str_data()
class dmcomm.protocol.digirom.ClassicDigiROM(signal_type: str, turn: int, segments=None, text_segments=None)

Describes the communication for 16-bit protocols and records the results.

command_segment_class

alias of dmcomm.protocol.digirom.ClassicCommandSegment

result_segment_class

alias of dmcomm.protocol.digirom.ClassicResultSegment

prepare()
_pre_send(c)
class dmcomm.protocol.digirom.DigitsCommandSegment(data)

Describes how to carry out one segment of the communication for digit-sequence protocols.

classmethod from_string(text)

Creates a DigitsCommandSegment from one of the dash-separated parts of a text command.

class dmcomm.protocol.digirom.DigitsResultSegment(sent: bool, data)

Describes the result of one segment of the communication for digit-sequence protocols.

null_value = []

Subclasses can override.

str_data()
class dmcomm.protocol.digirom.DigitsDigiROM(signal_type: str, turn: int, segments=None, text_segments=None)

Describes the communication for digit-sequence protocols and records the results.

command_segment_class

alias of dmcomm.protocol.digirom.DigitsCommandSegment

result_segment_class

alias of dmcomm.protocol.digirom.DigitsResultSegment

class dmcomm.protocol.digirom.BytesCommandSegment(data)

Describes how to carry out one segment of the communication for byte-sequence protocols.

classmethod from_string(text)

Creates a BytesCommandSegment from one of the dash-separated parts of a text command.

class dmcomm.protocol.digirom.BytesResultSegment(sent: bool, data)

Describes the result of one segment of the communication for byte-sequence protocols.

null_value = []

Subclasses can override.

str_data()
class dmcomm.protocol.digirom.BytesDigiROM(signal_type: str, turn: int, segments=None, text_segments=None)

Describes the communication for byte-sequence protocols and records the results.

command_segment_class

alias of dmcomm.protocol.digirom.BytesCommandSegment

result_segment_class

alias of dmcomm.protocol.digirom.BytesResultSegment

_pre_send(segment)
class dmcomm.protocol.digirom.WordsCommandSegment(data)

Describes how to carry out one segment of the communication for word-sequence protocols.

classmethod from_string(text)

Creates a WordsCommandSegment from one of the dash-separated parts of a text command.

class dmcomm.protocol.digirom.WordsResultSegment(sent: bool, data)

Describes the result of one segment of the communication for word-sequence protocols.

null_value = []

Subclasses can override.

str_data()
class dmcomm.protocol.digirom.WordsDigiROM(signal_type: str, turn: int, segments=None, text_segments=None)

Describes the communication for word-sequence protocols and records the results.

command_segment_class

alias of dmcomm.protocol.digirom.WordsCommandSegment

result_segment_class

alias of dmcomm.protocol.digirom.WordsResultSegment

_pre_send(segment)

Generated from git commit: 2023-05-06 v0.7.0