Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * E133StatusInflator.h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
20 #ifndef LIBS_ACN_E133STATUSINFLATOR_H_
21 #define LIBS_ACN_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 "libs/acn/BaseInflator.h"
29 #include "libs/acn/TransportHeader.h"
30 #include "libs/acn/E133Header.h"
31 
32 namespace ola {
33 namespace acn {
34 
36  public:
37  // These are pointers so the callers don't have to pull in all the headers.
38  typedef ola::Callback4<void,
39  const TransportHeader*, // src ip & port
40  const E133Header*, // the E1.33 header
41  uint16_t, // the E1.33 Status code
42  const std::string& // rdm data
44 
46 
47  uint32_t Id() const { return ola::acn::VECTOR_FRAMING_STATUS; }
48 
49  // Ownership is transferred.
50  void SetStatusHandler(StatusMessageHandler *handler) {
51  m_handler.reset(handler);
52  }
53 
54  protected:
55  // The 'header' is 0 bytes in length.
56  bool DecodeHeader(HeaderSet*,
57  const uint8_t*,
58  unsigned int,
59  unsigned int *bytes_used) {
60  *bytes_used = 0;
61  return true;
62  }
63 
64  void ResetHeaderField() {} // namespace noop
65 
66  virtual bool HandlePDUData(uint32_t vector,
67  const HeaderSet &headers,
68  const uint8_t *data,
69  unsigned int pdu_len);
70 
71  private:
72  std::auto_ptr<StatusMessageHandler> m_handler;
73 };
74 } // namespace acn
75 } // namespace ola
76 #endif // LIBS_ACN_E133STATUSINFLATOR_H_
Definition: TransportHeader.h:35
An abstract PDU inflator.
Definition: BaseInflator.h:64
ACN Vector values.
A 4 argument callback which can be called multiple times.
Definition: Callback.h:3821
Definition: ACNVectors.h:74
E133StatusInflator()
Definition: E133StatusInflator.cpp:34
Definition: E133Header.h:35
Definition: E133StatusInflator.h:35
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
uint32_t Id() const
Definition: E133StatusInflator.h:47