JLinkDataStream

JLink data stream

Properties

buffer_hexdump

Return a hexdump string

buffer_unused

The amount of the device data buffer that is available

buffer_used

The amount of the device data buffer used

end_time

The absolute time in seconds to timeout reading or writing

is_opened

If the stream is opened to the device

max_read_size

The maximum amount of data to read

mode

The mode the for which the stream was opened, r or w

name

The name of the opened stream

read_data_available

The amount of data that is ready to be read by the python script

timeout

The maximum about of time in seconds to read or write data.

write_data_available

The amount of data that can immediately be written

Methods

__init__

close

Close the data stream with the device

flush

Wait while any pending data is transferred to/from the device

read

Read data from data stream opened for reading

read_all

The the specified amount of data

write

Write data to a data stream opened for writing

Parameters:
  • name (str) –

  • mode (str) –

  • ifc (DeviceInterface) –

  • stream_context (dict) –

The name of the opened stream

Return type:

str

The mode the for which the stream was opened, r or w

Return type:

str

If the stream is opened to the device

Return type:

bool

The maximum amount of data to read

Set to -1 to disable limit After each read, this value will decrement by the amount of data read. One this value reaches zero, it must be reset otherwise subsequent reads will always return zero.

Return type:

int

The maximum about of time in seconds to read or write data. This is only used if the ‘timeout’ argument to the read() or write() APIs is None Set to -1 to never timeout

Return type:

float

The absolute time in seconds to timeout reading or writing

Set to None to disable. If end_time > time.time(), then return from the read() or write() API

Return type:

float

The amount of the device data buffer used

If the stream was opened for reading then this is the amount of data that was previous received from the device and is waiting to be read by the python script.

If the stream was opened for writing, then this is the amount of data that was previously written and is pending to be sent to the device.

Return type:

int

The amount of the device data buffer that is available

Return type:

int

The amount of data that is ready to be read by the python script

Return type:

int

The amount of data that can immediately be written

Return type:

int

Return a hexdump string

Return type:

str

Close the data stream with the device

Read data from data stream opened for reading

NOTE: The only returns the data that is immediately available. The amount of data returned may be less than max_size.

Return type:

bytes

Parameters:
  • max_size (Optional[int]) –

  • timeout (Optional[float]) –

The the specified amount of data

Return type:

bytes

Parameters:
  • amount (int) –

  • timeout (Optional[float]) –

  • initial_timeout (Optional[float]) –

Write data to a data stream opened for writing

Return type:

int

Parameters:
  • data (bytes) –

  • timeout (Optional[float]) –

Wait while any pending data is transferred to/from the device

Parameters:

timeout (Optional[float]) –