Open Lighting Architecture  0.9.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 PLUGINS_E131_E131_E131INFLATOR_H_
25 #define PLUGINS_E131_E131_E131INFLATOR_H_
26 
27 #include "ola/acn/ACNVectors.h"
28 #include "plugins/e131/e131/BaseInflator.h"
29 #include "plugins/e131/e131/E131Header.h"
30 
31 namespace ola {
32 namespace plugin {
33 namespace e131 {
34 
35 class E131Inflator: public BaseInflator {
36  friend class E131InflatorTest;
37 
38  public:
40  m_last_header_valid(false) {
41  }
42  ~E131Inflator() {}
43 
44  uint32_t Id() const { return ola::acn::VECTOR_ROOT_E131; }
45 
46  protected:
47  bool DecodeHeader(HeaderSet *headers,
48  const uint8_t *data,
49  unsigned int len,
50  unsigned int *bytes_used);
51 
52  void ResetHeaderField() {
53  m_last_header_valid = false;
54  }
55  private:
56  E131Header m_last_header;
57  bool m_last_header_valid;
58 };
59 
60 
61 /*
62  * A Revision 2 version of the inflator.
63  */
65  friend class E131InflatorTest;
66 
67  public:
69  m_last_header_valid(false) {
70  }
71  ~E131InflatorRev2() {}
72 
73  uint32_t Id() const { return ola::acn::VECTOR_ROOT_E131_REV2; }
74 
75  protected:
76  bool DecodeHeader(HeaderSet *headers, const uint8_t *data,
77  unsigned int len, unsigned int *bytes_used);
78 
79  void ResetHeaderField() {
80  m_last_header_valid = false;
81  }
82  private:
83  E131Header m_last_header;
84  bool m_last_header_valid;
85 };
86 } // namespace e131
87 } // namespace plugin
88 } // namespace ola
89 #endif // PLUGINS_E131_E131_E131INFLATOR_H_