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

OpenLightingProject / ola / 10576413709

27 Aug 2024 10:31AM UTC coverage: 45.677% (-0.01%) from 45.687%
10576413709

push

github

web-flow
Merge pull request #1960 from peternewman/e1.33-cherry-pick

E1.33 cherry pick vii

7787 of 17922 branches covered (43.45%)

10 of 42 new or added lines in 9 files covered. (23.81%)

4 existing lines in 2 files now uncovered.

22243 of 48696 relevant lines covered (45.68%)

54.1 hits per line

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

56.9
/olad/plugin_api/PluginAdaptor.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
 * PluginAdaptor.cpp
17
 * Provides a wrapper for the DeviceManager and SelectServer objects so that
18
 * the plugins can register devices and file handles for events
19
 * Copyright (C) 2005 Simon Newton
20
 */
21

22
#include <string>
23
#include "ola/Callback.h"
24
#include "olad/PluginAdaptor.h"
25
#include "olad/PortBroker.h"
26
#include "olad/Preferences.h"
27
#include "olad/plugin_api/DeviceManager.h"
28

29
namespace ola {
30

31
using ola::io::SelectServerInterface;
32
using ola::thread::timeout_id;
33
using std::string;
34

35
PluginAdaptor::PluginAdaptor(DeviceManager *device_manager,
7✔
36
                             SelectServerInterface *select_server,
37
                             ExportMap *export_map,
38
                             PreferencesFactory *preferences_factory,
39
                             PortBrokerInterface *port_broker,
40
                             const std::string *instance_name,
41
                             const ola::rdm::UID *default_uid):
7✔
42
  m_device_manager(device_manager),
7✔
43
  m_ss(select_server),
7✔
44
  m_export_map(export_map),
7✔
45
  m_preferences_factory(preferences_factory),
7✔
46
  m_port_broker(port_broker),
7✔
47
  m_instance_name(instance_name),
7✔
48
  m_default_uid(default_uid) {
7✔
49
}
7✔
50

51
bool PluginAdaptor::AddReadDescriptor(
9✔
52
    ola::io::ReadFileDescriptor *descriptor) {
53
  return m_ss->AddReadDescriptor(descriptor);
9✔
54
}
55

56
bool PluginAdaptor::AddReadDescriptor(
×
57
    ola::io::ConnectedDescriptor *descriptor,
58
    bool delete_on_close) {
59
  return m_ss->AddReadDescriptor(descriptor, delete_on_close);
×
60
}
61

62
void PluginAdaptor::RemoveReadDescriptor(
9✔
63
    ola::io::ReadFileDescriptor *descriptor) {
64
  m_ss->RemoveReadDescriptor(descriptor);
9✔
65
}
9✔
66

67
void PluginAdaptor::RemoveReadDescriptor(
×
68
    ola::io::ConnectedDescriptor *descriptor) {
69
  m_ss->RemoveReadDescriptor(descriptor);
×
70
}
×
71

72
bool PluginAdaptor::AddWriteDescriptor(
×
73
    ola::io::WriteFileDescriptor *descriptor) {
74
  return m_ss->AddWriteDescriptor(descriptor);
×
75
}
76

77
void PluginAdaptor::RemoveWriteDescriptor(
×
78
    ola::io::WriteFileDescriptor *descriptor) {
79
  m_ss->RemoveWriteDescriptor(descriptor);
×
80
}
×
81

82
timeout_id PluginAdaptor::RegisterRepeatingTimeout(
3✔
83
    unsigned int ms,
84
    Callback0<bool> *closure) {
85
  return m_ss->RegisterRepeatingTimeout(ms, closure);
3✔
86
}
87

88
timeout_id PluginAdaptor::RegisterRepeatingTimeout(
1✔
89
    const TimeInterval &interval,
90
    Callback0<bool> *closure) {
91
  return m_ss->RegisterRepeatingTimeout(interval, closure);
1✔
92
}
93

94
timeout_id PluginAdaptor::RegisterSingleTimeout(
×
95
    unsigned int ms,
96
    SingleUseCallback0<void> *closure) {
97
  return m_ss->RegisterSingleTimeout(ms, closure);
×
98
}
99

100
timeout_id PluginAdaptor::RegisterSingleTimeout(
×
101
    const TimeInterval &interval,
102
    SingleUseCallback0<void> *closure) {
103
  return m_ss->RegisterSingleTimeout(interval, closure);
×
104
}
105

106
void PluginAdaptor::RemoveTimeout(timeout_id id) {
6✔
107
  m_ss->RemoveTimeout(id);
6✔
108
}
6✔
109

110
void PluginAdaptor::Execute(ola::BaseCallback0<void> *closure) {
×
111
  m_ss->Execute(closure);
×
112
}
×
113

114
void PluginAdaptor::DrainCallbacks() {
×
115
  m_ss->DrainCallbacks();
×
116
}
×
117

118
bool PluginAdaptor::RegisterDevice(AbstractDevice *device) const {
8✔
119
  return m_device_manager->RegisterDevice(device);
8✔
120
}
121

122
bool PluginAdaptor::UnregisterDevice(AbstractDevice *device) const {
8✔
123
  return m_device_manager->UnregisterDevice(device);
8✔
124
}
125

126
Preferences *PluginAdaptor::NewPreference(const string &name) const {
33✔
127
  return m_preferences_factory->NewPreference(name);
33✔
128
}
129

130
const TimeStamp *PluginAdaptor::WakeUpTime() const {
14✔
131
  return m_ss->WakeUpTime();
14✔
132
}
133

134
const std::string PluginAdaptor::InstanceName() const {
1✔
135
  if (m_instance_name) {
1✔
136
    return *m_instance_name;
1✔
137
  } else {
138
    return "";
×
139
  }
140
}
141

NEW
142
const ola::rdm::UID PluginAdaptor::DefaultUID() const {
×
NEW
143
  if (m_default_uid) {
×
NEW
144
    return *m_default_uid;
×
145
  } else {
NEW
146
    return ola::rdm::UID(0, 0);
×
147
  }
148
}
149
}  // 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