Stream utility for the IoT service.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdlib.h>
Data Structures | |
struct | stream_writer |
Typedefs | |
typedef int(* | stream_writer_write_func_t )(void *module, char *buffer, size_t buffer_len) |
Functions | |
void | stream_writer_init (struct stream_writer *writer, char *buffer, size_t max_length, stream_writer_write_func_t func, void *priv_data) |
Initialize the Stream writer module. More... | |
void | stream_writer_send_16BE (struct stream_writer *writer, int16_t value) |
Write 16bit big endian value to the writer. More... | |
void | stream_writer_send_16LE (struct stream_writer *writer, int16_t value) |
Write 16bit little endian value to the writer. More... | |
void | stream_writer_send_32BE (struct stream_writer *writer, int32_t value) |
Write 32bit big endian value to the writer. More... | |
void | stream_writer_send_32LE (struct stream_writer *writer, int32_t value) |
Write 32bit little endian value to the writer. More... | |
void | stream_writer_send_8 (struct stream_writer *writer, int8_t value) |
Write 8bit to the writer. More... | |
void | stream_writer_send_buffer (struct stream_writer *writer, char *buffer, size_t length) |
Write buffer to the writer. More... | |
void | stream_writer_send_remain (struct stream_writer *writer) |
Process remain data in the writer. More... | |
typedef int(* stream_writer_write_func_t)(void *module, char *buffer, size_t buffer_len) |
void stream_writer_init | ( | struct stream_writer * | writer, |
char * | buffer, | ||
size_t | max_length, | ||
stream_writer_write_func_t | func, | ||
void * | priv_data | ||
) |
Initialize the Stream writer module.
[in] | writer | Pointer of stream writer. |
[in] | buffer | Buffer which will be used for the storing the data. |
[in] | max_length | Maximum size of buffer. |
[in] | func | Function to be called when the buffer is full. |
[in] | priv_data | Private data. It is passed along when callback was called. |
References stream_writer::buffer, buffer, stream_writer::max_size, stream_writer::priv_data, stream_writer::write_func, and stream_writer::written.
Referenced by _http_client_request().
void stream_writer_send_16BE | ( | struct stream_writer * | writer, |
int16_t | value | ||
) |
Write 16bit big endian value to the writer.
[in] | writer | Pointer of stream writer. |
[in] | value | Value will be written. |
References stream_writer_send_8().
void stream_writer_send_16LE | ( | struct stream_writer * | writer, |
int16_t | value | ||
) |
Write 16bit little endian value to the writer.
[in] | writer | Pointer of stream writer. |
[in] | value | Value will be written. |
References stream_writer_send_8().
void stream_writer_send_32BE | ( | struct stream_writer * | writer, |
int32_t | value | ||
) |
Write 32bit big endian value to the writer.
[in] | writer | Pointer of stream writer. |
[in] | value | Value will be written. |
References stream_writer_send_8().
void stream_writer_send_32LE | ( | struct stream_writer * | writer, |
int32_t | value | ||
) |
Write 32bit little endian value to the writer.
[in] | writer | Pointer of stream writer. |
[in] | value | Value will be written. |
References stream_writer_send_8().
void stream_writer_send_8 | ( | struct stream_writer * | writer, |
int8_t | value | ||
) |
Write 8bit to the writer.
[in] | writer | Pointer of stream writer. |
[in] | value | Value will be written. |
References stream_writer::buffer, stream_writer::max_size, stream_writer_send_remain(), and stream_writer::written.
Referenced by stream_writer_send_16BE(), stream_writer_send_16LE(), stream_writer_send_32BE(), stream_writer_send_32LE(), and stream_writer_send_buffer().
void stream_writer_send_buffer | ( | struct stream_writer * | writer, |
char * | buffer, | ||
size_t | length | ||
) |
Write buffer to the writer.
[in] | writer | Pointer of stream writer. |
[in] | buffer | Buffer will be written. |
[in] | length | Size of the buffer. |
References stream_writer_send_8().
Referenced by _http_client_request().
void stream_writer_send_remain | ( | struct stream_writer * | writer | ) |
Process remain data in the writer.
[in] | writer | Pointer of stream writer. |
References stream_writer::buffer, stream_writer::priv_data, stream_writer::write_func, and stream_writer::written.
Referenced by _http_client_request(), and stream_writer_send_8().