Vuo 2.4.4
Loading...
Searching...
No Matches
VuoOscOutputDevice.c
Go to the documentation of this file.
1
10#include "VuoOscOutputDevice.h"
11
13#ifdef VUO_COMPILER
15 "title" : "OSC Output Device",
16 "description" : "Information about an OSC output device.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoInteger",
21 "VuoText"
22 ]
23 });
24#endif
26
39{
40 return (VuoOscOutputDevice){
41 VuoJson_getObjectValue(VuoText, js, "name", NULL),
42 VuoJson_getObjectValue(VuoText, js, "ipAddress", NULL),
44 };
45}
46
51{
52 json_object *js = json_object_new_object();
53
54 if (value.name)
55 json_object_object_add(js, "name", VuoText_getJson(value.name));
56
57 if (value.ipAddress)
58 json_object_object_add(js, "ipAddress", VuoText_getJson(value.ipAddress));
59
60 json_object_object_add(js, "port", VuoInteger_getJson(value.port));
61
62 return js;
63}
64
69{
70 const char *nameOrDefault = value.name ? value.name : "Vuo OSC Client";
71
72 if (value.ipAddress && value.port)
73 return VuoText_format("<code>%s</code><br>sending to %s on port %lld", nameOrDefault, value.ipAddress, value.port);
74 else if (value.ipAddress)
75 return VuoText_format("<code>%s</code><br>sending to %s on an automatically-selected port", nameOrDefault, value.ipAddress);
76 else if (value.port)
77 return VuoText_format("<code>%s</code><br>broadcasting on port %lld", nameOrDefault, value.port);
78 else
79 return VuoText_format("<code>%s</code><br>broadcasting on an automatically-selected port", nameOrDefault);
80}
81
86{
87 return (VuoOscOutputDevice){name, NULL, VuoInteger_clamp(port, 0, 65535)};
88}
89
94{
95 return (VuoOscOutputDevice){name, ipAddress, VuoInteger_clamp(port, 0, 65535)};
96}
97
103{
104 if (!VuoText_areEqual(a.name, b.name))
105 return false;
106
107 if (!VuoText_areEqual(a.ipAddress, b.ipAddress))
108 return false;
109
110 if (a.port != b.port)
111 return false;
112
113 return true;
114}
115
120{
121 VuoType_returnInequality(VuoText, a.name, b.name);
122 VuoType_returnInequality(VuoText, a.ipAddress, b.ipAddress);
123 VuoType_returnInequality(VuoInteger, a.port, b.port);
124 return false;
125}