Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * E133Header.h
17  * The E1.33 Header
18  * Copyright (C) 2011 Simon Newton
19  */
20 
21 #ifndef PLUGINS_E131_E131_E133HEADER_H_
22 #define PLUGINS_E131_E131_E133HEADER_H_
23 
24 #include <stdint.h>
25 #include <string>
26 
27 namespace ola {
28 namespace plugin {
29 namespace e131 {
30 
31 using std::string;
32 
33 /*
34  * Header for the E133 layer
35  */
36 class E133Header {
37  public:
38  E133Header() {}
39  E133Header(const string &source,
40  uint32_t sequence,
41  uint16_t endpoint)
42  : m_source(source),
43  m_sequence(sequence),
44  m_endpoint(endpoint) {
45  }
46  ~E133Header() {}
47 
48  const string Source() const { return m_source; }
49  uint32_t Sequence() const { return m_sequence; }
50  uint16_t Endpoint() const { return m_endpoint; }
51 
52  bool operator==(const E133Header &other) const {
53  return m_source == other.m_source &&
54  m_sequence == other.m_sequence &&
55  m_endpoint == other.m_endpoint;
56  }
57 
58  enum { SOURCE_NAME_LEN = 64 };
59 
61  char source[SOURCE_NAME_LEN];
62  uint32_t sequence;
63  uint16_t endpoint;
64  uint8_t reserved;
65  } __attribute__((packed));
66  typedef struct e133_pdu_header_s e133_pdu_header;
67 
68  private:
69  string m_source;
70  uint32_t m_sequence;
71  uint16_t m_endpoint;
72 };
73 } // namespace e131
74 } // namespace plugin
75 } // namespace ola
76 #endif // PLUGINS_E131_E131_E133HEADER_H_