Skip to content
Snippets Groups Projects
setcontrol.h 800 B
#ifndef _setcontrol_h
#define _setcontrol_h

#include "packet.h"
#include "controller.h"

#include <sys/types.h>

/* Creates data and metadata for a setcontrol packet
 * Returns data size.
 */
ssize_t EncodeSetcontrol(
		struct metadata * m,        /* data_len and msg_type will be populated*/
		uint8_t * data,             /* Output buffer */
		size_t data_size,           /* Max buffer size */
		const struct controller_message * cm);      /* Message to encode */

/* Decode a metadata and data to populate a controller.
 * Returns 0 on success, -1 on failure.
 */
int DecodeSetcontrol(
		struct controller_message * cm,     /* Decoded controller message */
		const struct metadata * m,          /* Metadata to aid in decoding */
		const uint8_t * data);              /* Data to decode */


#endif