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

OpenLightingProject / ola / 16911433572

12 Aug 2025 02:08PM UTC coverage: 45.869% (-0.04%) from 45.909%
16911433572

Pull #1739

github

web-flow
Merge 02faeaa2d into 3566c28d9
Pull Request #1739: New web UI, store highest channel number used

7157 of 16316 branches covered (43.86%)

20915 of 45597 relevant lines covered (45.87%)

52.03 hits per line

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

76.92
/plugins/shownet/ShowNetPlugin.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
 * ShowNetPlugin.cpp
17
 * The ShowNet plugin for ola
18
 * Copyright (C) 2005 Simon Newton
19
 */
20

21
#include <string>
22
#include "olad/PluginAdaptor.h"
23
#include "olad/Preferences.h"
24
#include "plugins/shownet/ShowNetDevice.h"
25
#include "plugins/shownet/ShowNetPlugin.h"
26

27

28
namespace ola {
29
namespace plugin {
30
namespace shownet {
31

32
using std::string;
33

34
const char ShowNetPlugin::SHOWNET_NODE_NAME[] = "ola-ShowNet";
35
const char ShowNetPlugin::PLUGIN_NAME[] = "ShowNet";
36
const char ShowNetPlugin::PLUGIN_PREFIX[] = "shownet";
37
const char ShowNetPlugin::SHOWNET_NAME_KEY[] = "name";
38

39
/*
40
 * Start the plugin
41
 */
42
bool ShowNetPlugin::StartHook() {
1✔
43
  m_device = new ShowNetDevice(this, m_preferences, m_plugin_adaptor);
1✔
44

45
  if (!m_device->Start()) {
1✔
46
    delete m_device;
×
47
    return false;
×
48
  }
49

50
  m_plugin_adaptor->RegisterDevice(m_device);
1✔
51
  return true;
1✔
52
}
53

54

55
/*
56
 * Stop the plugin
57
 * @return true on success, false on failure
58
 */
59
bool ShowNetPlugin::StopHook() {
1✔
60
  if (m_device) {
1✔
61
    m_plugin_adaptor->UnregisterDevice(m_device);
1✔
62
    bool ret = m_device->Stop();
1✔
63
    delete m_device;
1✔
64
    return ret;
1✔
65
  }
66
  return true;
67
}
68

69

70
/*
71
 * return the description for this plugin
72
 *
73
 */
74
string ShowNetPlugin::Description() const {
×
75
  return
×
76
"Strand ShowNet Plugin\n"
×
77
"----------------------------\n"
78
"\n"
79
"This plugin creates a single device with 8 input and 8 output ports.\n"
80
"\n"
81
"The ports correspond to the DMX channels used in the shownet protocol.\n"
82
"For example the first input and output port 0 is channels 1 - 512 and\n"
83
"the second input and output ports are channels 513 - 1024.\n"
84
"\n"
85
"--- Config file : ola-shownet.conf ---\n"
86
"\n"
87
"ip = [a.b.c.d|<interface_name>]\n"
88
"The ip address or interface name to bind to. If not specified it will\n"
89
"use the first non-loopback interface.\n"
90
"\n"
91
"name = ola-ShowNet\n"
92
"The name of the node.\n"
93
"\n";
×
94
}
95

96

97
/*
98
 * Set default preferences
99
 */
100
bool ShowNetPlugin::SetDefaultPreferences() {
1✔
101
  if (!m_preferences) {
1✔
102
    return false;
103
  }
104

105
  bool save = false;
1✔
106

107
  save |= m_preferences->SetDefaultValue(ShowNetDevice::IP_KEY,
1✔
108
                                         StringValidator(true), "");
1✔
109
  save |= m_preferences->SetDefaultValue(SHOWNET_NAME_KEY, StringValidator(),
1✔
110
                                         SHOWNET_NODE_NAME);
111

112
  if (save) {
1✔
113
    m_preferences->Save();
1✔
114
  }
115

116
  if (m_preferences->GetValue(SHOWNET_NAME_KEY).empty()) {
1✔
117
    return false;
118
  }
119
  return true;
120
}
121
}  // namespace shownet
122
}  // namespace plugin
123
}  // 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