Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SandNetPort.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  * SandNetPort.h
17  * The SandNet plugin for ola
18  * Copyright (C) 2005 Simon Newton
19  */
20 
21 #ifndef PLUGINS_SANDNET_SANDNETPORT_H_
22 #define PLUGINS_SANDNET_SANDNETPORT_H_
23 
24 #include <string>
25 #include "ola/DmxBuffer.h"
26 #include "olad/Port.h"
27 #include "plugins/sandnet/SandNetDevice.h"
28 
29 namespace ola {
30 namespace plugin {
31 namespace sandnet {
32 
34  public:
36  bool PreSetUniverse(Universe *old_universe, Universe *new_universe);
37  std::string Description(const Universe *universe) const;
38 
44  uint8_t SandnetGroup(const Universe* universe) const;
45 
53  uint8_t SandnetUniverse(const Universe *universe) const;
54 };
55 
56 
58  public:
60  unsigned int id,
61  class PluginAdaptor *plugin_adaptor,
62  SandNetNode *node)
63  : BasicInputPort(parent, id, plugin_adaptor),
64  m_node(node) {}
65  ~SandNetInputPort() {}
66 
67  std::string Description() const {
68  return m_helper.Description(GetUniverse());
69  }
70  const DmxBuffer &ReadDMX() const { return m_buffer; }
71  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
72  return m_helper.PreSetUniverse(old_universe, new_universe);
73  }
74  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
75 
76  private:
77  SandNetPortHelper m_helper;
78  SandNetNode *m_node;
79  DmxBuffer m_buffer;
80 };
81 
82 
84  public:
86  unsigned int id,
87  SandNetNode *node)
88  : BasicOutputPort(parent, id),
89  m_node(node) {}
90  ~SandNetOutputPort() {}
91 
92  std::string Description() const {
93  return m_helper.Description(GetUniverse());
94  }
95  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
96  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
97  return m_helper.PreSetUniverse(old_universe, new_universe);
98  }
99  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
100 
101  private:
102  SandNetPortHelper m_helper;
103  SandNetNode *m_node;
104 };
105 } // namespace sandnet
106 } // namespace plugin
107 } // namespace ola
108 #endif // PLUGINS_SANDNET_SANDNETPORT_H_
Definition: Universe.h:46
BasicInputPort(AbstractDevice *parent, unsigned int port_id, const PluginAdaptor *plugin_adaptor, bool supports_rdm=false)
Create a new basic input port.
Definition: Port.cpp:38
Definition: Port.h:199
std::string Description() const
Fetch the string description for a Port.
Definition: SandNetPort.h:92
Used to hold a single universe of DMX data.
Definition: DmxBuffer.h:49
BasicOutputPort(AbstractDevice *parent, unsigned int port_id, bool start_rdm_discovery_on_patch=false, bool supports_rdm=false)
Create a new BasicOutputPort.
Definition: Port.cpp:120
Definition: SandNetDevice.h:35
A class used to hold a single universe of DMX data.
Definition: SandNetPort.h:83
Definition: PluginAdaptor.h:41
uint8_t SandnetGroup(const Universe *universe) const
Return the SandNet group that corresponds to a OLA Universe.
Definition: SandNetPort.cpp:59
Definition: SandNetPort.h:33
Universe * GetUniverse() const
Fetch the universe this Port is bound to.
Definition: Port.h:295
std::string Description() const
Fetch the string description for a Port.
Definition: SandNetPort.h:67
uint8_t SandnetUniverse(const Universe *universe) const
Return the SandNet universe that corresponds to a OLA Universe.
Definition: SandNetPort.cpp:65
Universe * GetUniverse() const
Fetch the universe this Port is bound to.
Definition: Port.h:212
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: SandNetNode.h:41
Definition: SandNetPort.h:57
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition: SandNetPort.cpp:88
Definition: Port.h:282