Microchip® Advanced Software Framework

winc1500/http_downloader_example/iot/stream_writer.c File Reference

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.

Parameters
[in]writerPointer of stream writer.
[in]bufferBuffer which will be used for the storing the data.
[in]max_lengthMaximum size of buffer.
[in]funcFunction to be called when the buffer is full.
[in]priv_dataPrivate 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.

void stream_writer_send_16BE ( struct stream_writer writer,
int16_t  value 
)

Write 16bit big endian value to the writer.

Parameters
[in]writerPointer of stream writer.
[in]valueValue 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.

Parameters
[in]writerPointer of stream writer.
[in]valueValue 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.

Parameters
[in]writerPointer of stream writer.
[in]valueValue 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.

Parameters
[in]writerPointer of stream writer.
[in]valueValue 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.

Parameters
[in]writerPointer of stream writer.
[in]valueValue 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.

Parameters
[in]writerPointer of stream writer.
[in]bufferBuffer will be written.
[in]lengthSize of the buffer.

References stream_writer_send_8().

void stream_writer_send_remain ( struct stream_writer writer)

Process remain data in the writer.

Parameters
[in]writerPointer of stream writer.

References stream_writer::buffer, stream_writer::priv_data, stream_writer::write_func, and stream_writer::written.