Vuo
2.0.2
type
inputEditor
VuoInputEditorSerialDevice
VuoInputEditorSerialDevice.cc
Go to the documentation of this file.
1
10
#include "
VuoInputEditorSerialDevice.hh
"
11
12
extern
"C"
13
{
14
#include "
VuoSerial.h
"
15
}
16
20
VuoInputEditor
*
VuoInputEditorSerialDeviceFactory::newInputEditor
()
21
{
22
return
new
VuoInputEditorSerialDevice
();
23
}
24
28
VuoInputEditorMenuItem
*
VuoInputEditorSerialDevice::setUpMenuTree
()
29
{
30
VuoInputEditorMenuItem
*optionsTree =
new
VuoInputEditorMenuItem
(
"root"
);
31
32
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
"First available device"
, NULL));
33
optionsTree->
addSeparator
();
34
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
"Specific device (by name)"
, NULL, NULL,
false
));
35
36
VuoList_VuoSerialDevice
devices =
VuoSerial_getDeviceList
();
37
unsigned
long
deviceCount =
VuoListGetCount_VuoSerialDevice
(devices);
38
39
if
(deviceCount)
40
for
(
unsigned
long
i = 1; i <= deviceCount; ++i)
41
{
42
VuoSerialDevice
device =
VuoListGetValue_VuoSerialDevice
(devices, i);
43
device.
matchType
= VuoSerialDevice_MatchName;
44
device.
path
= NULL;
45
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
VuoText_format
(
" %s"
, device.
name
),
VuoSerialDevice_getJson
(device)));
46
}
47
else
48
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
" (no devices found)"
, NULL, NULL,
false
));
49
50
optionsTree->
addSeparator
();
51
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
"Specific device (by path)"
, NULL, NULL,
false
));
52
53
if
(deviceCount)
54
for
(
unsigned
long
i = 1; i <= deviceCount; ++i)
55
{
56
VuoSerialDevice
device =
VuoListGetValue_VuoSerialDevice
(devices, i);
57
device.
matchType
= VuoSerialDevice_MatchPath;
58
device.
name
= NULL;
59
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
VuoText_format
(
" %s"
, device.
path
),
VuoSerialDevice_getJson
(device)));
60
}
61
else
62
optionsTree->
addItem
(
new
VuoInputEditorMenuItem
(
" (no devices found)"
, NULL, NULL,
false
));
63
64
return
optionsTree;
65
}
Generated on Thu Mar 19 2020 23:16:03 for Vuo by
1.8.17