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