Open Lighting Architecture  0.10.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RDMInflator.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  * RDMInflator.h
17  * Copyright (C) 2011 Simon Newton
18  */
19 
20 #ifndef LIBS_ACN_RDMINFLATOR_H_
21 #define LIBS_ACN_RDMINFLATOR_H_
22 
23 #include <string>
24 #include "ola/Callback.h"
25 #include "ola/acn/ACNVectors.h"
26 #include "libs/acn/BaseInflator.h"
27 #include "libs/acn/TransportHeader.h"
28 #include "libs/acn/E133Header.h"
29 
30 namespace ola {
31 namespace acn {
32 
33 class RDMInflator: public BaseInflator {
34  friend class RDMInflatorTest;
35 
36  public:
37  // These are pointers so the callers don't have to pull in all the headers.
38  typedef ola::Callback3<void,
39  const TransportHeader*, // src ip & port
40  const E133Header*, // the E1.33 header
41  const std::string& // rdm data
43 
44  RDMInflator();
45  ~RDMInflator() {}
46 
47  uint32_t Id() const { return ola::acn::VECTOR_FRAMING_RDMNET; }
48 
49  void SetRDMHandler(RDMMessageHandler *handler);
50 
51  static const unsigned int VECTOR_RDMNET_DATA = 0xcc;
52 
53  protected:
54  bool DecodeHeader(HeaderSet *headers,
55  const uint8_t *data,
56  unsigned int len,
57  unsigned int *bytes_used);
58 
59  void ResetHeaderField() {} // namespace noop
60 
61  virtual bool HandlePDUData(uint32_t vector,
62  const HeaderSet &headers,
63  const uint8_t *data,
64  unsigned int pdu_len);
65 
66  private:
67  std::auto_ptr<RDMMessageHandler> m_rdm_handler;
68 };
69 } // namespace acn
70 } // namespace ola
71 #endif // LIBS_ACN_RDMINFLATOR_H_
Definition: HeaderSet.h:35
Definition: TransportHeader.h:35
Definition: BaseInflator.h:63
ACN Vector values.
Definition: ACNVectors.h:73
A 3 argument callback which can be called multiple times.
Definition: Callback.h:2838
Definition: RDMInflator.h:33
Definition: E133Header.h:35
RDMInflator()
Definition: RDMInflator.cpp:35
void SetRDMHandler(RDMMessageHandler *handler)
Definition: RDMInflator.cpp:44
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44