host_messages Module

This module contains the messages that are sent to the controller.

class AYABInterface.communication.host_messages.Message(file, communication, *args, **kw)[source]

Bases: object

This is the interface for sent messages.

MESSAGE_ID = None

the first byte to identify this message

__init__(file, communication, *args, **kw)[source]

Create a new Request object

__repr__()[source]

This message as string inclding the bytes.

Return type:str
__weakref__

list of weak references to the object (if defined)

as_bytes()[source]

The message represented as bytes.

Return type:bytes
content_bytes()[source]

The message content as bytes.

Return type:bytes
init()[source]

Override this method.

is_from_controller()[source]

Whether this message is sent by the controller.

Return type:bool
Returns:False
is_from_host()[source]

Whether this message is sent by the host.

Return type:bool
Returns:True
send()[source]

Send this message to the controller.

class AYABInterface.communication.host_messages.StartRequest(file, communication, *args, **kw)[source]

Bases: AYABInterface.communication.host_messages.Message

This is the start of the conversation.

MESSAGE_ID = 1

the first byte to identify this message

content_bytes()[source]

Return the start and stop needle.

Return type:bytes
init(left_end_needle, right_end_needle)[source]

Initialize the StartRequest with start and stop needle.

Raises:
left_end_needle

The needle to start knitting with.

Return type:int
Returns:value where 0 <= value <= 198
right_end_needle

The needle to start knitting with.

Return type:int
Returns:value where 1 <= value <= 199
class AYABInterface.communication.host_messages.LineConfirmation(file, communication, *args, **kw)[source]

Bases: AYABInterface.communication.host_messages.Message

This message send the data to configure a line.

MESSAGE_ID = 66

the first byte to identify this message

content_bytes()[source]

Return the start and stop needle.

init(line_number)[source]

Initialize the StartRequest with the line number.

class AYABInterface.communication.host_messages.InformationRequest(file, communication, *args, **kw)[source]

Bases: AYABInterface.communication.host_messages.Message

Start the initial handshake.

MESSAGE_ID = 3

the first byte to identify this message

class AYABInterface.communication.host_messages.TestRequest(file, communication, *args, **kw)[source]

Bases: AYABInterface.communication.host_messages.Message

Start the test mode of the controller.

MESSAGE_ID = 4

the first byte to identify this message