Vuo
2.4.4
Loading...
Searching...
No Matches
node
vuo.serial
VuoParity.c
Go to the documentation of this file.
1
10
#include "
VuoParity.h
"
11
13
#ifdef VUO_COMPILER
14
VuoModuleMetadata
({
15
"title"
:
"Parity"
,
16
"description"
:
"Whether to include an error detection bit, and how to use it."
,
17
"keywords"
: [ ],
18
"version"
:
"1.0.0"
,
19
"dependencies"
: [
20
"VuoList_VuoParity"
21
]
22
});
23
#endif
25
33
VuoParity
VuoParity_makeFromJson
(json_object *js)
34
{
35
const
char
*valueAsString =
""
;
36
if
(json_object_get_type(js) == json_type_string)
37
valueAsString = json_object_get_string(js);
38
39
VuoParity
value = VuoParity_None;
40
41
if
(strcmp(valueAsString,
"even"
) == 0)
42
value = VuoParity_Even;
43
else
if
(strcmp(valueAsString,
"odd"
) == 0)
44
value = VuoParity_Odd;
45
46
return
value;
47
}
48
52
json_object *
VuoParity_getJson
(
const
VuoParity
value)
53
{
54
char
*valueAsString =
"none"
;
55
56
if
(value == VuoParity_Even)
57
valueAsString =
"even"
;
58
else
if
(value == VuoParity_Odd)
59
valueAsString =
"odd"
;
60
61
return
json_object_new_string(valueAsString);
62
}
63
67
VuoList_VuoParity
VuoParity_getAllowedValues
(
void
)
68
{
69
VuoList_VuoParity
l =
VuoListCreate_VuoParity
();
70
VuoListAppendValue_VuoParity
(l, VuoParity_None);
71
VuoListAppendValue_VuoParity
(l, VuoParity_Even);
72
VuoListAppendValue_VuoParity
(l, VuoParity_Odd);
73
return
l;
74
}
75
79
char
*
VuoParity_getSummary
(
const
VuoParity
value)
80
{
81
char
*valueAsString =
"None"
;
82
83
if
(value == VuoParity_Even)
84
valueAsString =
"Even"
;
85
else
if
(value == VuoParity_Odd)
86
valueAsString =
"Odd"
;
87
88
return
strdup(valueAsString);
89
}
90
94
bool
VuoParity_areEqual
(
const
VuoParity
valueA,
const
VuoParity
valueB)
95
{
96
return
valueA == valueB;
97
}
98
102
bool
VuoParity_isLessThan
(
const
VuoParity
valueA,
const
VuoParity
valueB)
103
{
104
return
valueA < valueB;
105
}
Generated on Thu Nov 9 2023 16:59:30 for Vuo by
1.9.8