Open Lighting Architecture  0.9.1
 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  uint8_t SandnetGroup(const Universe* universe) const;
40  uint8_t SandnetUniverse(const Universe *universe) const;
41 };
42 
43 
45  public:
47  unsigned int id,
48  class PluginAdaptor *plugin_adaptor,
49  SandNetNode *node):
50  BasicInputPort(parent, id, plugin_adaptor),
51  m_node(node) {}
52  ~SandNetInputPort() {}
53 
54  std::string Description() const {
55  return m_helper.Description(GetUniverse());
56  }
57  const DmxBuffer &ReadDMX() const { return m_buffer; }
58  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
59  return m_helper.PreSetUniverse(old_universe, new_universe);
60  }
61  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
62 
63  private:
64  SandNetPortHelper m_helper;
65  SandNetNode *m_node;
66  DmxBuffer m_buffer;
67 };
68 
69 
71  public:
73  unsigned int id,
74  SandNetNode *node):
75  BasicOutputPort(parent, id),
76  m_node(node) {}
77  ~SandNetOutputPort() {}
78 
79  std::string Description() const {
80  return m_helper.Description(GetUniverse());
81  }
82  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
83  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
84  return m_helper.PreSetUniverse(old_universe, new_universe);
85  }
86  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
87 
88  private:
89  SandNetPortHelper m_helper;
90  SandNetNode *m_node;
91 };
92 } // namespace sandnet
93 } // namespace plugin
94 } // namespace ola
95 #endif // PLUGINS_SANDNET_SANDNETPORT_H_