Vuo  2.0.0
VuoInputEditorSerialDevice.cc
Go to the documentation of this file.
1 
11 
12 extern "C"
13 {
14  #include "VuoSerial.h"
15 }
16 
21 {
22  return new VuoInputEditorSerialDevice();
23 }
24 
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 
37  unsigned long deviceCount = VuoListGetCount_VuoSerialDevice(devices);
38 
39  if (deviceCount)
40  for (unsigned long i = 1; i <= deviceCount; ++i)
41  {
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  {
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 }