Vuo  2.4.0
VuoHidControl.c
Go to the documentation of this file.
1
10#include "type.h"
11#include "VuoHidControl.h"
12
14#ifdef VUO_COMPILER
16 "title" : "HID Control",
17 "description" : "Information about a control on a USB HID device.",
18 "keywords" : [ ],
19 "version" : "1.0.0",
20 "dependencies" : [
21 "VuoInteger",
22 "VuoText"
23 ]
24 });
25#endif
27
41{
42 return (VuoHidControl){
43 VuoJson_getObjectValue(VuoText, js, "name", NULL),
44 VuoJson_getObjectValue(VuoInteger, js, "value", 0),
47 };
48}
49
54{
55 json_object *js = json_object_new_object();
56
57 if (value.name)
58 {
60 json_object_object_add(js, "name", o);
61 }
62
63 if (value.value)
64 {
66 json_object_object_add(js, "value", o);
67 }
68
69 if (value.min)
70 {
72 json_object_object_add(js, "min", o);
73 }
74
75 if (value.max)
76 {
78 json_object_object_add(js, "max", o);
79 }
80
81 return js;
82}
83
87bool VuoHidControl_areEqual(const VuoHidControl valueA, const VuoHidControl valueB)
88{
89 if (!VuoText_areEqual(valueA.name, valueB.name))
90 return false;
91
92 if (!VuoInteger_areEqual(valueA.value, valueB.value))
93 return false;
94
95 if (!VuoInteger_areEqual(valueA.min, valueB.min))
96 return false;
97
98 if (!VuoInteger_areEqual(valueA.max, valueB.max))
99 return false;
100
101 return true;
102}
103
108{
113 return false;
114}
115
120{
121 if (value.name)
122 return VuoText_format("%s = %lld", value.name, value.value);
123 else
124 return strdup("No control");
125}