mltk.utils.jlink_stream.JLinkDataStream¶
- class JLinkDataStream[source]¶
JLink data stream
Properties
Return a hexdump string
The amount of the device data buffer that is available
The amount of the device data buffer used
The absolute time in seconds to timeout reading or writing
If the stream is opened to the device
The maximum amount of data to read
The mode the for which the stream was opened, r or w
The name of the opened stream
The amount of data that is ready to be read by the python script
The maximum about of time in seconds to read or write data.
The amount of data that can immediately be written
Methods
Close the data stream with the device
Wait while any pending data is transferred to/from the device
Read data from data stream opened for reading
The the specified amount of data
Write data to a data stream opened for writing
- __init__(name, mode, ifc, stream_context)[source]¶
- Parameters:
name (str) –
mode (str) –
ifc (DeviceInterface) –
stream_context (dict) –
- property name: str¶
The name of the opened stream
- Return type:
str
- property mode: str¶
The mode the for which the stream was opened, r or w
- Return type:
str
- property is_opened: bool¶
If the stream is opened to the device
- Return type:
bool
- property max_read_size: int¶
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
- property timeout: float¶
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
- property end_time: 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
- property buffer_used: int¶
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
- property buffer_unused: int¶
The amount of the device data buffer that is available
- Return type:
int
- property read_data_available: int¶
The amount of data that is ready to be read by the python script
- Return type:
int
- property write_data_available: int¶
The amount of data that can immediately be written
- Return type:
int
- property buffer_hexdump: str¶
Return a hexdump string
- Return type:
str
- read(max_size=None, timeout=None)[source]¶
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 (int) –
timeout (float) –
- read_all(amount, timeout=None, initial_timeout=None, throw_exception=True)[source]¶
The the specified amount of data
- Return type:
bytes
- Parameters:
amount (int) –
timeout (float) –
initial_timeout (float) –