• 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

79.31
/plugins/sandnet/SandNetPlugin.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
 * SandNetPlugin.cpp
17
 * The SandNet plugin for ola
18
 * Copyright (C) 2005 Simon Newton
19
 */
20

21
#include <string>
22
#include "olad/Preferences.h"
23
#include "plugins/sandnet/SandNetDevice.h"
24
#include "plugins/sandnet/SandNetPlugin.h"
25

26

27
namespace ola {
28
namespace plugin {
29
namespace sandnet {
30

31
using std::string;
32

33
const char SandNetPlugin::SANDNET_NODE_NAME[] = "ola-SandNet";
34
const char SandNetPlugin::PLUGIN_NAME[] = "SandNet";
35
const char SandNetPlugin::PLUGIN_PREFIX[] = "sandnet";
36

37

38
/*
39
 * Start the plugin
40
 */
41
bool SandNetPlugin::StartHook() {
1✔
42
  m_device = new SandNetDevice(this,
2✔
43
                               m_preferences,
44
                               m_plugin_adaptor);
1✔
45

46
  if (!m_device) {
1✔
47
    return false;
48
  }
49

50
  if (!m_device->Start()) {
1✔
51
    delete m_device;
×
52
    return false;
×
53
  }
54
  m_plugin_adaptor->RegisterDevice(m_device);
1✔
55
  return true;
1✔
56
}
57

58

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

73

74
/*
75
 * Return the description for this plugin
76
 */
77
string SandNetPlugin::Description() const {
×
78
  return
×
79
"SandNet Plugin\n"
×
80
"----------------------------\n"
81
"\n"
82
"This plugin creates a single device with 2 output and 8 input ports.\n"
83
"\n"
84
"The universe bindings are offset by one from those displayed in sandnet.\n"
85
"For example, SandNet universe 1 is OLA universe 0.\n"
86
"\n"
87
"--- Config file : ola-sandnet.conf ---\n"
88
"\n"
89
"ip = [a.b.c.d|<interface_name>]\n"
90
"The ip address or interface name to bind to. If not specified it will\n"
91
"use the first non-loopback interface.\n"
92
"\n"
93
"name = ola-SandNet\n"
94
"The name of the node.\n"
95
"\n";
×
96
}
97

98

99
/*
100
 * Assign default values
101
 */
102
bool SandNetPlugin::SetDefaultPreferences() {
1✔
103
  if (!m_preferences) {
1✔
104
    return false;
105
  }
106

107
  bool save = false;
1✔
108
  save |= m_preferences->SetDefaultValue(SandNetDevice::IP_KEY,
1✔
109
                                         StringValidator(true), "");
1✔
110
  save |= m_preferences->SetDefaultValue(SandNetDevice::NAME_KEY,
1✔
111
                                         StringValidator(), SANDNET_NODE_NAME);
1✔
112

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

117
  if (m_preferences->GetValue(SandNetDevice::NAME_KEY).empty()) {
1✔
118
    return false;
119
  }
120
  return true;
121
}
122
}  // namespace sandnet
123
}  // namespace plugin
124
}  // namespace ola
125

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