Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
E133StatusInflator.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  * E133StatusInflator.h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
20 #ifndef PLUGINS_E131_E131_E133STATUSINFLATOR_H_
21 #define PLUGINS_E131_E131_E133STATUSINFLATOR_H_
22 
23 #include <memory>
24 #include <string>
25 #include "ola/Callback.h"
26 #include "ola/acn/ACNVectors.h"
27 #include "ola/e133/E133Enums.h"
28 #include "plugins/e131/e131/BaseInflator.h"
29 #include "plugins/e131/e131/TransportHeader.h"
30 #include "plugins/e131/e131/E133Header.h"
31 
32 namespace ola {
33 namespace plugin {
34 namespace e131 {
35 
37  public:
38  // These are pointers so the callers don't have to pull in all the headers.
39  typedef ola::Callback4<void,
40  const TransportHeader*, // src ip & port
41  const E133Header*, // the E1.33 header
42  uint16_t, // the E1.33 Status code
43  const std::string& // rdm data
45 
47 
48  uint32_t Id() const { return ola::acn::VECTOR_FRAMING_STATUS; }
49 
50  // Ownership is transferred.
51  void SetStatusHandler(StatusMessageHandler *handler) {
52  m_handler.reset(handler);
53  }
54 
55  protected:
56  // The 'header' is 0 bytes in length.
57  bool DecodeHeader(HeaderSet *,
58  const uint8_t*,
59  unsigned int,
60  unsigned int &bytes_used) {
61  bytes_used = 0;
62  return true;
63  }
64 
65  void ResetHeaderField() {} // namespace noop
66 
67  virtual bool HandlePDUData(uint32_t vector,
68  const HeaderSet &headers,
69  const uint8_t *data,
70  unsigned int pdu_len);
71 
72  private:
73  std::auto_ptr<StatusMessageHandler> m_handler;
74 };
75 } // namespace e131
76 } // namespace plugin
77 } // namespace ola
78 #endif // PLUGINS_E131_E131_E133STATUSINFLATOR_H_