|
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_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...
|
|
Streams provide a method to input or output single characters at a time independent of the device or construct they are connected to.
void ltrx_input_stream_close |
( |
struct input_stream * |
inStream | ) |
|
Closes the input stream.
- Parameters
-
[in,out] | inStream | The 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
-
true | Success. |
false | Failed. |
- Parameters
-
[out] | inStream | The concrete input stream from binary struct. |
[in] | data | The const data that will feed the stream. |
[in] | length | The 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
-
true | Success. |
false | Failed. |
- Parameters
-
[out] | inStream | The concrete input stream from const char struct. |
[in] | data | The 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
-
true | Success. |
false | Failed. |
- Parameters
-
[out] | concreteInStream | The concrete input stream from routine struct. |
[in] | thread_name | Name of the thread. |
[in] | stack_size | Thread stack size in bytes. |
[in] | routine | The routine to run in the thread. |
[in] | opaque | Any 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
-
-1 | Waiting. |
-2 | Disconnected. |
- Parameters
-
[in] | inStream | The 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
-
-1 | Waiting. |
-2 | Disconnected. |
- Parameters
-
[in] | inStream | The abstract input stream. |
[in] | blockTimeMsec | How 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
-
- Parameters
-
[in,out] | inStream | The abstract input stream. |
bool ltrx_output_stream_close |
( |
struct output_stream * |
outStream | ) |
|
Closes the output stream.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
bool ltrx_output_stream_flush_data |
( |
struct output_stream * |
outStream | ) |
|
Forces any buffered data to be actually output.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
Writes output stream till disconnected, and closes input.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
[in,out] | inStream | The abstract input stream. |
bool ltrx_output_stream_write_binary |
( |
struct output_stream * |
outStream, |
|
|
const void * |
data, |
|
|
size_t |
length |
|
) |
| |
Writes binary data.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
[in] | data | The binary data to write. |
[in] | length | The length in bytes of the data 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
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
[in] | data | The 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
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
[in] | value | The 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
-
true | Success. |
false | Failed. |
- Parameters
-
[in,out] | outStream | The abstract output stream. |
[in] | data | The zero-terminated data to write. |