1. Connector Interface

1.1. Interface Definition for Connectors, CChannels and Flasher

module:

connector

synopsis:

Interface for a channel

class pykiso.connector.CChannel(processing=False, **kwargs)[source]

Abstract class for coordination channel.

Constructor.

Parameters:

processing – deprecated, will not be taken into account.

abstract _cc_close()[source]

Close the channel.

Return type:

None

abstract _cc_open()[source]

Open the channel.

Return type:

None

abstract _cc_receive(timeout, **kwargs)[source]

How to receive something from the channel.

Parameters:
  • timeout (float) – Time to wait in second for a message to be received

  • kwargs – named arguments

Return type:

Dict[str, Optional[bytes]]

Returns:

dictionary containing the received bytes if successful, otherwise None

abstract _cc_send(msg, **kwargs)[source]

Sends the message on the channel.

Parameters:
  • msg (Union[Message, bytes, str]) – Message to send out

  • kwargs – named arguments

Return type:

None

cc_receive(timeout=0.1, *args, **kwargs)[source]

Read a thread-safe message on the channel and send an acknowledgement.

Parameters:
  • timeout (float) – time in second to wait for reading a message

  • kwargs – named arguments

Return type:

Dict[str, Optional[bytes]]

Returns:

the received message

cc_send(msg, *args, **kwargs)[source]

Send a thread-safe message on the channel and wait for an acknowledgement.

Parameters:
  • msg (Union[Message, bytes, str]) – message to send

  • kwargs – named arguments

Return type:

None

close()[source]

Close a thread-safe channel.

Return type:

None

open()[source]

Open a thread-safe channel.

Return type:

None

shutdown()[source]

Unitialize channel. Will be called at the end of the test session.

Return type:

None

class pykiso.connector.Connector(name=None)[source]

Abstract interface for all connectors to inherit from.

Defines hooks for opening and closing the connector and also defines a contextmanager interface.

Constructor.

Parameters:

name (str) – alias for the connector, used for repr and logging.

abstract close()[source]

Close the connector, freeing resources.

abstract open()[source]

Initialise the Connector.

class pykiso.connector.Flasher(binary=None, **kwargs)[source]

Interface for devices that can flash firmware on our targets.

Constructor.

Parameters:

binary (Union[str, Path]) – binary firmware file

Raises:
  • ValueError – if binary doesn’t exist or is not a file

  • TypeError – if given binary is None

abstract flash()[source]

Flash firmware on the target.