Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
E133Header.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  * E133Header.h
17  * The E1.33 Header
18  * Copyright (C) 2011 Simon Newton
19  */
20 
21 #ifndef LIBS_ACN_E133HEADER_H_
22 #define LIBS_ACN_E133HEADER_H_
23 
24 #include <ola/base/Macro.h>
25 
26 #include <stdint.h>
27 #include <string>
28 
29 namespace ola {
30 namespace acn {
31 
32 /*
33  * Header for the E133 layer
34  */
35 class E133Header {
36  public:
37  E133Header()
38  : m_sequence(0),
39  m_endpoint(0) {
40  }
41 
42  E133Header(const std::string &source,
43  uint32_t sequence,
44  uint16_t endpoint)
45  : m_source(source),
46  m_sequence(sequence),
47  m_endpoint(endpoint) {
48  }
49  ~E133Header() {}
50 
51  const std::string Source() const { return m_source; }
52  uint32_t Sequence() const { return m_sequence; }
53  uint16_t Endpoint() const { return m_endpoint; }
54 
55  bool operator==(const E133Header &other) const {
56  return m_source == other.m_source &&
57  m_sequence == other.m_sequence &&
58  m_endpoint == other.m_endpoint;
59  }
60 
61  enum { SOURCE_NAME_LEN = 64 };
62 
63  PACK(
64  struct e133_pdu_header_s {
65  char source[SOURCE_NAME_LEN];
66  uint32_t sequence;
67  uint16_t endpoint;
68  uint8_t reserved;
69  });
70  typedef struct e133_pdu_header_s e133_pdu_header;
71 
72  private:
73  std::string m_source;
74  uint32_t m_sequence;
75  uint16_t m_endpoint;
76 };
77 } // namespace acn
78 } // namespace ola
79 #endif // LIBS_ACN_E133HEADER_H_
Definition: E133Header.h:35
Helper macros.
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44