Stream utility for the IoT service.
Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include <string.h>
#include "iot/stream_writer.h"
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, const 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... | |
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 buffer, stream_writer::buffer, stream_writer::max_size, stream_writer::priv_data, stream_writer::write_func, and stream_writer::written.
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.
void stream_writer_send_buffer | ( | struct stream_writer * | writer, |
const 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().
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.