iCub-main
EoProtocolAS_fun_userdef.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Department of Robotics Brain and Cognitive Sciences - Istituto Italiano di Tecnologia
3  * Author: Marco Accame
4  * email: marco.accame@iit.it
5  * website: www.robotcub.org
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * http://www.robotcub.org/icub/license/gpl.txt
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17 */
18 
19 
20 /* @file EOProtocolAS_fun_userdef.c
21  @brief This file keeps callbacks used for AS protocol in icub-main
22  @author marco.accame@iit.it
23  @date 22 mar 2016
24 **/
25 
26 // --------------------------------------------------------------------------------------------------------------------
27 // - external dependencies
28 // --------------------------------------------------------------------------------------------------------------------
29 
30 
31 #include "EoCommon.h"
32 #include "EoProtocol.h"
33 #include "EOnv.h"
34 #include "EOarray.h"
35 
36 #include "FeatureInterface.h"
37 
38 // --------------------------------------------------------------------------------------------------------------------
39 // - declaration of extern public interface
40 // --------------------------------------------------------------------------------------------------------------------
41 
42 #include "EoProtocolAS.h"
43 
44 
45 
46 // --------------------------------------------------------------------------------------------------------------------
47 // - #define with internal scope
48 // --------------------------------------------------------------------------------------------------------------------
49 // empty-section
50 
51 
52 // --------------------------------------------------------------------------------------------------------------------
53 // - declaration of static functions
54 // --------------------------------------------------------------------------------------------------------------------
55 
56 static void handle_data_analogarray(const EOnv* nv, const eOropdescriptor_t* rd);
57 
58 static void handle_data_inertial3(const EOnv* nv, const eOropdescriptor_t* rd);
59 
60 static void handle_data_temperature(const EOnv* nv, const eOropdescriptor_t* rd);
61 
62 static void handle_data_psc(const EOnv* nv, const eOropdescriptor_t* rd);
63 
64 static void handle_data_pos(const EOnv* nv, const eOropdescriptor_t* rd);
65 
66 static void handle_data_ft(const EOnv* nv, const eOropdescriptor_t* rd);
67 
68 static void handle_data_battery(const EOnv* nv, const eOropdescriptor_t* rd);
69 
70 // --------------------------------------------------------------------------------------------------------------------
71 // - definition (and initialisation) of static variables
72 // --------------------------------------------------------------------------------------------------------------------
73 // empty section
74 
75 
76 
77 // --------------------------------------------------------------------------------------------------------------------
78 // - definition of extern public functions
79 // --------------------------------------------------------------------------------------------------------------------
80 
81 
82 extern void eoprot_fun_ONSAY_as(const EOnv* nv, const eOropdescriptor_t* rd)
83 {
84  feat_signal_network_onsay(eo_nv_GetIP(nv), rd->id32, rd->signature);
85 }
86 
87 
88 extern void eoprot_fun_UPDT_as_strain_status_calibratedvalues(const EOnv* nv, const eOropdescriptor_t* rd)
89 {
90  if(eo_ropcode_sig == rd->ropcode)
91  {
93  }
94 }
95 
96 
97 extern void eoprot_fun_UPDT_as_strain_status_uncalibratedvalues(const EOnv* nv, const eOropdescriptor_t* rd)
98 {
99  if(eo_ropcode_sig == rd->ropcode)
100  {
101  handle_data_analogarray(nv, rd);
102  }
103 }
104 
105 
106 extern void eoprot_fun_UPDT_as_mais_status_the15values(const EOnv* nv, const eOropdescriptor_t* rd)
107 {
108  if(eo_ropcode_sig == rd->ropcode)
109  {
110  handle_data_analogarray(nv, rd);
111  }
112 }
113 
114 
115 extern void eoprot_fun_UPDT_as_inertial3_status(const EOnv* nv, const eOropdescriptor_t* rd)
116 {
117  if(eo_ropcode_sig == rd->ropcode)
118  {
119  handle_data_inertial3(nv, rd);
120  }
121 }
122 
123 
124 extern void eoprot_fun_UPDT_as_temperature_status(const EOnv* nv, const eOropdescriptor_t* rd)
125 {
126  if(eo_ropcode_sig == rd->ropcode)
127  {
128  handle_data_temperature(nv, rd);
129  }
130 }
131 
132 extern void eoprot_fun_UPDT_as_psc_status(const EOnv* nv, const eOropdescriptor_t* rd)
133 {
134  if(eo_ropcode_sig == rd->ropcode)
135  {
136  handle_data_psc(nv, rd);
137  }
138 }
139 
140 extern void eoprot_fun_UPDT_as_pos_status(const EOnv* nv, const eOropdescriptor_t* rd)
141 {
142  if(eo_ropcode_sig == rd->ropcode)
143  {
144  handle_data_pos(nv, rd);
145  }
146 }
147 
148 extern void eoprot_fun_UPDT_as_ft_status_timedvalue(const EOnv* nv, const eOropdescriptor_t* rd)
149 {
150  if(eo_ropcode_sig == rd->ropcode)
151  {
152  handle_data_ft(nv, rd);
153  }
154 }
155 
156 extern void eoprot_fun_UPDT_as_battery_status_timedvalue(const EOnv* nv, const eOropdescriptor_t* rd)
157 {
158  if(eo_ropcode_sig == rd->ropcode)
159  {
160  handle_data_battery(nv, rd);
161  }
162 }
163 
164 
165 // --------------------------------------------------------------------------------------------------------------------
166 // - definition of static functions
167 // --------------------------------------------------------------------------------------------------------------------
168 
169 static void handle_data_analogarray(const EOnv* nv, const eOropdescriptor_t* rd)
170 {
171  EOarray* arrayof = (EOarray*)rd->data;
172  uint8_t sizeofarray = eo_array_Size(arrayof);
173  if(0 != sizeofarray)
174  {
175  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)arrayof);
176  }
177 }
178 
179 static void handle_data_inertial3(const EOnv* nv, const eOropdescriptor_t* rd)
180 {
181  eOas_inertial3_status_t *inertial3status = (eOas_inertial3_status_t*)rd->data;
182  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)inertial3status);
183 }
184 
185 
186 static void handle_data_temperature(const EOnv* nv, const eOropdescriptor_t* rd)
187 {
188  eOas_temperature_status_t *tempstatus = (eOas_temperature_status_t*)rd->data;
189  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)tempstatus);
190 }
191 
192 static void handle_data_psc(const EOnv* nv, const eOropdescriptor_t* rd)
193 {
194  eOas_psc_status_t *pscstatus = (eOas_psc_status_t*)rd->data;
195  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)pscstatus);
196 }
197 
198 static void handle_data_pos(const EOnv* nv, const eOropdescriptor_t* rd)
199 {
200  eOas_pos_status_t *posstatus = (eOas_pos_status_t*)rd->data;
201  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)posstatus);
202 }
203 
204 static void handle_data_ft(const EOnv* nv, const eOropdescriptor_t* rd)
205 {
206  eOas_ft_status_t *ftstatus = (eOas_ft_status_t*)rd->data;
207  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)ftstatus);
208 }
209 
210 static void handle_data_battery(const EOnv* nv, const eOropdescriptor_t* rd)
211 {
212  eOas_battery_status_t *batterystatus = (eOas_battery_status_t*)rd->data;
213  feat_manage_analogsensors_data(eo_nv_GetIP(nv), rd->id32, (void *)batterystatus);
214 }
215 
216 // --------------------------------------------------------------------------------------------------------------------
217 // - end-of-file (leave a blank line after)
218 // --------------------------------------------------------------------------------------------------------------------
219 
220 
221 
void eoprot_fun_UPDT_as_strain_status_calibratedvalues(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_strain_status_uncalibratedvalues(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_ft_status_timedvalue(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_ONSAY_as(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_inertial3_status(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_psc(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_ft(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_pos_status(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_psc_status(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_analogarray(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_temperature_status(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_inertial3(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_mais_status_the15values(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_temperature(const EOnv *nv, const eOropdescriptor_t *rd)
void eoprot_fun_UPDT_as_battery_status_timedvalue(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_battery(const EOnv *nv, const eOropdescriptor_t *rd)
static void handle_data_pos(const EOnv *nv, const eOropdescriptor_t *rd)
eObool_t feat_signal_network_onsay(eOipv4addr_t ipv4, eOprotID32_t id32, uint32_t signature)
eObool_t feat_manage_analogsensors_data(eOipv4addr_t ipv4, eOprotID32_t id32, void *data)