Open Lighting Architecture  0.9.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
E133PDU.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  * E133PDU.h
17  * Interface for the E133PDU class
18  * Copyright (C) 2011 Simon Newton
19  */
20 
21 #ifndef PLUGINS_E131_E131_E133PDU_H_
22 #define PLUGINS_E131_E131_E133PDU_H_
23 
24 #include <ola/io/IOStack.h>
25 #include <string>
26 
27 #include "plugins/e131/e131/PDU.h"
28 #include "plugins/e131/e131/E133Header.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace e131 {
33 
34 class RDMPDU;
35 
36 class E133PDU: public PDU {
37  public:
38  E133PDU(unsigned int vector,
39  const E133Header &header,
40  const PDU *pdu):
41  PDU(vector),
42  m_header(header),
43  m_pdu(pdu) {}
44  ~E133PDU() {}
45 
46  unsigned int HeaderSize() const;
47  unsigned int DataSize() const;
48  bool PackHeader(uint8_t *data, unsigned int *length) const;
49  bool PackData(uint8_t *data, unsigned int *length) const;
50 
51  void PackHeader(ola::io::OutputStream *stream) const;
52  void PackData(ola::io::OutputStream *stream) const;
53 
54  static void PrependPDU(ola::io::IOStack *stack, uint32_t vector,
55  const std::string &source, uint32_t sequence_number,
56  uint16_t endpoint_id);
57 
58  private:
59  E133Header m_header;
60  const PDU *m_pdu;
61 };
62 } // namespace e131
63 } // namespace plugin
64 } // namespace ola
65 #endif // PLUGINS_E131_E131_E133PDU_H_