Open Lighting Architecture  0.9.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  *
17  * SandNetPort.h
18  * The SandNet plugin for ola
19  * Copyright (C) 2005 Simon Newton
20  */
21 
22 #ifndef PLUGINS_SANDNET_SANDNETPORT_H_
23 #define PLUGINS_SANDNET_SANDNETPORT_H_
24 
25 #include <string>
26 #include "ola/DmxBuffer.h"
27 #include "olad/Port.h"
28 #include "plugins/sandnet/SandNetDevice.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace sandnet {
33 
35  public:
37  bool PreSetUniverse(Universe *old_universe, Universe *new_universe);
38  std::string Description(const Universe *universe) const;
39 
45  uint8_t SandnetGroup(const Universe* universe) const;
46 
54  uint8_t SandnetUniverse(const Universe *universe) const;
55 };
56 
57 
59  public:
61  unsigned int id,
62  class PluginAdaptor *plugin_adaptor,
63  SandNetNode *node)
64  : BasicInputPort(parent, id, plugin_adaptor),
65  m_node(node) {}
66  ~SandNetInputPort() {}
67 
68  std::string Description() const {
69  return m_helper.Description(GetUniverse());
70  }
71  const DmxBuffer &ReadDMX() const { return m_buffer; }
72  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
73  return m_helper.PreSetUniverse(old_universe, new_universe);
74  }
75  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
76 
77  private:
78  SandNetPortHelper m_helper;
79  SandNetNode *m_node;
80  DmxBuffer m_buffer;
81 };
82 
83 
85  public:
87  unsigned int id,
88  SandNetNode *node)
89  : BasicOutputPort(parent, id),
90  m_node(node) {}
91  ~SandNetOutputPort() {}
92 
93  std::string Description() const {
94  return m_helper.Description(GetUniverse());
95  }
96  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
97  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
98  return m_helper.PreSetUniverse(old_universe, new_universe);
99  }
100  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
101 
102  private:
103  SandNetPortHelper m_helper;
104  SandNetNode *m_node;
105 };
106 } // namespace sandnet
107 } // namespace plugin
108 } // namespace ola
109 #endif // PLUGINS_SANDNET_SANDNETPORT_H_