aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/pb-serial.h
blob: 79f08d787cf264140688e1ce1df7ca6277c4dd5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once

#include <mpack.h>

#include "pb-types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \ingroup pbdrv
 * \ingroup pbdrv-mod
 * \defgroup pb_ser Serial
 * \internal
 * \brief Internal (de)serialization functions using mpack
 *
 * \{
 */

/**
 * \brief Write (serialize) message fields using mpack
 *
 * \param writer Pointer to \c mpack_writer_t instance
 * \param msg Pointer to message struct to read from
 */
typedef void pb_ser_w_t(mpack_writer_t * writer, const pb_msg_t * msg);
/**
 * \brief Read (deserialize) message fields using mpack
 *
 * \param reader Pointer to \c mpack_reader_t instance
 * \param msg Pointer to message struct to write to
 */
typedef void pb_ser_r_t(mpack_reader_t * reader, pb_msg_t * msg);
/**
 * \brief Recursively free message struct fields
 *
 * \param msg Pointer to message struct to free
 */
typedef void pb_ser_free_t(pb_msg_t * msg);

/**
 * \brief Write the \ref pb_msg_t header fields and call another function for
 * \p msg->cmd.
 * \see pb_ser_w_t
 */
pb_ser_w_t pb_ser_w;
/**
 * \brief Read the \ref pb_msg_t header fields and call another function for \p
 * msg->cmd.
 * \see pb_ser_r_t
 */
pb_ser_r_t pb_ser_r;
/**
 * \brief Call another function for \p msg->cmd.
 * \see pb_ser_free_t
 */
pb_ser_free_t pb_ser_free;

//! Write the \ref pb_cmd_prop_t fields \see pb_ser_w_t
pb_ser_w_t pb_ser_w_cmd_prop;
//! Read the \ref pb_cmd_prop_t fields \see pb_ser_r_t
pb_ser_r_t pb_ser_r_cmd_prop;
//! Free the \ref pb_cmd_prop_t fields \see pb_ser_free_t
pb_ser_free_t pb_ser_free_cmd_prop;

//! Write the \ref pb_cmd_state_t fields \see pb_ser_w_t
pb_ser_w_t pb_ser_w_cmd_state;
//! Read the \ref pb_cmd_state_t fields \see pb_ser_r_t
pb_ser_r_t pb_ser_r_cmd_state;
//! Free the \ref pb_cmd_state_t fields \see pb_ser_free_t
pb_ser_free_t pb_ser_free_cmd_state;

//! Write the \ref pb_cmd_magic_t fields \see pb_ser_w_t
pb_ser_w_t pb_ser_w_cmd_magic;
//! Read the \ref pb_cmd_magic_t fields \see pb_ser_r_t
pb_ser_r_t pb_ser_r_cmd_magic;
//! Free the \ref pb_cmd_magic_t fields \see pb_ser_free_t
pb_ser_free_t pb_ser_free_cmd_magic;

/// \}

#ifdef __cplusplus
}
#endif