Open Lighting Architecture
 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  *
17  * SandNetPort.h
18  * The SandNet plugin for ola
19  * Copyright (C) 2005-2006 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  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  string Description() const { return m_helper.Description(GetUniverse()); }
55  const DmxBuffer &ReadDMX() const { return m_buffer; }
56  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
57  return m_helper.PreSetUniverse(old_universe, new_universe);
58  }
59  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
60 
61  private:
62  SandNetPortHelper m_helper;
63  SandNetNode *m_node;
64  DmxBuffer m_buffer;
65 };
66 
67 
69  public:
71  unsigned int id,
72  SandNetNode *node):
73  BasicOutputPort(parent, id),
74  m_node(node) {}
75  ~SandNetOutputPort() {}
76 
77  string Description() const { return m_helper.Description(GetUniverse()); }
78  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
79  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
80  return m_helper.PreSetUniverse(old_universe, new_universe);
81  }
82  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
83 
84  private:
85  SandNetPortHelper m_helper;
86  SandNetNode *m_node;
87 };
88 } // namespace sandnet
89 } // namespace plugin
90 } // namespace ola
91 #endif // PLUGINS_SANDNET_SANDNETPORT_H_