Open Lighting Architecture  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
E131DiscoveryInflator.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  * E131DiscoveryInflator.h
17  * An inflator for E1.31 discovery messages.
18  * Copyright (C) 2014 Simon Newton
19  */
20 
21 #ifndef PLUGINS_E131_E131_E131DISCOVERYINFLATOR_H_
22 #define PLUGINS_E131_E131_E131DISCOVERYINFLATOR_H_
23 
24 #include <memory>
25 #include <vector>
26 #include "ola/Callback.h"
27 #include "ola/acn/ACNVectors.h"
28 #include "plugins/e131/e131/BaseInflator.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace e131 {
33 
35  public:
36  struct DiscoveryPage {
37  public:
38  const uint8_t page_number;
39  const uint8_t last_page;
40  const uint32_t page_sequence;
41  std::vector<uint16_t> universes;
42 
43  DiscoveryPage(uint8_t page_number, uint8_t last_page)
44  : page_number(page_number),
45  last_page(last_page),
46  page_sequence(0) { // not yet part of the standard
47  }
48  };
51 
52  explicit E131DiscoveryInflator(PageCallback *callback)
53  : m_page_callback(callback) {}
54 
55  uint32_t Id() const { return acn::VECTOR_E131_DISCOVERY; }
56 
57  unsigned int InflatePDUBlock(HeaderSet *headers,
58  const uint8_t *data,
59  unsigned int len);
60 
61 
62  private:
63  std::auto_ptr<PageCallback> m_page_callback;
64 };
65 } // namespace e131
66 } // namespace plugin
67 } // namespace ola
68 #endif // PLUGINS_E131_E131_E131DISCOVERYINFLATOR_H_