Open Lighting Architecture: plugins/sandnet/SandNetDevice.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
SandNetDevice.h
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 * SandNetDevice.h
17 * Interface for the sandnet device
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef PLUGINS_SANDNET_SANDNETDEVICE_H_
22#define PLUGINS_SANDNET_SANDNETDEVICE_H_
23
24#include <string>
25#include "olad/Device.h"
26#include "olad/Plugin.h"
27#include "olad/PluginAdaptor.h"
28#include "plugins/sandnet/SandNetCommon.h"
29#include "plugins/sandnet/SandNetNode.h"
30
31namespace ola {
32namespace plugin {
33namespace sandnet {
34
35 class SandNetDevice: public ola::Device {
36 public:
37 SandNetDevice(class SandNetPlugin *owner,
38 class Preferences *prefs,
39 class PluginAdaptor *plugin_adaptor);
40
41 std::string DeviceId() const { return "1"; }
42 SandNetNode *GetNode() { return m_node; }
43
44 bool SendAdvertisement();
45
46 static const char IP_KEY[];
47 static const char NAME_KEY[];
48
49 protected:
50 bool StartHook();
51 void PrePortStop();
52 void PostPortStop();
53
54 private:
55 class Preferences *m_preferences;
56 class PluginAdaptor *m_plugin_adaptor;
57 SandNetNode *m_node;
58 ola::thread::timeout_id m_timeout_id;
59
60 static const char SANDNET_DEVICE_NAME[];
61 // the number of input ports to create
62 static const unsigned int INPUT_PORTS = 8;
63 // send an advertisement every 2s.
64 static const int ADVERTISEMENT_PERIOD_MS = 2000;
65};
66} // namespace sandnet
67} // namespace plugin
68} // namespace ola
69#endif // PLUGINS_SANDNET_SANDNETDEVICE_H_
PluginAdaptor.h
Provides a wrapper for the DeviceManager and SelectServer objects so that the plugins can register de...
ola::Device
Definition Device.h:89
ola::PluginAdaptor
Definition PluginAdaptor.h:41
ola::Preferences
Definition Preferences.h:148
ola::plugin::sandnet::SandNetDevice::DeviceId
std::string DeviceId() const
The device ID.
Definition SandNetDevice.h:41
ola::plugin::sandnet::SandNetDevice::StartHook
bool StartHook()
Called during Start().
Definition SandNetDevice.cpp:63
ola::plugin::sandnet::SandNetNode
Definition SandNetNode.h:41
ola::plugin::sandnet::SandNetPlugin
Definition SandNetPlugin.h:33
ola::plugin::sandnet
Code for the SandNet protocol.
ola::plugin
Code for supported devices and protocols.
ola::thread::timeout_id
void * timeout_id
A timeout handle which can later be used to cancel a timeout.
Definition SchedulerInterface.h:34
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44