Microchip® Advanced Software Framework

winc3400/locate_ip_address_example/iot/stream_writer.c File Reference

Stream utility for the IoT service.

Copyright (c) 2017-2019 Microchip Technology Inc. and its subsidiaries.

#include "iot/stream_writer.h"
#include <string.h>
#include <asf.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, 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.

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.

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

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.

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

Referenced by _http_client_request().

void stream_writer_send_remain ( struct stream_writer writer)

Process remain data in the writer.

Parameters
[in]writerPointer of stream writer.

Referenced by _http_client_request(), and stream_writer_send_8().