gusimplewhiteboard
wb_vision_detection_goal_post.c
Go to the documentation of this file.
1/*
2 * file wb_vision_detection_goal_post.c
3 *
4 * This file was generated by classgenerator from vision_detection_goal_post.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_vision_detection_goal_post_description(const struct wb_vision_detection_goal_post* 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 switch (self->sightingType) {
134 case FullPostSeen:
135 {
136 len += snprintf(descString + len, bufferSize - len, "sightingType=FullPostSeen");
137 break;
138 }
139 case NoPostDetected:
140 {
141 len += snprintf(descString + len, bufferSize - len, "sightingType=NoPostDetected");
142 break;
143 }
144 case PartialPostSeen:
145 {
146 len += snprintf(descString + len, bufferSize - len, "sightingType=PartialPostSeen");
147 break;
148 }
149 }
150 if (len >= bufferSize) {
151 return descString;
152 }
153 len = gu_strlcat(descString, ", ", bufferSize);
154 if (len >= bufferSize) {
155 return descString;
156 }
157 switch (self->orientation) {
158 case GenericPost:
159 {
160 len += snprintf(descString + len, bufferSize - len, "orientation=GenericPost");
161 break;
162 }
163 case LeftPost:
164 {
165 len += snprintf(descString + len, bufferSize - len, "orientation=LeftPost");
166 break;
167 }
168 case RightPost:
169 {
170 len += snprintf(descString + len, bufferSize - len, "orientation=RightPost");
171 break;
172 }
173 }
174 if (len >= bufferSize) {
175 return descString;
176 }
177 len = gu_strlcat(descString, ", ", bufferSize);
178 if (len >= bufferSize) {
179 return descString;
180 }
181 len = gu_strlcat(descString, "topLeftCoordinate={", bufferSize);
182 if (len >= bufferSize) {
183 return descString;
184 }
185 char topLeftCoordinate_buffer[PIXEL_COORDINATE_DESC_BUFFER_SIZE];
186 char* topLeftCoordinate_p = topLeftCoordinate_buffer;
187 const char* topLeftCoordinate_description = wb_pixel_coordinate_description(&self->topLeftCoordinate, topLeftCoordinate_p, PIXEL_COORDINATE_DESC_BUFFER_SIZE);
188 len = gu_strlcat(descString, topLeftCoordinate_p, bufferSize);
189 if (len >= bufferSize) {
190 return descString;
191 }
192 len = gu_strlcat(descString, "}", bufferSize);
193 if (len >= bufferSize) {
194 return descString;
195 }
196 len = gu_strlcat(descString, ", ", bufferSize);
197 if (len >= bufferSize) {
198 return descString;
199 }
200 len = gu_strlcat(descString, "topRightCoordinate={", bufferSize);
201 if (len >= bufferSize) {
202 return descString;
203 }
204 char topRightCoordinate_buffer[PIXEL_COORDINATE_DESC_BUFFER_SIZE];
205 char* topRightCoordinate_p = topRightCoordinate_buffer;
206 const char* topRightCoordinate_description = wb_pixel_coordinate_description(&self->topRightCoordinate, topRightCoordinate_p, PIXEL_COORDINATE_DESC_BUFFER_SIZE);
207 len = gu_strlcat(descString, topRightCoordinate_p, bufferSize);
208 if (len >= bufferSize) {
209 return descString;
210 }
211 len = gu_strlcat(descString, "}", bufferSize);
212 if (len >= bufferSize) {
213 return descString;
214 }
215 len = gu_strlcat(descString, ", ", bufferSize);
216 if (len >= bufferSize) {
217 return descString;
218 }
219 len = gu_strlcat(descString, "bottomLeftCoordinate={", bufferSize);
220 if (len >= bufferSize) {
221 return descString;
222 }
223 char bottomLeftCoordinate_buffer[PIXEL_COORDINATE_DESC_BUFFER_SIZE];
224 char* bottomLeftCoordinate_p = bottomLeftCoordinate_buffer;
225 const char* bottomLeftCoordinate_description = wb_pixel_coordinate_description(&self->bottomLeftCoordinate, bottomLeftCoordinate_p, PIXEL_COORDINATE_DESC_BUFFER_SIZE);
226 len = gu_strlcat(descString, bottomLeftCoordinate_p, bufferSize);
227 if (len >= bufferSize) {
228 return descString;
229 }
230 len = gu_strlcat(descString, "}", bufferSize);
231 if (len >= bufferSize) {
232 return descString;
233 }
234 len = gu_strlcat(descString, ", ", bufferSize);
235 if (len >= bufferSize) {
236 return descString;
237 }
238 len = gu_strlcat(descString, "bottomRightCoordinate={", bufferSize);
239 if (len >= bufferSize) {
240 return descString;
241 }
242 char bottomRightCoordinate_buffer[PIXEL_COORDINATE_DESC_BUFFER_SIZE];
243 char* bottomRightCoordinate_p = bottomRightCoordinate_buffer;
244 const char* bottomRightCoordinate_description = wb_pixel_coordinate_description(&self->bottomRightCoordinate, bottomRightCoordinate_p, PIXEL_COORDINATE_DESC_BUFFER_SIZE);
245 len = gu_strlcat(descString, bottomRightCoordinate_p, bufferSize);
246 if (len >= bufferSize) {
247 return descString;
248 }
249 len = gu_strlcat(descString, "}", bufferSize);
250 return descString;
251#pragma clang diagnostic pop
252}
253
257const char* wb_vision_detection_goal_post_to_string(const struct wb_vision_detection_goal_post* self, char* toString, size_t bufferSize)
258{
259#pragma clang diagnostic push
260#pragma clang diagnostic ignored "-Wunused-variable"
261 size_t len = 0;
262 if (len >= bufferSize) {
263 return toString;
264 }
265 switch (self->sightingType) {
266 case FullPostSeen:
267 {
268 len += snprintf(toString + len, bufferSize - len, "FullPostSeen");
269 break;
270 }
271 case NoPostDetected:
272 {
273 len += snprintf(toString + len, bufferSize - len, "NoPostDetected");
274 break;
275 }
276 case PartialPostSeen:
277 {
278 len += snprintf(toString + len, bufferSize - len, "PartialPostSeen");
279 break;
280 }
281 }
282 if (len >= bufferSize) {
283 return toString;
284 }
285 len = gu_strlcat(toString, ", ", bufferSize);
286 if (len >= bufferSize) {
287 return toString;
288 }
289 switch (self->orientation) {
290 case GenericPost:
291 {
292 len += snprintf(toString + len, bufferSize - len, "GenericPost");
293 break;
294 }
295 case LeftPost:
296 {
297 len += snprintf(toString + len, bufferSize - len, "LeftPost");
298 break;
299 }
300 case RightPost:
301 {
302 len += snprintf(toString + len, bufferSize - len, "RightPost");
303 break;
304 }
305 }
306 if (len >= bufferSize) {
307 return toString;
308 }
309 len = gu_strlcat(toString, ", ", bufferSize);
310 if (len >= bufferSize) {
311 return toString;
312 }
313 len = gu_strlcat(toString, "{", bufferSize);
314 if (len >= bufferSize) {
315 return toString;
316 }
317 char topLeftCoordinate_buffer[PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE];
318 char* topLeftCoordinate_p = topLeftCoordinate_buffer;
319 const char* topLeftCoordinate_to_string = wb_pixel_coordinate_to_string(&self->topLeftCoordinate, topLeftCoordinate_p, PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE);
320 len = gu_strlcat(toString, topLeftCoordinate_p, bufferSize);
321 if (len >= bufferSize) {
322 return toString;
323 }
324 len = gu_strlcat(toString, "}", bufferSize);
325 if (len >= bufferSize) {
326 return toString;
327 }
328 len = gu_strlcat(toString, ", ", bufferSize);
329 if (len >= bufferSize) {
330 return toString;
331 }
332 len = gu_strlcat(toString, "{", bufferSize);
333 if (len >= bufferSize) {
334 return toString;
335 }
336 char topRightCoordinate_buffer[PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE];
337 char* topRightCoordinate_p = topRightCoordinate_buffer;
338 const char* topRightCoordinate_to_string = wb_pixel_coordinate_to_string(&self->topRightCoordinate, topRightCoordinate_p, PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE);
339 len = gu_strlcat(toString, topRightCoordinate_p, bufferSize);
340 if (len >= bufferSize) {
341 return toString;
342 }
343 len = gu_strlcat(toString, "}", bufferSize);
344 if (len >= bufferSize) {
345 return toString;
346 }
347 len = gu_strlcat(toString, ", ", bufferSize);
348 if (len >= bufferSize) {
349 return toString;
350 }
351 len = gu_strlcat(toString, "{", bufferSize);
352 if (len >= bufferSize) {
353 return toString;
354 }
355 char bottomLeftCoordinate_buffer[PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE];
356 char* bottomLeftCoordinate_p = bottomLeftCoordinate_buffer;
357 const char* bottomLeftCoordinate_to_string = wb_pixel_coordinate_to_string(&self->bottomLeftCoordinate, bottomLeftCoordinate_p, PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE);
358 len = gu_strlcat(toString, bottomLeftCoordinate_p, bufferSize);
359 if (len >= bufferSize) {
360 return toString;
361 }
362 len = gu_strlcat(toString, "}", bufferSize);
363 if (len >= bufferSize) {
364 return toString;
365 }
366 len = gu_strlcat(toString, ", ", bufferSize);
367 if (len >= bufferSize) {
368 return toString;
369 }
370 len = gu_strlcat(toString, "{", bufferSize);
371 if (len >= bufferSize) {
372 return toString;
373 }
374 char bottomRightCoordinate_buffer[PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE];
375 char* bottomRightCoordinate_p = bottomRightCoordinate_buffer;
376 const char* bottomRightCoordinate_to_string = wb_pixel_coordinate_to_string(&self->bottomRightCoordinate, bottomRightCoordinate_p, PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE);
377 len = gu_strlcat(toString, bottomRightCoordinate_p, bufferSize);
378 if (len >= bufferSize) {
379 return toString;
380 }
381 len = gu_strlcat(toString, "}", bufferSize);
382 return toString;
383#pragma clang diagnostic pop
384}
385
390{
391 size_t temp_length = strlen(str);
392 int length = (temp_length <= INT_MAX) ? ((int)((ssize_t)temp_length)) : -1;
393 if (length < 1 || length > VISION_DETECTION_GOAL_POST_DESC_BUFFER_SIZE) {
394 return self;
395 }
396 char var_str_buffer[VISION_DETECTION_GOAL_POST_DESC_BUFFER_SIZE + 1];
397 char* var_str = &var_str_buffer[0];
398 char key_buffer[22];
399 char* key = &key_buffer[0];
400 int bracecount = 0;
401 int startVar = 0;
402 int index = 0;
403 int startKey = 0;
404 int endKey = -1;
405 int varIndex = 0;
406 if (index == 0 && str[0] == '{') {
407 index = 1;
408 }
409 startVar = index;
410 startKey = startVar;
411 do {
412 for (int i = index; i < length; i++) {
413 index = i + 1;
414 if (bracecount == 0 && str[i] == '=') {
415 endKey = i - 1;
416 startVar = index;
417 continue;
418 }
419 if (bracecount == 0 && isspace(str[i])) {
420 startVar = index;
421 if (endKey == -1) {
422 startKey = index;
423 }
424 continue;
425 }
426 if (bracecount == 0 && str[i] == ',') {
427 index = i - 1;
428 break;
429 }
430 if (str[i] == '{') {
431 bracecount++;
432 continue;
433 }
434 if (str[i] == '}') {
435 bracecount--;
436 if (bracecount < 0) {
437 index = i - 1;
438 break;
439 }
440 }
441 if (i == length - 1) {
442 index = i;
443 }
444 }
445 if (endKey >= startKey && endKey - startKey < length) {
446 strncpy(key, str + startKey, ((size_t)(endKey - startKey) + 1));
447 key[(endKey - startKey) + 1] = 0;
448 } else {
449 key[0] = 0;
450 }
451 strncpy(var_str, str + startVar, ((size_t)(index - startVar) + 1));
452 var_str[(index - startVar) + 1] = 0;
453 bracecount = 0;
454 index += 2;
455 startVar = index;
456 startKey = startVar;
457 endKey = -1;
458 if (strlen(key) > 0) {
459 if (0 == strcmp("sightingType", key)) {
460 varIndex = 0;
461 } else if (0 == strcmp("orientation", key)) {
462 varIndex = 1;
463 } else if (0 == strcmp("topLeftCoordinate", key)) {
464 varIndex = 2;
465 } else if (0 == strcmp("topRightCoordinate", key)) {
466 varIndex = 3;
467 } else if (0 == strcmp("bottomLeftCoordinate", key)) {
468 varIndex = 4;
469 } else if (0 == strcmp("bottomRightCoordinate", key)) {
470 varIndex = 5;
471 } else {
472 varIndex = -1;
473 }
474 }
475 switch (varIndex) {
476 case -1: { break; }
477 case 0:
478 {
479 if (strcmp("FullPostSeen", var_str) == 0) {
480#pragma clang diagnostic push
481#pragma clang diagnostic ignored "-Wbad-function-cast"
482 self->sightingType = FullPostSeen;
483#pragma clang diagnostic pop
484 } else if (strcmp("NoPostDetected", var_str) == 0) {
485#pragma clang diagnostic push
486#pragma clang diagnostic ignored "-Wbad-function-cast"
487 self->sightingType = NoPostDetected;
488#pragma clang diagnostic pop
489 } else if (strcmp("PartialPostSeen", var_str) == 0) {
490#pragma clang diagnostic push
491#pragma clang diagnostic ignored "-Wbad-function-cast"
492 self->sightingType = PartialPostSeen;
493#pragma clang diagnostic pop
494 } else {
495#pragma clang diagnostic push
496#pragma clang diagnostic ignored "-Wbad-function-cast"
497 self->sightingType = ((enum GoalPostOptions)atoi(var_str));
498#pragma clang diagnostic pop
499 }
500 break;
501 }
502 case 1:
503 {
504 if (strcmp("GenericPost", var_str) == 0) {
505#pragma clang diagnostic push
506#pragma clang diagnostic ignored "-Wbad-function-cast"
507 self->orientation = GenericPost;
508#pragma clang diagnostic pop
509 } else if (strcmp("LeftPost", var_str) == 0) {
510#pragma clang diagnostic push
511#pragma clang diagnostic ignored "-Wbad-function-cast"
512 self->orientation = LeftPost;
513#pragma clang diagnostic pop
514 } else if (strcmp("RightPost", var_str) == 0) {
515#pragma clang diagnostic push
516#pragma clang diagnostic ignored "-Wbad-function-cast"
517 self->orientation = RightPost;
518#pragma clang diagnostic pop
519 } else {
520#pragma clang diagnostic push
521#pragma clang diagnostic ignored "-Wbad-function-cast"
522 self->orientation = ((enum GoalPostOrientation)atoi(var_str));
523#pragma clang diagnostic pop
524 }
525 break;
526 }
527 case 2:
528 {
529 wb_pixel_coordinate_from_string(&self->topLeftCoordinate, var_str);
530 break;
531 }
532 case 3:
533 {
534 wb_pixel_coordinate_from_string(&self->topRightCoordinate, var_str);
535 break;
536 }
537 case 4:
538 {
539 wb_pixel_coordinate_from_string(&self->bottomLeftCoordinate, var_str);
540 break;
541 }
542 case 5:
543 {
544 wb_pixel_coordinate_from_string(&self->bottomRightCoordinate, var_str);
545 break;
546 }
547 }
548 if (varIndex >= 0) {
549 varIndex++;
550 }
551 } while(index < length);
552 return self;
553}
554
555/*#ifdef WHITEBOARD_SERIALISATION*/
556
561{
562 uint16_t bit_offset = 0;
563 enum GoalPostOptions sightingType_nbo = htonl(self->sightingType);
564 do {
565 int8_t b;
566 for (b = (32 - 1); b >= 0; b--) {
567 do {
568 uint16_t byte = bit_offset / 8;
569 uint16_t bit = 7 - (bit_offset % 8);
570 unsigned long newbit = !!((sightingType_nbo >> b) & 1U);
571 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
572 bit_offset = bit_offset + 1;
573 } while(false);
574 }
575 } while(false);
576
577 enum GoalPostOrientation orientation_nbo = htonl(self->orientation);
578 do {
579 int8_t b;
580 for (b = (32 - 1); b >= 0; b--) {
581 do {
582 uint16_t byte = bit_offset / 8;
583 uint16_t bit = 7 - (bit_offset % 8);
584 unsigned long newbit = !!((orientation_nbo >> b) & 1U);
585 dst[byte] ^= (-newbit ^ dst[byte]) & (1UL << bit);
586 bit_offset = bit_offset + 1;
587 } while(false);
588 }
589 } while(false);
590 //avoid unused variable warnings when you try to use an empty gen file or a gen file with no supported serialisation types.
591 (void)self;
592 (void)dst;
593 return bit_offset;
594}
595
600{
601 uint16_t bit_offset = 0;
602 do {
603 int8_t b;
604 for (b = (32 - 1); b >= 0; b--) {
605 do {
606 uint16_t byte = bit_offset / 8;
607 uint16_t bit = 7 - (bit_offset % 8);
608 char dataByte = src[byte];
609 unsigned char bitValue = (dataByte >> bit) & 1U;
610 dst->sightingType ^= (-bitValue ^ dst->sightingType) & (1UL << b);
611 bit_offset = bit_offset + 1;
612 } while(false);
613 }
614 } while(false);
615 dst->sightingType = ntohl(dst->sightingType);
616
617 do {
618 int8_t b;
619 for (b = (32 - 1); b >= 0; b--) {
620 do {
621 uint16_t byte = bit_offset / 8;
622 uint16_t bit = 7 - (bit_offset % 8);
623 char dataByte = src[byte];
624 unsigned char bitValue = (dataByte >> bit) & 1U;
625 dst->orientation ^= (-bitValue ^ dst->orientation) & (1UL << b);
626 bit_offset = bit_offset + 1;
627 } while(false);
628 }
629 } while(false);
630 dst->orientation = ntohl(dst->orientation);
631 //avoid unused variable warnings when you try to use an empty gen file or a gen file with no supported serialisation types.
632 (void)src;
633 (void)dst;
634 return bit_offset;
635}
636
637/*#endif // WHITEBOARD_SERIALISATION*/
638
639gu_pixel_coordinate wb_vision_detection_goal_post_topLeftCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
640{
641 return wb_px_coord_to_px_coord(self.topLeftCoordinate, resWidth, resHeight);
642}
643gu_pixel_coordinate wb_vision_detection_goal_post_topRightCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
644{
645 return wb_px_coord_to_px_coord(self.topRightCoordinate, resWidth, resHeight);
646}
647gu_pixel_coordinate wb_vision_detection_goal_post_bottomLeftCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
648{
649 return wb_px_coord_to_px_coord(self.bottomLeftCoordinate, resWidth, resHeight);
650}
651gu_pixel_coordinate wb_vision_detection_goal_post_bottomRightCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
652{
653 return wb_px_coord_to_px_coord(self.bottomRightCoordinate, resWidth, resHeight);
654}
WHITEBOARD_POSTER_STRING_CONVERSION.
struct wb_pixel_coordinate topLeftCoordinate
The top left pixel coordinate.
enum GoalPostOptions sightingType
Goal post details.
enum GoalPostOrientation orientation
Goal post orientation.
struct wb_pixel_coordinate bottomRightCoordinate
The bottom right pixel coordinate.
struct wb_pixel_coordinate bottomLeftCoordinate
The bottom left pixel coordinate.
struct wb_pixel_coordinate topRightCoordinate
The top right pixel coordinate.
const char * wb_pixel_coordinate_description(const struct wb_pixel_coordinate *self, char *descString, size_t bufferSize)
Convert to a description string.
struct wb_pixel_coordinate * wb_pixel_coordinate_from_string(struct wb_pixel_coordinate *self, const char *str)
Convert from a string.
const char * wb_pixel_coordinate_to_string(const struct wb_pixel_coordinate *self, char *toString, size_t bufferSize)
Convert to a string.
gu_pixel_coordinate wb_px_coord_to_px_coord(const struct wb_pixel_coordinate coord, const uint16_t resWidth, const uint16_t resHeight)
#define PIXEL_COORDINATE_DESC_BUFFER_SIZE
#define PIXEL_COORDINATE_TO_STRING_BUFFER_SIZE
size_t wb_vision_detection_goal_post_from_network_serialised(const char *src, struct wb_vision_detection_goal_post *dst)
Convert from a compressed, serialised, network byte order byte stream.
const char * wb_vision_detection_goal_post_to_string(const struct wb_vision_detection_goal_post *self, char *toString, size_t bufferSize)
Convert to a string.
gu_pixel_coordinate wb_vision_detection_goal_post_topRightCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
gu_pixel_coordinate wb_vision_detection_goal_post_topLeftCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
WHITEBOARD_POSTER_STRING_CONVERSION.
#define ntohl(x)
gu_pixel_coordinate wb_vision_detection_goal_post_bottomLeftCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
gu_pixel_coordinate wb_vision_detection_goal_post_bottomRightCoordinate_px_coord(const struct wb_vision_detection_goal_post self, const uint16_t resWidth, const uint16_t resHeight)
struct wb_vision_detection_goal_post * wb_vision_detection_goal_post_from_string(struct wb_vision_detection_goal_post *self, const char *str)
Convert from a string.
#define htonl(x)
size_t wb_vision_detection_goal_post_to_network_serialised(const struct wb_vision_detection_goal_post *self, char *dst)
Convert to a compressed, serialised, network byte order byte stream.
const char * wb_vision_detection_goal_post_description(const struct wb_vision_detection_goal_post *self, char *descString, size_t bufferSize)
Convert to a description string.
GoalPostOptions
@ FullPostSeen
Saw the entire post.
@ PartialPostSeen
Saw part of a post. Part in the image, part out.
@ NoPostDetected
Didn't see a post.
GoalPostOrientation
@ RightPost
This is the right post of a goal.
@ GenericPost
Could not determine post orientation.
@ LeftPost
This is the left post of a goal.
#define VISION_DETECTION_GOAL_POST_DESC_BUFFER_SIZE