Open Lighting Architecture  Latest Git
E131PDU.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  * E131PDU.h
17  * Interface for the E131PDU class
18  * Copyright (C) 2007 Simon Newton
19  */
20 
21 #ifndef LIBS_ACN_E131PDU_H_
22 #define LIBS_ACN_E131PDU_H_
23 
24 #include "libs/acn/PDU.h"
25 #include "libs/acn/E131Header.h"
26 
27 namespace ola {
28 namespace acn {
29 
30 class DMPPDU;
31 
32 class E131PDU: public PDU {
33  public:
34  E131PDU(unsigned int vector,
35  const E131Header &header,
36  const DMPPDU *dmp_pdu):
37  PDU(vector),
38  m_header(header),
39  m_dmp_pdu(dmp_pdu),
40  m_data(NULL),
41  m_data_size(0) {}
42 
43  E131PDU(unsigned int vector,
44  const E131Header &header,
45  const uint8_t *data,
46  unsigned int data_size):
47  PDU(vector),
48  m_header(header),
49  m_dmp_pdu(NULL),
50  m_data(data),
51  m_data_size(data_size) {}
52 
53  ~E131PDU() {}
54 
55  unsigned int HeaderSize() const;
56  unsigned int DataSize() const;
57  bool PackHeader(uint8_t *data, unsigned int *length) const;
58  bool PackData(uint8_t *data, unsigned int *length) const;
59 
60  void PackHeader(ola::io::OutputStream *stream) const;
61  void PackData(ola::io::OutputStream *stream) const;
62 
63  private:
64  E131Header m_header;
65  const DMPPDU *m_dmp_pdu;
66  const uint8_t *m_data;
67  const unsigned int m_data_size;
68 };
69 } // namespace acn
70 } // namespace ola
71 #endif // LIBS_ACN_E131PDU_H_
Definition: E131PDU.h:32
Definition: OutputStream.h:54
Definition: E131Header.h:35
Definition: PDU.h:36
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: DMPPDU.h:39