65 lines
1.9 KiB
C
65 lines
1.9 KiB
C
/**
|
|
* @file di/rpc.h
|
|
* @brief brief
|
|
* @date Aug 27, 2015
|
|
* @author rheijden
|
|
* @copyright 2015 Dual Inventive Technology Centre B.V.
|
|
*
|
|
* RPC
|
|
*/
|
|
#ifndef INCLUDE_DI_RPC_H_
|
|
#define INCLUDE_DI_RPC_H_
|
|
|
|
#include <mpack/mpack.h>
|
|
|
|
#include <di/array.h>
|
|
|
|
#include <di/rpc/types.h>
|
|
#include <di/rpc/structures.h>
|
|
#include <di/rpc/serialize.h>
|
|
#include <di/rpc/deserialize.h>
|
|
#include <di/rpc/lowlevel.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
enum di_rpc_types di_rpc_types_from_str(const char *type);
|
|
const char *di_rpc_types_to_str(const enum di_rpc_types type);
|
|
const char *di_rpc_data_type_to_str(const enum di_rpc_data_type type);
|
|
const char *di_rpc_msg_type_to_str(const enum di_rpc_msg_type type);
|
|
|
|
/**
|
|
* Reset RPC message structure
|
|
* @param msg The message to reset
|
|
* @param device_uid The device:uid which must be valid (checked with di_device_uid_isvalid)
|
|
*/
|
|
void di_rpc_msg_reset(struct di_rpc_msg *msg, const char device_uid[DI_DEVICE_UID_LEN]);
|
|
|
|
#ifndef __cplusplus
|
|
#define di_rpc_to_str(type) \
|
|
_Generic((type), \
|
|
const enum di_rpc_msg_type : di_rpc_msg_type_to_str, \
|
|
enum di_rpc_msg_type : di_rpc_msg_type_to_str, \
|
|
const enum di_rpc_types : di_rpc_types_to_str, \
|
|
enum di_rpc_types : di_rpc_types_to_str, \
|
|
const enum di_rpc_data_type : di_rpc_data_type_to_str, \
|
|
enum di_rpc_data_type : di_rpc_data_type_to_str \
|
|
)(type)
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
static inline const char *di_rpc_to_str(const enum di_rpc_types type) { return di_rpc_types_to_str(type); }
|
|
static inline const char *di_rpc_to_str(const enum di_rpc_data_type type) { return di_rpc_data_type_to_str(type); }
|
|
static inline const char *di_rpc_to_str(const enum di_rpc_msg_type type) { return di_rpc_msg_type_to_str(type); }
|
|
#endif
|
|
|
|
#endif /* INCLUDE_DI_RPC_H_ */
|