gusimplewhiteboard
wb_sensors_foot_sensors.c
Go to the documentation of this file.
1/*
2 * file wb_sensors_foot_sensors.c
3 *
4 * This file was generated by classgenerator from sensors_foot_sensors.gen.
5 * DO NOT CHANGE MANUALLY!
6 *
7 * Copyright © 2021 Carl Lusty. All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * 2. Redistributions in binary form must reproduce the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer in the documentation and/or other materials
19 * provided with the distribution.
20 *
21 * 3. All advertising materials mentioning features or use of this
22 * software must display the following acknowledgement:
23 *
24 * This product includes software developed by Carl Lusty.
25 *
26 * 4. Neither the name of the author nor the names of contributors
27 * may be used to endorse or promote products derived from this
28 * software without specific prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
34 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 *
42 * -----------------------------------------------------------------------
43 * This program is free software; you can redistribute it and/or
44 * modify it under the above terms or under the terms of the GNU
45 * General Public License as published by the Free Software Foundation;
46 * either version 2 of the License, or (at your option) any later version.
47 *
48 * This program is distributed in the hope that it will be useful,
49 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51 * GNU General Public License for more details.
52 *
53 * You should have received a copy of the GNU General Public License
54 * along with this program; if not, see http://www.gnu.org/licenses/
55 * or write to the Free Software Foundation, Inc., 51 Franklin Street,
56 * Fifth Floor, Boston, MA 02110-1301, USA.
57 *
58 */
59
60#ifndef WHITEBOARD_POSTER_STRING_CONVERSION
61#define WHITEBOARD_POSTER_STRING_CONVERSION
62#endif // WHITEBOARD_POSTER_STRING_CONVERSION
63
65#include <stdio.h>
66#include <string.h>
67#include <stdlib.h>
68#include <ctype.h>
69#include <limits.h>
70
71/* Network byte order functions */
72#pragma clang diagnostic push
73#pragma clang diagnostic ignored "-Wunused-macros"
74#if defined(__linux)
75# include <endian.h>
76# include <byteswap.h>
77#elif defined(__APPLE__)
78# include <machine/endian.h> //Needed for __BYTE_ORDER
79# include <architecture/byte_order.h> //Needed for byte swap functions
80# define bswap_16(x) NXSwapShort(x)
81# define bswap_32(x) NXSwapInt(x)
82# define bswap_64(x) NXSwapLongLong(x)
83#elif defined(ESP8266)
84# define bswap_16(x) __builtin_bswap16(x)
85# define bswap_32(x) __builtin_bswap32(x)
86# define bswap_64(x) __builtin_bswap64(x)
87#else
88 //Manually define swap macros?
89#endif
90
91#if (!defined(__BYTE_ORDER) && !defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN)
92# if !defined(htonll) && !defined(ntohll)
93# define htonll(x) bswap_64(x)
94# define ntohll(x) bswap_64(x)
95# endif
96# if !defined(htonl) && !defined(ntohl)
97# define htonl(x) bswap_32(x)
98# define ntohl(x) bswap_32(x)
99# endif
100# if !defined(htons) && !defined(ntohs)
101# define htons(x) bswap_16(x)
102# define ntohs(x) bswap_16(x)
103# endif
104#else
105# if !defined(htonll) && !defined(ntohll)
106# define htonll(x) (x)
107# define ntohll(x) (x)
108# endif
109# if !defined(htonl) && !defined(ntohl)
110# define htonl(x) (x)
111# define ntohl(x) (x)
112# endif
113# if !defined(htons) && !defined(ntohs)
114# define htons(x) (x)
115# define ntohs(x) (x)
116# endif
117#endif
118#pragma clang diagnostic pop
119
120
121
125const char* wb_sensors_foot_sensors_description(const struct wb_sensors_foot_sensors* self, char* descString, size_t bufferSize)
126{
127#pragma clang diagnostic push
128#pragma clang diagnostic ignored "-Wunused-variable"
129 size_t len = 0;
130 if (len >= bufferSize) {
131 return descString;
132 }
133 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_FrontLeft=%lf", (double) self->LFoot_FSR_FrontLeft);
134 if (len >= bufferSize) {
135 return descString;
136 }
137 len = gu_strlcat(descString, ", ", bufferSize);
138 if (len >= bufferSize) {
139 return descString;
140 }
141 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_FrontRight=%lf", (double) self->LFoot_FSR_FrontRight);
142 if (len >= bufferSize) {
143 return descString;
144 }
145 len = gu_strlcat(descString, ", ", bufferSize);
146 if (len >= bufferSize) {
147 return descString;
148 }
149 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_RearLeft=%lf", (double) self->LFoot_FSR_RearLeft);
150 if (len >= bufferSize) {
151 return descString;
152 }
153 len = gu_strlcat(descString, ", ", bufferSize);
154 if (len >= bufferSize) {
155 return descString;
156 }
157 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_RearRight=%lf", (double) self->LFoot_FSR_RearRight);
158 if (len >= bufferSize) {
159 return descString;
160 }
161 len = gu_strlcat(descString, ", ", bufferSize);
162 if (len >= bufferSize) {
163 return descString;
164 }
165 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_CenterOfPressure_X=%lf", (double) self->LFoot_FSR_CenterOfPressure_X);
166 if (len >= bufferSize) {
167 return descString;
168 }
169 len = gu_strlcat(descString, ", ", bufferSize);
170 if (len >= bufferSize) {
171 return descString;
172 }
173 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_CenterOfPressure_Y=%lf", (double) self->LFoot_FSR_CenterOfPressure_Y);
174 if (len >= bufferSize) {
175 return descString;
176 }
177 len = gu_strlcat(descString, ", ", bufferSize);
178 if (len >= bufferSize) {
179 return descString;
180 }
181 len += snprintf(descString + len, bufferSize - len, "LFoot_FSR_TotalWeight=%lf", (double) self->LFoot_FSR_TotalWeight);
182 if (len >= bufferSize) {
183 return descString;
184 }
185 len = gu_strlcat(descString, ", ", bufferSize);
186 if (len >= bufferSize) {
187 return descString;
188 }
189 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_FrontLeft=%lf", (double) self->RFoot_FSR_FrontLeft);
190 if (len >= bufferSize) {
191 return descString;
192 }
193 len = gu_strlcat(descString, ", ", bufferSize);
194 if (len >= bufferSize) {
195 return descString;
196 }
197 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_FrontRight=%lf", (double) self->RFoot_FSR_FrontRight);
198 if (len >= bufferSize) {
199 return descString;
200 }
201 len = gu_strlcat(descString, ", ", bufferSize);
202 if (len >= bufferSize) {
203 return descString;
204 }
205 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_RearLeft=%lf", (double) self->RFoot_FSR_RearLeft);
206 if (len >= bufferSize) {
207 return descString;
208 }
209 len = gu_strlcat(descString, ", ", bufferSize);
210 if (len >= bufferSize) {
211 return descString;
212 }
213 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_RearRight=%lf", (double) self->RFoot_FSR_RearRight);
214 if (len >= bufferSize) {
215 return descString;
216 }
217 len = gu_strlcat(descString, ", ", bufferSize);
218 if (len >= bufferSize) {
219 return descString;
220 }
221 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_CenterOfPressure_X=%lf", (double) self->RFoot_FSR_CenterOfPressure_X);
222 if (len >= bufferSize) {
223 return descString;
224 }
225 len = gu_strlcat(descString, ", ", bufferSize);
226 if (len >= bufferSize) {
227 return descString;
228 }
229 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_CenterOfPressure_Y=%lf", (double) self->RFoot_FSR_CenterOfPressure_Y);
230 if (len >= bufferSize) {
231 return descString;
232 }
233 len = gu_strlcat(descString, ", ", bufferSize);
234 if (len >= bufferSize) {
235 return descString;
236 }
237 len += snprintf(descString + len, bufferSize - len, "RFoot_FSR_TotalWeight=%lf", (double) self->RFoot_FSR_TotalWeight);
238 if (len >= bufferSize) {
239 return descString;
240 }
241 len = gu_strlcat(descString, ", ", bufferSize);
242 if (len >= bufferSize) {
243 return descString;
244 }
245 len = gu_strlcat(descString, self->LFoot_Bumper_Left ? "LFoot_Bumper_Left=true" : "LFoot_Bumper_Left=false", bufferSize);
246 if (len >= bufferSize) {
247 return descString;
248 }
249 len = gu_strlcat(descString, ", ", bufferSize);
250 if (len >= bufferSize) {
251 return descString;
252 }
253 len = gu_strlcat(descString, self->LFoot_Bumper_Right ? "LFoot_Bumper_Right=true" : "LFoot_Bumper_Right=false", bufferSize);
254 if (len >= bufferSize) {
255 return descString;
256 }
257 len = gu_strlcat(descString, ", ", bufferSize);
258 if (len >= bufferSize) {
259 return descString;
260 }
261 len = gu_strlcat(descString, self->RFoot_Bumper_Left ? "RFoot_Bumper_Left=true" : "RFoot_Bumper_Left=false", bufferSize);
262 if (len >= bufferSize) {
263 return descString;
264 }
265 len = gu_strlcat(descString, ", ", bufferSize);
266 if (len >= bufferSize) {
267 return descString;
268 }
269 len = gu_strlcat(descString, self->RFoot_Bumper_Right ? "RFoot_Bumper_Right=true" : "RFoot_Bumper_Right=false", bufferSize);
270 return descString;
271#pragma clang diagnostic pop
272}
273
277const char* wb_sensors_foot_sensors_to_string(const struct wb_sensors_foot_sensors* self, char* toString, size_t bufferSize)
278{
279#pragma clang diagnostic push
280#pragma clang diagnostic ignored "-Wunused-variable"
281 size_t len = 0;
282 if (len >= bufferSize) {
283 return toString;
284 }
285 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_FrontLeft);
286 if (len >= bufferSize) {
287 return toString;
288 }
289 len = gu_strlcat(toString, ", ", bufferSize);
290 if (len >= bufferSize) {
291 return toString;
292 }
293 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_FrontRight);
294 if (len >= bufferSize) {
295 return toString;
296 }
297 len = gu_strlcat(toString, ", ", bufferSize);
298 if (len >= bufferSize) {
299 return toString;
300 }
301 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_RearLeft);
302 if (len >= bufferSize) {
303 return toString;
304 }
305 len = gu_strlcat(toString, ", ", bufferSize);
306 if (len >= bufferSize) {
307 return toString;
308 }
309 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_RearRight);
310 if (len >= bufferSize) {
311 return toString;
312 }
313 len = gu_strlcat(toString, ", ", bufferSize);
314 if (len >= bufferSize) {
315 return toString;
316 }
317 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_CenterOfPressure_X);
318 if (len >= bufferSize) {
319 return toString;
320 }
321 len = gu_strlcat(toString, ", ", bufferSize);
322 if (len >= bufferSize) {
323 return toString;
324 }
325 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_CenterOfPressure_Y);
326 if (len >= bufferSize) {
327 return toString;
328 }
329 len = gu_strlcat(toString, ", ", bufferSize);
330 if (len >= bufferSize) {
331 return toString;
332 }
333 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->LFoot_FSR_TotalWeight);
334 if (len >= bufferSize) {
335 return toString;
336 }
337 len = gu_strlcat(toString, ", ", bufferSize);
338 if (len >= bufferSize) {
339 return toString;
340 }
341 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_FrontLeft);
342 if (len >= bufferSize) {
343 return toString;
344 }
345 len = gu_strlcat(toString, ", ", bufferSize);
346 if (len >= bufferSize) {
347 return toString;
348 }
349 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_FrontRight);
350 if (len >= bufferSize) {
351 return toString;
352 }
353 len = gu_strlcat(toString, ", ", bufferSize);
354 if (len >= bufferSize) {
355 return toString;
356 }
357 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_RearLeft);
358 if (len >= bufferSize) {
359 return toString;
360 }
361 len = gu_strlcat(toString, ", ", bufferSize);
362 if (len >= bufferSize) {
363 return toString;
364 }
365 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_RearRight);
366 if (len >= bufferSize) {
367 return toString;
368 }
369 len = gu_strlcat(toString, ", ", bufferSize);
370 if (len >= bufferSize) {
371 return toString;
372 }
373 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_CenterOfPressure_X);
374 if (len >= bufferSize) {
375 return toString;
376 }
377 len = gu_strlcat(toString, ", ", bufferSize);
378 if (len >= bufferSize) {
379 return toString;
380 }
381 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_CenterOfPressure_Y);
382 if (len >= bufferSize) {
383 return toString;
384 }
385 len = gu_strlcat(toString, ", ", bufferSize);
386 if (len >= bufferSize) {
387 return toString;
388 }
389 len += snprintf(toString + len, bufferSize - len, "%lf", (double) self->RFoot_FSR_TotalWeight);
390 if (len >= bufferSize) {
391 return toString;
392 }
393 len = gu_strlcat(toString, ", ", bufferSize);
394 if (len >= bufferSize) {
395 return toString;
396 }
397 len = gu_strlcat(toString, self->LFoot_Bumper_Left ? "true" : "false", bufferSize);
398 if (len >= bufferSize) {
399 return toString;
400 }
401 len = gu_strlcat(toString, ", ", bufferSize);
402 if (len >= bufferSize) {
403 return toString;
404 }
405 len = gu_strlcat(toString, self->LFoot_Bumper_Right ? "true" : "false", bufferSize);
406 if (len >= bufferSize) {
407 return toString;
408 }
409 len = gu_strlcat(toString, ", ", bufferSize);
410 if (len >= bufferSize) {
411 return toString;
412 }
413 len = gu_strlcat(toString, self->RFoot_Bumper_Left ? "true" : "false", bufferSize);
414 if (len >= bufferSize) {
415 return toString;
416 }
417 len = gu_strlcat(toString, ", ", bufferSize);
418 if (len >= bufferSize) {
419 return toString;
420 }
421 len = gu_strlcat(toString, self->RFoot_Bumper_Right ? "true" : "false", bufferSize);
422 return toString;
423#pragma clang diagnostic pop
424}
425
430{
431 size_t temp_length = strlen(str);
432 int length = (temp_length <= INT_MAX) ? ((int)((ssize_t)temp_length)) : -1;
433 if (length < 1 || length > SENSORS_FOOT_SENSORS_DESC_BUFFER_SIZE) {
434 return self;
435 }
436 char var_str_buffer[SENSORS_FOOT_SENSORS_DESC_BUFFER_SIZE + 1];
437 char* var_str = &var_str_buffer[0];
438 char key_buffer[29];
439 char* key = &key_buffer[0];
440 int bracecount = 0;
441 int startVar = 0;
442 int index = 0;
443 int startKey = 0;
444 int endKey = -1;
445 int varIndex = 0;
446 if (index == 0 && str[0] == '{') {
447 index = 1;
448 }
449 startVar = index;
450 startKey = startVar;
451 do {
452 for (int i = index; i < length; i++) {
453 index = i + 1;
454 if (bracecount == 0 && str[i] == '=') {
455 endKey = i - 1;
456 startVar = index;
457 continue;
458 }
459 if (bracecount == 0 && isspace(str[i])) {
460 startVar = index;
461 if (endKey == -1) {
462 startKey = index;
463 }
464 continue;
465 }
466 if (bracecount == 0 && str[i] == ',') {
467 index = i - 1;
468 break;
469 }
470 if (str[i] == '{') {
471 bracecount++;
472 continue;
473 }
474 if (str[i] == '}') {
475 bracecount--;
476 if (bracecount < 0) {
477 index = i - 1;
478 break;
479 }
480 }
481 if (i == length - 1) {
482 index = i;
483 }
484 }
485 if (endKey >= startKey && endKey - startKey < length) {
486 strncpy(key, str + startKey, ((size_t)(endKey - startKey) + 1));
487 key[(endKey - startKey) + 1] = 0;
488 } else {
489 key[0] = 0;
490 }
491 strncpy(var_str, str + startVar, ((size_t)(index - startVar) + 1));
492 var_str[(index - startVar) + 1] = 0;
493 bracecount = 0;
494 index += 2;
495 startVar = index;
496 startKey = startVar;
497 endKey = -1;
498 if (strlen(key) > 0) {
499 if (0 == strcmp("LFoot_FSR_FrontLeft", key)) {
500 varIndex = 0;
501 } else if (0 == strcmp("LFoot_FSR_FrontRight", key)) {
502 varIndex = 1;
503 } else if (0 == strcmp("LFoot_FSR_RearLeft", key)) {
504 varIndex = 2;
505 } else if (0 == strcmp("LFoot_FSR_RearRight", key)) {
506 varIndex = 3;
507 } else if (0 == strcmp("LFoot_FSR_CenterOfPressure_X", key)) {
508 varIndex = 4;
509 } else if (0 == strcmp("LFoot_FSR_CenterOfPressure_Y", key)) {
510 varIndex = 5;
511 } else if (0 == strcmp("LFoot_FSR_TotalWeight", key)) {
512 varIndex = 6;
513 } else if (0 == strcmp("RFoot_FSR_FrontLeft", key)) {
514 varIndex = 7;
515 } else if (0 == strcmp("RFoot_FSR_FrontRight", key)) {
516 varIndex = 8;
517 } else if (0 == strcmp("RFoot_FSR_RearLeft", key)) {
518 varIndex = 9;
519 } else if (0 == strcmp("RFoot_FSR_RearRight", key)) {
520 varIndex = 10;
521 } else if (0 == strcmp("RFoot_FSR_CenterOfPressure_X", key)) {
522 varIndex = 11;
523 } else if (0 == strcmp("RFoot_FSR_CenterOfPressure_Y", key)) {
524 varIndex = 12;
525 } else if (0 == strcmp("RFoot_FSR_TotalWeight", key)) {
526 varIndex = 13;
527 } else if (0 == strcmp("LFoot_Bumper_Left", key)) {
528 varIndex = 14;
529 } else if (0 == strcmp("LFoot_Bumper_Right", key)) {
530 varIndex = 15;
531 } else if (0 == strcmp("RFoot_Bumper_Left", key)) {
532 varIndex = 16;
533 } else if (0 == strcmp("RFoot_Bumper_Right", key)) {
534 varIndex = 17;
535 } else {
536 varIndex = -1;
537 }
538 }
539 switch (varIndex) {
540 case -1: { break; }
541 case 0:
542 {
543 self->LFoot_FSR_FrontLeft = ((float)atof(var_str));
544 break;
545 }
546 case 1:
547 {
548 self->LFoot_FSR_FrontRight = ((float)atof(var_str));
549 break;
550 }
551 case 2:
552 {
553 self->LFoot_FSR_RearLeft = ((float)atof(var_str));
554 break;
555 }
556 case 3:
557 {
558 self->LFoot_FSR_RearRight = ((float)atof(var_str));
559 break;
560 }
561 case 4:
562 {
563 self->LFoot_FSR_CenterOfPressure_X = ((float)atof(var_str));
564 break;
565 }
566 case 5:
567 {
568 self->LFoot_FSR_CenterOfPressure_Y = ((float)atof(var_str));
569 break;
570 }
571 case 6:
572 {
573 self->LFoot_FSR_TotalWeight = ((float)atof(var_str));
574 break;
575 }
576 case 7:
577 {
578 self->RFoot_FSR_FrontLeft = ((float)atof(var_str));
579 break;
580 }
581 case 8:
582 {
583 self->RFoot_FSR_FrontRight = ((float)atof(var_str));
584 break;
585 }
586 case 9:
587 {
588 self->RFoot_FSR_RearLeft = ((float)atof(var_str));
589 break;
590 }
591 case 10:
592 {
593 self->RFoot_FSR_RearRight = ((float)atof(var_str));
594 break;
595 }
596 case 11:
597 {
598 self->RFoot_FSR_CenterOfPressure_X = ((float)atof(var_str));
599 break;
600 }
601 case 12:
602 {
603 self->RFoot_FSR_CenterOfPressure_Y = ((float)atof(var_str));
604 break;
605 }
606 case 13:
607 {
608 self->RFoot_FSR_TotalWeight = ((float)atof(var_str));
609 break;
610 }
611 case 14:
612 {
613 self->LFoot_Bumper_Left = strcmp(var_str, "true") == 0 || strcmp(var_str, "1") == 0;
614 break;
615 }
616 case 15:
617 {
618 self->LFoot_Bumper_Right = strcmp(var_str, "true") == 0 || strcmp(var_str, "1") == 0;
619 break;
620 }
621 case 16:
622 {
623 self->RFoot_Bumper_Left = strcmp(var_str, "true") == 0 || strcmp(var_str, "1") == 0;
624 break;
625 }
626 case 17:
627 {
628 self->RFoot_Bumper_Right = strcmp(var_str, "true") == 0 || strcmp(var_str, "1") == 0;
629 break;
630 }
631 }
632 if (varIndex >= 0) {
633 varIndex++;
634 }
635 } while(index < length);
636 return self;
637}
638
639/*#ifdef WHITEBOARD_SERIALISATION*/
640
645{
646 uint16_t bit_offset = 0;
647 //The class generator does not support float types for network conversion.
648
649 //The class generator does not support float types for network conversion.
650
651 //The class generator does not support float types for network conversion.
652
653 //The class generator does not support float types for network conversion.
654
655 //The class generator does not support float types for network conversion.
656
657 //The class generator does not support float types for network conversion.
658
659 //The class generator does not support float types for network conversion.
660
661 //The class generator does not support float types for network conversion.
662
663 //The class generator does not support float types for network conversion.
664
665 //The class generator does not support float types for network conversion.
666
667 //The class generator does not support float types for network conversion.
668
669 //The class generator does not support float types for network conversion.
670
671 //The class generator does not support float types for network conversion.
672
673 //The class generator does not support float types for network conversion.
674
675 do {
676 uint16_t byte = bit_offset / 8;
677 uint16_t bit = 7 - (bit_offset % 8);
678 unsigned long newbit = !!(self->LFoot_Bumper_Left ? 1U : 0U);
679 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
680 bit_offset = bit_offset + 1;
681 } while(false);
682
683 do {
684 uint16_t byte = bit_offset / 8;
685 uint16_t bit = 7 - (bit_offset % 8);
686 unsigned long newbit = !!(self->LFoot_Bumper_Right ? 1U : 0U);
687 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
688 bit_offset = bit_offset + 1;
689 } while(false);
690
691 do {
692 uint16_t byte = bit_offset / 8;
693 uint16_t bit = 7 - (bit_offset % 8);
694 unsigned long newbit = !!(self->RFoot_Bumper_Left ? 1U : 0U);
695 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
696 bit_offset = bit_offset + 1;
697 } while(false);
698
699 do {
700 uint16_t byte = bit_offset / 8;
701 uint16_t bit = 7 - (bit_offset % 8);
702 unsigned long newbit = !!(self->RFoot_Bumper_Right ? 1U : 0U);
703 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
704 bit_offset = bit_offset + 1;
705 } while(false);
706 //avoid unused variable warnings when you try to use an empty gen file or a gen file with no supported serialisation types.
707 (void)self;
708 (void)dst;
709 return bit_offset;
710}
711
716{
717 uint16_t bit_offset = 0;
718 //The class generator does not support float types for network conversion.
719
720 //The class generator does not support float types for network conversion.
721
722 //The class generator does not support float types for network conversion.
723
724 //The class generator does not support float types for network conversion.
725
726 //The class generator does not support float types for network conversion.
727
728 //The class generator does not support float types for network conversion.
729
730 //The class generator does not support float types for network conversion.
731
732 //The class generator does not support float types for network conversion.
733
734 //The class generator does not support float types for network conversion.
735
736 //The class generator does not support float types for network conversion.
737
738 //The class generator does not support float types for network conversion.
739
740 //The class generator does not support float types for network conversion.
741
742 //The class generator does not support float types for network conversion.
743
744 //The class generator does not support float types for network conversion.
745
746 do {
747 uint16_t byte = bit_offset / 8;
748 uint16_t bit = 7 - (bit_offset % 8);
749 char dataByte = src[byte];
750 unsigned char bitValue = (dataByte >> bit) & 1U;
751 dst->LFoot_Bumper_Left = bitValue != 0;
752 bit_offset = bit_offset + 1;
753 } while(false);
754
755 do {
756 uint16_t byte = bit_offset / 8;
757 uint16_t bit = 7 - (bit_offset % 8);
758 char dataByte = src[byte];
759 unsigned char bitValue = (dataByte >> bit) & 1U;
760 dst->LFoot_Bumper_Right = bitValue != 0;
761 bit_offset = bit_offset + 1;
762 } while(false);
763
764 do {
765 uint16_t byte = bit_offset / 8;
766 uint16_t bit = 7 - (bit_offset % 8);
767 char dataByte = src[byte];
768 unsigned char bitValue = (dataByte >> bit) & 1U;
769 dst->RFoot_Bumper_Left = bitValue != 0;
770 bit_offset = bit_offset + 1;
771 } while(false);
772
773 do {
774 uint16_t byte = bit_offset / 8;
775 uint16_t bit = 7 - (bit_offset % 8);
776 char dataByte = src[byte];
777 unsigned char bitValue = (dataByte >> bit) & 1U;
778 dst->RFoot_Bumper_Right = bitValue != 0;
779 bit_offset = bit_offset + 1;
780 } while(false);
781 //avoid unused variable warnings when you try to use an empty gen file or a gen file with no supported serialisation types.
782 (void)src;
783 (void)dst;
784 return bit_offset;
785}
786
787/*#endif // WHITEBOARD_SERIALISATION*/
WHITEBOARD_POSTER_STRING_CONVERSION.
bool LFoot_Bumper_Left
left bumper on the left foot (on / off)
bool LFoot_Bumper_Right
right bumper on the left foot (on / off)
bool RFoot_Bumper_Right
right bumper on the right foot (on / off)
bool RFoot_Bumper_Left
left bumper on the right foot (on / off)
const char * wb_sensors_foot_sensors_to_string(const struct wb_sensors_foot_sensors *self, char *toString, size_t bufferSize)
Convert to a string.
size_t wb_sensors_foot_sensors_from_network_serialised(const char *src, struct wb_sensors_foot_sensors *dst)
Convert from a compressed, serialised, network byte order byte stream.
const char * wb_sensors_foot_sensors_description(const struct wb_sensors_foot_sensors *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_sensors_foot_sensors * wb_sensors_foot_sensors_from_string(struct wb_sensors_foot_sensors *self, const char *str)
Convert from a string.
size_t wb_sensors_foot_sensors_to_network_serialised(const struct wb_sensors_foot_sensors *self, char *dst)
Convert to a compressed, serialised, network byte order byte stream.
#define SENSORS_FOOT_SENSORS_DESC_BUFFER_SIZE