5.11.0.0R3
Software Development Kit
 
Loading...
Searching...
No Matches
Streams

Functions

int ltrx_input_stream_case_compare (struct input_stream *s1, struct input_stream *s2)
 Compare independent of case.
 
void ltrx_input_stream_close (struct input_stream *inStream)
 Closes the input stream.
 
int ltrx_input_stream_compare (struct input_stream *s1, struct input_stream *s2)
 Compare with case sensitivity.
 
bool ltrx_input_stream_init_from_binary (struct input_stream_from_binary *inStream, const void *data, size_t length)
 Construct input stream from binary.
 
bool ltrx_input_stream_init_from_const_char (struct input_stream_from_const_char *inStream, const char *data)
 Construct input stream from const char.
 
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.
 
int ltrx_input_stream_peek (struct input_stream *inStream)
 Non-blocking peek.
 
int ltrx_input_stream_peek_with_block_time (struct input_stream *inStream, uint32_t blockTimeMsec)
 Blocking peek.
 
int ltrx_input_stream_read (struct input_stream *inStream)
 Blocking read from an input stream.
 
bool ltrx_output_stream_close (struct output_stream *outStream)
 Closes the output stream.
 
bool ltrx_output_stream_flush_data (struct output_stream *outStream)
 Forces any buffered data to be actually output.
 
bool ltrx_output_stream_from_input_stream (struct output_stream *outStream, struct input_stream *inStream)
 Writes output stream till disconnected, and closes input.
 
bool ltrx_output_stream_write_binary (struct output_stream *outStream, const void *data, size_t length)
 Writes binary data.
 
bool ltrx_output_stream_write_hexadecimal (struct output_stream *outStream, uint32_t value)
 Writes unsigned value as ASCII hexadecimal.
 
bool ltrx_output_stream_write_line (struct output_stream *outStream, const char *data)
 Writes data ending with newline.
 
bool ltrx_output_stream_write_unsigned (struct output_stream *outStream, uint32_t value)
 Writes unsigned value as ASCII decimal.
 
bool ltrx_output_stream_write_without_ending_line (struct output_stream *outStream, const char *data)
 Writes data without any newline.
 

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

◆ ltrx_input_stream_case_compare()

int ltrx_input_stream_case_compare ( struct input_stream * s1,
struct input_stream * s2 )

Compare independent of case.

It peeks first, so in case of mismatch, both streams will not yet have read the mismatched character.

Return values
-1Mismatch less.
0Identical.
1Mismatch greater.
Parameters
[in]s1The first input stream to be compared.
[in]s2The second input stream to be compared.

◆ ltrx_input_stream_close()

void ltrx_input_stream_close ( struct input_stream * inStream)

Closes the input stream.

Parameters
inStream[in,out] The abstract input stream.

◆ ltrx_input_stream_compare()

int ltrx_input_stream_compare ( struct input_stream * s1,
struct input_stream * s2 )

Compare with case sensitivity.

It peeks first, so in case of mismatch, both streams will not yet have read the mismatched character.

Return values
-1Mismatch less.
0Identical.
1Mismatch greater.
Parameters
[in]s1The first input stream to be compared.
[in]s2The second input stream to be compared.

◆ ltrx_input_stream_init_from_binary()

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.

◆ ltrx_input_stream_init_from_const_char()

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.

◆ ltrx_input_stream_init_from_routine()

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.

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.

◆ ltrx_input_stream_peek()

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.

◆ ltrx_input_stream_peek_with_block_time()

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.

◆ ltrx_input_stream_read()

int ltrx_input_stream_read ( struct input_stream * inStream)

Blocking read from an input stream.

Returns
Next character on inStream.
Return values
<0Disconnected.
Parameters
inStream[in,out] The abstract input stream.

◆ ltrx_output_stream_close()

bool ltrx_output_stream_close ( struct output_stream * outStream)

Closes the output stream.

Return values
trueSuccess.
falseFailed.
Parameters
outStream[in,out] The abstract output stream.

◆ ltrx_output_stream_flush_data()

bool ltrx_output_stream_flush_data ( struct output_stream * outStream)

Forces any buffered data to be actually output.

Return values
trueSuccess.
falseFailed.
Parameters
outStream[in,out] The abstract output stream.

◆ ltrx_output_stream_from_input_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
outStream[in,out] The abstract output stream.
inStream[in,out] The abstract input stream.

◆ ltrx_output_stream_write_binary()

bool ltrx_output_stream_write_binary ( struct output_stream * outStream,
const void * data,
size_t length )

Writes binary data.

Return values
trueSuccess.
falseFailed.
Parameters
outStream[in,out] The abstract output stream.
[in]dataThe binary data to write.
[in]lengthThe length in bytes of the data to write.

◆ ltrx_output_stream_write_hexadecimal()

bool ltrx_output_stream_write_hexadecimal ( struct output_stream * outStream,
uint32_t value )

Writes unsigned value as ASCII hexadecimal.

Return values
trueSuccess.
falseFailed.
Parameters
outStream[in,out] The abstract output stream.
[in]valueThe unsigned value to write.

◆ ltrx_output_stream_write_line()

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
outStream[in,out] The abstract output stream.
[in]dataThe zero-terminated data to write.

◆ ltrx_output_stream_write_unsigned()

bool ltrx_output_stream_write_unsigned ( struct output_stream * outStream,
uint32_t value )

Writes unsigned value as ASCII decimal.

Return values
trueSuccess.
falseFailed.
Parameters
outStream[in,out] The abstract output stream.
[in]valueThe unsigned value to write.

◆ ltrx_output_stream_write_without_ending_line()

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
outStream[in,out] The abstract output stream.
[in]dataThe zero-terminated data to write.