14
14
*/
15
15
#include " model.h"
16
16
17
+ /* **********************************************************************/
18
+ /* !
19
+ @brief SensorModel constructor
20
+ */
21
+ /* **********************************************************************/
17
22
SensorModel::SensorModel () {
18
23
_msg_sensor_event = wippersnapper_sensor_SensorEvent_init_default;
19
24
}
20
25
26
+ /* **********************************************************************/
27
+ /* !
28
+ @brief SensorModel destructor
29
+ */
30
+ /* **********************************************************************/
21
31
SensorModel::~SensorModel () {}
22
32
33
+ /* **********************************************************************/
34
+ /* !
35
+ @brief Decodes a SensorEvent message into a SensorModel object.
36
+ @param stream
37
+ The input stream
38
+ @returns True if the SensorEvent message was successfully decoded,
39
+ False otherwise.
40
+ */
41
+ /* **********************************************************************/
23
42
bool SensorModel::decodeSensorEvent (pb_istream_t *stream) {
24
43
// Decode the stream into theSensorEvent message
25
44
if (!pb_decode (stream, wippersnapper_sensor_SensorEvent_fields,
@@ -29,6 +48,91 @@ bool SensorModel::decodeSensorEvent(pb_istream_t *stream) {
29
48
return true ;
30
49
}
31
50
51
+ /* **********************************************************************/
52
+ /* !
53
+ @brief Clears the SensorEvent message.
54
+ */
55
+ /* **********************************************************************/
32
56
void SensorModel::clearSensorEvent () {
33
57
_msg_sensor_event = wippersnapper_sensor_SensorEvent_init_default;
58
+ }
59
+
60
+ /* **********************************************************************/
61
+ /* !
62
+ @brief Returns a SensorEvent message.
63
+ @returns The SensorEvent message.
64
+ */
65
+ /* **********************************************************************/
66
+ wippersnapper_sensor_SensorEvent *SensorModel::getSensorEvent () {
67
+ return &_msg_sensor_event;
68
+ }
69
+
70
+ /* **********************************************************************/
71
+ /* !
72
+ @brief Returns the the SensorEvent message's type.
73
+ @returns The type of the SensorEvent message, as a SensorType.
74
+ */
75
+ /* **********************************************************************/
76
+ wippersnapper_sensor_SensorType SensorModel::getSensorType () {
77
+ return _msg_sensor_event.type ;
78
+ }
79
+
80
+ /* **********************************************************************/
81
+ /* !
82
+ @brief Returns the the SensorEvent message's which_value field.
83
+ @returns The which_value field of the SensorEvent message.
84
+ */
85
+ /* **********************************************************************/
86
+ pb_size_t SensorModel::getSensorEventWhichValue () {
87
+ return _msg_sensor_event.which_value ;
88
+ }
89
+
90
+ /* **********************************************************************/
91
+ /* !
92
+ @brief Returns the the SensorEvent message's float value field.
93
+ @returns The float value of the SensorEvent message.
94
+ */
95
+ /* **********************************************************************/
96
+ float SensorModel::getValueFloat () {
97
+ return _msg_sensor_event.value .float_value ;
98
+ }
99
+
100
+ /* **********************************************************************/
101
+ /* !
102
+ @brief Returns the the SensorEvent message's bool value field.
103
+ @returns The bool value of the SensorEvent message.
104
+ */
105
+ /* **********************************************************************/
106
+ bool SensorModel::getValueBool () { return _msg_sensor_event.value .bool_value ; }
107
+
108
+ /* **********************************************************************/
109
+ /* !
110
+ @brief Returns the the SensorEvent message's vector value field.
111
+ @returns The vector value of the SensorEvent message.
112
+ */
113
+ /* **********************************************************************/
114
+ wippersnapper_sensor_SensorEvent_SensorEvent3DVector
115
+ SensorModel::getValueVector () {
116
+ return _msg_sensor_event.value .vector_value ;
117
+ }
118
+
119
+ /* **********************************************************************/
120
+ /* !
121
+ @brief Returns the the SensorEvent message's orientation value field.
122
+ @returns The orientation value of the SensorEvent message.
123
+ */
124
+ /* **********************************************************************/
125
+ wippersnapper_sensor_SensorEvent_SensorEventOrientation
126
+ SensorModel::getValueOrientation () {
127
+ return _msg_sensor_event.value .orientation_value ;
128
+ }
129
+
130
+ /* **********************************************************************/
131
+ /* !
132
+ @brief Returns the the SensorEvent message's color value field.
133
+ @returns The color value of the SensorEvent message.
134
+ */
135
+ /* **********************************************************************/
136
+ wippersnapper_sensor_SensorEvent_SensorEventColor SensorModel::getValueColor () {
137
+ return _msg_sensor_event.value .color_value ;
34
138
}
0 commit comments