Open Lighting Architecture  0.9.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OPCDevice.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  * OPCDevice.h
17  * The Open Pixel Control Device.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_OPENPIXELCONTROL_OPCDEVICE_H_
22 #define PLUGINS_OPENPIXELCONTROL_OPCDEVICE_H_
23 
24 #include <memory>
25 #include <string>
26 #include "ola/network/Socket.h"
27 #include "olad/Device.h"
28 
29 namespace ola {
30 
31 class AbstractPlugin;
32 
33 namespace plugin {
34 namespace openpixelcontrol {
35 
37  public:
46  PluginAdaptor *plugin_adaptor,
47  Preferences *preferences,
48  const ola::network::IPV4SocketAddress listen_addr);
49 
50  std::string DeviceId() const;
51 
52  bool AllowMultiPortPatching() const { return true; }
53 
54  protected:
55  bool StartHook();
56 
57  private:
58  PluginAdaptor* const m_plugin_adaptor;
59  Preferences* const m_preferences;
60  const ola::network::IPV4SocketAddress m_listen_addr;
61  std::auto_ptr<class OPCServer> m_server;
62 
63  DISALLOW_COPY_AND_ASSIGN(OPCServerDevice);
64 };
65 
67  public:
76  PluginAdaptor *plugin_adaptor,
77  Preferences *preferences,
78  const ola::network::IPV4SocketAddress target);
79 
80  std::string DeviceId() const;
81 
82  bool AllowMultiPortPatching() const { return true; }
83 
84  protected:
85  bool StartHook();
86 
87  private:
88  PluginAdaptor* const m_plugin_adaptor;
89  Preferences* const m_preferences;
90  const ola::network::IPV4SocketAddress m_target;
91  std::auto_ptr<class OPCClient> m_client;
92 
93  DISALLOW_COPY_AND_ASSIGN(OPCClientDevice);
94 };
95 } // namespace openpixelcontrol
96 } // namespace plugin
97 } // namespace ola
98 #endif // PLUGINS_OPENPIXELCONTROL_OPCDEVICE_H_