4.8.0.0R6
Software Development Kit
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
Streams

Functions

void ltrx_input_stream_close (struct input_stream *inStream)
 Closes the input stream. More...
 
bool ltrx_input_stream_init_from_binary (struct input_stream_from_binary *inStream, const void *data, size_t length)
 Construct input stream from binary. More...
 
bool ltrx_input_stream_init_from_const_char (struct input_stream_from_const_char *inStream, const char *data)
 Construct input stream from const char. More...
 
bool ltrx_input_stream_init_from_routine (struct input_stream_from_routine *concreteInStream, const char *thread_name, uint32_t stack_size, void(*routine)(struct output_stream *os, void *opaque), void *opaque)
 Construct input stream from routine. More...
 
int ltrx_input_stream_peek (struct input_stream *inStream)
 Non-blocking peek. More...
 
int ltrx_input_stream_peek_with_block_time (struct input_stream *inStream, uint32_t blockTimeMsec)
 Blocking peek. More...
 
int ltrx_input_stream_read (struct input_stream *inStream)
 Blocking read from an input stream. More...
 
bool ltrx_output_stream_close (struct output_stream *outStream)
 Closes the output stream. More...
 
bool ltrx_output_stream_flush_data (struct output_stream *outStream)
 Forces any buffered data to be actually output. More...
 
bool ltrx_output_stream_from_input_stream (struct output_stream *outStream, struct input_stream *inStream)
 Writes output stream till disconnected, and closes input. More...
 
bool ltrx_output_stream_write_binary (struct output_stream *outStream, const void *data, size_t length)
 Writes binary data. More...
 
bool ltrx_output_stream_write_hexadecimal (struct output_stream *outStream, uint32_t value)
 Writes unsigned value as ASCII hexadecimal. More...
 
bool ltrx_output_stream_write_line (struct output_stream *outStream, const char *data)
 Writes data ending with newline. More...
 
bool ltrx_output_stream_write_unsigned (struct output_stream *outStream, uint32_t value)
 Writes unsigned value as ASCII decimal. More...
 
bool ltrx_output_stream_write_without_ending_line (struct output_stream *outStream, const char *data)
 Writes data without any newline. More...
 

Detailed Description

Streams provide a method to input or output single characters at a time independent of the device or construct they are connected to.

Function Documentation

void ltrx_input_stream_close ( struct input_stream inStream)

Closes the input stream.

Parameters
[in,out]inStreamThe abstract input stream.
bool ltrx_input_stream_init_from_binary ( struct input_stream_from_binary *  inStream,
const void *  data,
size_t  length 
)

Construct input stream from binary.

Return values
trueSuccess.
falseFailed.
Parameters
[out]inStreamThe concrete input stream from binary struct.
[in]dataThe const data that will feed the stream.
[in]lengthThe number of bytes of data that will feed the stream.
bool ltrx_input_stream_init_from_const_char ( struct input_stream_from_const_char *  inStream,
const char *  data 
)

Construct input stream from const char.

Return values
trueSuccess.
falseFailed.
Parameters
[out]inStreamThe concrete input stream from const char struct.
[in]dataThe zero-terminated const data that will feed the stream.
bool ltrx_input_stream_init_from_routine ( struct input_stream_from_routine concreteInStream,
const char *  thread_name,
uint32_t  stack_size,
void(*)(struct output_stream *os, void *opaque)  routine,
void *  opaque 
)

Construct input stream from routine.

Return values
trueSuccess.
falseFailed.
Parameters
[out]concreteInStreamThe concrete input stream from routine struct.
[in]thread_nameName of the thread.
[in]stack_sizeThread stack size in bytes.
[in]routineThe routine to run in the thread.
[in]opaqueAny data needed by the routine.
int ltrx_input_stream_peek ( struct input_stream inStream)

Non-blocking peek.

Note that any character you see will remain in the stream until you later read it.

Returns
Next character on inStream.
Return values
-1Waiting.
-2Disconnected.
Parameters
[in]inStreamThe abstract input stream.
int ltrx_input_stream_peek_with_block_time ( struct input_stream inStream,
uint32_t  blockTimeMsec 
)

Blocking peek.

Note that any character you see will remain in the stream until you later read it.

Returns
Next character on inStream.
Return values
-1Waiting.
-2Disconnected.
Parameters
[in]inStreamThe abstract input stream.
[in]blockTimeMsecHow long to wait if no character is available. To wait indefinitely, use TIME_WAIT_FOREVER.
int ltrx_input_stream_read ( struct input_stream inStream)

Blocking read from an input stream.

Returns
Next character on inStream.
Return values
<0Disconnected.
Parameters
[in,out]inStreamThe abstract input stream.
bool ltrx_output_stream_close ( struct output_stream outStream)

Closes the output stream.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
bool ltrx_output_stream_flush_data ( struct output_stream outStream)

Forces any buffered data to be actually output.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
bool ltrx_output_stream_from_input_stream ( struct output_stream outStream,
struct input_stream inStream 
)

Writes output stream till disconnected, and closes input.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in,out]inStreamThe abstract input stream.
bool ltrx_output_stream_write_binary ( struct output_stream outStream,
const void *  data,
size_t  length 
)

Writes binary data.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in]dataThe binary data to write.
[in]lengthThe length in bytes of the data to write.
bool ltrx_output_stream_write_hexadecimal ( struct output_stream outStream,
uint32_t  value 
)

Writes unsigned value as ASCII hexadecimal.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in]valueThe unsigned value to write.
bool ltrx_output_stream_write_line ( struct output_stream outStream,
const char *  data 
)

Writes data ending with newline.

An interface-dependent newline is sent after first sending data.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in]dataThe zero-terminated data to write.
bool ltrx_output_stream_write_unsigned ( struct output_stream outStream,
uint32_t  value 
)

Writes unsigned value as ASCII decimal.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in]valueThe unsigned value to write.
bool ltrx_output_stream_write_without_ending_line ( struct output_stream outStream,
const char *  data 
)

Writes data without any newline.

Return values
trueSuccess.
falseFailed.
Parameters
[in,out]outStreamThe abstract output stream.
[in]dataThe zero-terminated data to write.