• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OpenLightingProject / ola / 16900099157

12 Aug 2025 05:43AM UTC coverage: 45.72% (-0.02%) from 45.742%
16900099157

Pull #2016

github

web-flow
Merge c368ef6ae into eaf937e80
Pull Request #2016: Bump actions/checkout from 4 to 5

7586 of 17462 branches covered (43.44%)

22424 of 49046 relevant lines covered (45.72%)

51.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/usbdmx/DMXCProjectsNodleU1Factory.cpp
1
/*
2
 * This program is free software; you can redistribute it and/or modify
3
 * it under the terms of the GNU General Public License as published by
4
 * the Free Software Foundation; either version 2 of the License, or
5
 * (at your option) any later version.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU Library General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15
 *
16
 * DMXCProjectsNodleU1Factory.cpp
17
 * The WidgetFactory for Nodle widgets.
18
 * Copyright (C) 2015 Stefan Krupop
19
 */
20

21
#include "plugins/usbdmx/DMXCProjectsNodleU1Factory.h"
22

23
#include "ola/Logging.h"
24
#include "ola/base/Flags.h"
25
#include "plugins/usbdmx/DMXCProjectsNodleU1.h"
26

27
DECLARE_bool(use_async_libusb);
28

29
namespace ola {
30
namespace plugin {
31
namespace usbdmx {
32

33
const uint16_t DMXCProjectsNodleU1Factory::VENDOR_ID_DMXC_PROJECTS = 0x16d0;
34
const uint16_t DMXCProjectsNodleU1Factory::PRODUCT_ID_DMXC_P_NODLE_U1 = 0x0830;
35
const uint16_t DMXCProjectsNodleU1Factory::PRODUCT_ID_DMXC_P_NODLE_R4S = 0x0833;
36

37
const uint16_t DMXCProjectsNodleU1Factory::VENDOR_ID_DE = 0x4b4;
38
const uint16_t DMXCProjectsNodleU1Factory::PRODUCT_ID_DE_USB_DMX = 0xf1f;
39

40
const uint16_t DMXCProjectsNodleU1Factory::VENDOR_ID_FX5 = 0x16c0;
41
const uint16_t DMXCProjectsNodleU1Factory::PRODUCT_ID_FX5_DMX = 0x88b;
42

43
bool DMXCProjectsNodleU1Factory::DeviceAdded(
×
44
    WidgetObserver *observer,
45
    libusb_device *usb_device,
46
    const struct libusb_device_descriptor &descriptor) {
47
  if (!((descriptor.idVendor == VENDOR_ID_DMXC_PROJECTS &&
×
48
         descriptor.idProduct == PRODUCT_ID_DMXC_P_NODLE_U1) ||
×
49
        (descriptor.idVendor == VENDOR_ID_DMXC_PROJECTS &&
50
         descriptor.idProduct == PRODUCT_ID_DMXC_P_NODLE_R4S) ||
×
51
        (descriptor.idVendor == VENDOR_ID_DE &&
×
52
         descriptor.idProduct == PRODUCT_ID_DE_USB_DMX) ||
×
53
        (descriptor.idVendor == VENDOR_ID_FX5 &&
×
54
         descriptor.idProduct == PRODUCT_ID_FX5_DMX) )) {
×
55
    return false;
56
  }
57

58
  OLA_INFO << "Found a new Nodle U1 device";
×
59
  ola::usb::LibUsbAdaptor::DeviceInformation info;
×
60
  if (!m_adaptor->GetDeviceInfo(usb_device, descriptor, &info)) {
×
61
    return false;
62
  }
63

64
  OLA_INFO << "Nodle U1 serial: " << info.serial;
×
65

66
  if (m_preferences->SetDefaultValue(
×
67
      "nodle-" + info.serial + "-mode",
×
68
      UIntValidator(DMXCProjectsNodleU1::NODLE_MIN_MODE,
×
69
                    DMXCProjectsNodleU1::NODLE_MAX_MODE),
×
70
      DMXCProjectsNodleU1::NODLE_DEFAULT_MODE)) {
71
    m_preferences->Save();
×
72
  }
73

74
  unsigned int mode;
×
75
  if (!StringToInt(m_preferences->GetValue("nodle-" + info.serial + "-mode"),
×
76
                   &mode)) {
77
    mode = DMXCProjectsNodleU1::NODLE_DEFAULT_MODE;
×
78
  }
79

80
  OLA_INFO << "Setting Nodle U1 mode to " << mode;
×
81

82
  DMXCProjectsNodleU1 *widget = NULL;
×
83
  if (FLAGS_use_async_libusb) {
×
84
    widget = new AsynchronousDMXCProjectsNodleU1(m_adaptor, usb_device,
×
85
                                                 m_plugin_adaptor, info.serial,
×
86
                                                 mode);
×
87
  } else {
88
    widget = new SynchronousDMXCProjectsNodleU1(m_adaptor, usb_device,
×
89
                                                m_plugin_adaptor, info.serial,
×
90
                                                mode);
×
91
  }
92
  return AddWidget(observer, widget);
×
93
}
×
94
}  // namespace usbdmx
95
}  // namespace plugin
96
}  // namespace ola
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc