Open Lighting Architecture  0.9.0
 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 /*
32  * Header for the E133 layer
33  */
34 class E133Header {
35  public:
36  E133Header() {}
37  E133Header(const std::string &source,
38  uint32_t sequence,
39  uint16_t endpoint)
40  : m_source(source),
41  m_sequence(sequence),
42  m_endpoint(endpoint) {
43  }
44  ~E133Header() {}
45 
46  const std::string Source() const { return m_source; }
47  uint32_t Sequence() const { return m_sequence; }
48  uint16_t Endpoint() const { return m_endpoint; }
49 
50  bool operator==(const E133Header &other) const {
51  return m_source == other.m_source &&
52  m_sequence == other.m_sequence &&
53  m_endpoint == other.m_endpoint;
54  }
55 
56  enum { SOURCE_NAME_LEN = 64 };
57 
59  char source[SOURCE_NAME_LEN];
60  uint32_t sequence;
61  uint16_t endpoint;
62  uint8_t reserved;
63  } __attribute__((packed));
64  typedef struct e133_pdu_header_s e133_pdu_header;
65 
66  private:
67  std::string m_source;
68  uint32_t m_sequence;
69  uint16_t m_endpoint;
70 };
71 } // namespace e131
72 } // namespace plugin
73 } // namespace ola
74 #endif // PLUGINS_E131_E131_E133HEADER_H_