• 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/espnet/EspNetPlugin.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
 * EspNetPlugin.cpp
17
 * The EspNet plugin for ola
18
 * Copyright (C) 2005 Simon Newton
19
 */
20

21
#include <string>
22
#include "olad/Preferences.h"
23
#include "plugins/espnet/EspNetPlugin.h"
24
#include "plugins/espnet/EspNetDevice.h"
25

26
namespace ola {
27
namespace plugin {
28
namespace espnet {
29

30
using std::string;
31

32
const char EspNetPlugin::ESPNET_NODE_NAME[] = "ola-EspNet";
33
const char EspNetPlugin::PLUGIN_NAME[] = "ESP Net";
34
const char EspNetPlugin::PLUGIN_PREFIX[] = "espnet";
35

36

37
/*
38
 * Start the plugin
39
 * For now we just have one device.
40
 */
41
bool EspNetPlugin::StartHook() {
1✔
42
  m_device = new EspNetDevice(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 EspNetPlugin::StopHook() {
1✔
64
  if (m_device) {
1✔
65
    bool ret = m_plugin_adaptor->UnregisterDevice(m_device);
1✔
66
    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 EspNetPlugin::Description() const {
×
78
  return
×
79
"Enttec ESP Net Plugin\n"
×
80
"----------------------------\n"
81
"\n"
82
"This plugin creates a single device with five input and five output ports.\n"
83
"\n"
84
"ESP supports up to 255 universes. As ESP has no notion of ports, we provide\n"
85
"a fixed number of ports which can be patched to any universe. When sending\n"
86
"data from a port, the data is addressed to the universe the port is patched\n"
87
"to. For example if port 0 is patched to universe 10, the data will be\n"
88
"sent to ESP universe 10.\n"
89
"\n"
90
"--- Config file : ola-espnet.conf ---\n"
91
"\n"
92
"ip = [a.b.c.d|<interface_name>]\n"
93
"The ip address or interface name to bind to. If not specified it will\n"
94
"use the first non-loopback interface.\n"
95
"\n"
96
"name = ola-EspNet\n"
97
"The name of the node.\n"
98
"\n";
×
99
}
100

101
/*
102
 * Set the default preferences.
103
 */
104
bool EspNetPlugin::SetDefaultPreferences() {
1✔
105
  if (!m_preferences) {
1✔
106
    return false;
107
  }
108

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

113
  save |= m_preferences->SetDefaultValue(EspNetDevice::NODE_NAME_KEY,
1✔
114
                                         StringValidator(), ESPNET_NODE_NAME);
1✔
115

116
  if (save) {
1✔
117
    m_preferences->Save();
1✔
118
  }
119

120
  if (m_preferences->GetValue("name").empty()) {
1✔
121
    return false;
122
  }
123

124
  return true;
125
}
126
}  // namespace espnet
127
}  // namespace plugin
128
}  // 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