pyecsca.sca.target.serial module

Provides an abstract serial target, that communicates by writing and reading a stream of bytes.

class SerialTarget[source]

Bases: Target

Serial target.

abstract write(data)[source]

Write the data bytes to the target’s serial input.

Parameters:

data (bytes) – The data to write.

Return type:

None

abstract read(num=0, timeout=0)[source]

Read upto num bytes or until timeout milliseconds from the target’s serial output.

Parameters:
  • num (int) – The number of bytes to read, 0 for all available.

  • timeout (int) – The timeout in milliseconds.

Return type:

bytes

Returns:

The bytes read.

abstract connect()[source]

Connect to the target device.

abstract disconnect()[source]

Disconnect from the target device.