Open Lighting Architecture  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * RDMInflator.h
17  * Copyright (C) 2011 Simon Newton
18  */
19 
20 #ifndef PLUGINS_E131_E131_RDMINFLATOR_H_
21 #define PLUGINS_E131_E131_RDMINFLATOR_H_
22 
23 #include <string>
24 #include "ola/Callback.h"
25 #include "ola/acn/ACNVectors.h"
26 #include "plugins/e131/e131/BaseInflator.h"
27 #include "plugins/e131/e131/TransportHeader.h"
28 #include "plugins/e131/e131/E133Header.h"
29 
30 namespace ola {
31 namespace plugin {
32 namespace e131 {
33 
34 class RDMInflator: public BaseInflator {
35  friend class RDMInflatorTest;
36 
37  public:
38  // These are pointers so the callers don't have to pull in all the headers.
39  typedef ola::Callback3<void,
40  const TransportHeader*, // src ip & port
41  const E133Header*, // the E1.33 header
42  const std::string& // rdm data
44 
45  explicit RDMInflator();
46  ~RDMInflator() {}
47 
48  uint32_t Id() const { return ola::acn::VECTOR_FRAMING_RDMNET; }
49 
50  void SetRDMHandler(RDMMessageHandler *handler);
51 
52  static const unsigned int VECTOR_RDMNET_DATA = 0xcc;
53 
54  protected:
55  bool DecodeHeader(HeaderSet *headers,
56  const uint8_t *data,
57  unsigned int len,
58  unsigned int *bytes_used);
59 
60  void ResetHeaderField() {} // namespace noop
61 
62  virtual bool HandlePDUData(uint32_t vector,
63  const HeaderSet &headers,
64  const uint8_t *data,
65  unsigned int pdu_len);
66 
67  private:
68  std::auto_ptr<RDMMessageHandler> m_rdm_handler;
69 };
70 } // namespace e131
71 } // namespace plugin
72 } // namespace ola
73 #endif // PLUGINS_E131_E131_RDMINFLATOR_H_