Open Lighting Architecture  Latest Git
E131Inflator.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  * E131Inflator.h
17  * Interface for the E131Inflator class.
18  * Copyright (C) 2009 Simon Newton
19  *
20  * This contains two inflators a E131Inflator as per the standard and an
21  * E131InflatorRev2 which implements the revision 2 draft specification.
22  */
23 
24 #ifndef LIBS_ACN_E131INFLATOR_H_
25 #define LIBS_ACN_E131INFLATOR_H_
26 
27 #include "ola/acn/ACNVectors.h"
28 #include "libs/acn/BaseInflator.h"
29 #include "libs/acn/E131Header.h"
30 
31 namespace ola {
32 namespace acn {
33 
34 class E131Inflator: public BaseInflator {
35  friend class E131InflatorTest;
36 
37  public:
39  m_last_header_valid(false) {
40  }
41  ~E131Inflator() {}
42 
43  uint32_t Id() const { return ola::acn::VECTOR_ROOT_E131; }
44 
45  protected:
46  bool DecodeHeader(HeaderSet *headers,
47  const uint8_t *data,
48  unsigned int len,
49  unsigned int *bytes_used);
50 
51  void ResetHeaderField() {
52  m_last_header_valid = false;
53  }
54  private:
55  E131Header m_last_header;
56  bool m_last_header_valid;
57 };
58 
59 
60 /*
61  * A Revision 2 version of the inflator.
62  */
64  friend class E131InflatorTest;
65 
66  public:
68  m_last_header_valid(false) {
69  }
70  ~E131InflatorRev2() {}
71 
72  uint32_t Id() const { return ola::acn::VECTOR_ROOT_E131_REV2; }
73 
74  protected:
75  bool DecodeHeader(HeaderSet *headers, const uint8_t *data,
76  unsigned int len, unsigned int *bytes_used);
77 
78  void ResetHeaderField() {
79  m_last_header_valid = false;
80  }
81  private:
82  E131Header m_last_header;
83  bool m_last_header_valid;
84 };
85 } // namespace acn
86 } // namespace ola
87 #endif // LIBS_ACN_E131INFLATOR_H_
Definition: ACNVectors.h:47
Definition: HeaderSet.h:35
An abstract PDU inflator.
Definition: BaseInflator.h:64
ACN Vector values.
Definition: E131Inflator.h:34
Definition: ACNVectors.h:46
Definition: E131Header.h:35
Definition: E131Inflator.h:63
uint32_t Id() const
Definition: E131Inflator.h:72
uint32_t Id() const
Definition: E131Inflator.h:43
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44