cache Module

Convert and cache needle positions.

class AYABInterface.communication.cache.NeedlePositionCache(get_needle_positions, machine)[source]

Bases: object

Convert and cache needle positions.

__init__(get_needle_positions, machine)[source]

Create a new NeedlePositions object.

__weakref__

list of weak references to the object (if defined)

get(line_number)[source]

Return the needle positions or None.

Parameters:line_number (int) – the number of the line
Return type:list
Returns:the needle positions for a specific line specified by line_number or None if no were given
get_bytes(line_number)[source]

Get the bytes representing needle positions or None.

Parameters:line_number (int) – the line number to take the bytes from
Return type:bytes
Returns:the bytes that represent the message or None if no data is there for the line.

Depending on the machine, the length and result may vary.

get_line_configuration_message(line_number)[source]

Return the cnfLine content without id for the line.

Parameters:line_number (int) – the number of the line
Return type:bytes
Returns:a cnfLine message without id as defined in The cnfLine Message
is_last(line_number)[source]

Whether the line number is has no further lines.

Return type:bool
Returns:is the next line above the line number are not specified