Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PathportPort.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  * PathportPort.h
17  * The Pathport plugin for ola
18  * Copyright (C) 2005-2009 Simon Newton
19  */
20 
21 #ifndef PLUGINS_PATHPORT_PATHPORTPORT_H_
22 #define PLUGINS_PATHPORT_PATHPORTPORT_H_
23 
24 #include <string>
25 #include "ola/DmxBuffer.h"
26 #include "olad/Port.h"
27 #include "plugins/pathport/PathportDevice.h"
28 
29 namespace ola {
30 namespace plugin {
31 namespace pathport {
32 
34  public:
36  string Description(const Universe *universe) const;
37  bool PreSetUniverse(Universe *new_universe);
38 };
39 
40 
42  public:
44  unsigned int id,
45  class PluginAdaptor *plugin_adaptor,
46  PathportNode *node):
47  BasicInputPort(parent, id, plugin_adaptor),
48  m_node(node) {}
49  ~PathportInputPort() {}
50 
51  string Description() const { return m_helper.Description(GetUniverse()); }
52  const DmxBuffer &ReadDMX() const { return m_buffer; }
53  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
54  return m_helper.PreSetUniverse(new_universe);
55  (void) old_universe;
56  }
57 
58  void PostSetUniverse(Universe *old_universe, Universe *new_universe);
59 
60  private:
61  PathportPortHelper m_helper;
62  PathportNode *m_node;
63  DmxBuffer m_buffer;
64 };
65 
66 
68  public:
70  unsigned int id,
71  PathportNode *node):
72  BasicOutputPort(parent, id),
73  m_node(node) {}
74  ~PathportOutputPort() {}
75 
76  string Description() const { return m_helper.Description(GetUniverse()); }
77  bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
78  bool PreSetUniverse(Universe *old_universe, Universe *new_universe) {
79  return m_helper.PreSetUniverse(new_universe);
80  (void) old_universe;
81  }
82 
83  private:
84  PathportPortHelper m_helper;
85  PathportNode *m_node;
86 };
87 } // namespace pathport
88 } // namespace plugin
89 } // namespace ola
90 #endif // PLUGINS_PATHPORT_PATHPORTPORT_H_