Open Lighting Architecture  Latest Git
MessageBuilder.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  * MessageBuilder.h
17  * Copyright (C) 2013 Simon Newton
18  *
19  * A class to simplify some of the E1.33 packet building operations.
20  */
21 
22 #ifndef INCLUDE_OLA_E133_MESSAGEBUILDER_H_
23 #define INCLUDE_OLA_E133_MESSAGEBUILDER_H_
24 
25 #include <ola/acn/CID.h>
26 #include <ola/base/Macro.h>
27 #include <ola/e133/E133Enums.h>
28 #include <ola/io/IOStack.h>
29 #include <ola/io/MemoryBlockPool.h>
30 #include <string>
31 
32 namespace ola {
33 namespace e133 {
34 
35 using ola::acn::CID;
36 using ola::io::IOStack;
37 using std::string;
38 
43  public:
44  MessageBuilder(const CID &cid, const string &source_name);
45  ~MessageBuilder() {}
46 
47  void PrependRDMHeader(IOStack *packet);
48 
49  void BuildNullTCPPacket(IOStack *packet);
50 
51  void BuildTCPE133StatusPDU(IOStack *packet,
52  uint32_t sequence_number, uint16_t endpoint_id,
53  ola::e133::E133StatusCode status_code,
54  const string &description);
55  void BuildUDPE133StatusPDU(IOStack *packet,
56  uint32_t sequence_number, uint16_t endpoint_id,
57  ola::e133::E133StatusCode status_code,
58  const string &description);
59 
60  void BuildTCPRootE133(IOStack *packet, uint32_t vector,
61  uint32_t sequence_number, uint16_t endpoint_id);
62  void BuildUDPRootE133(IOStack *packet, uint32_t vector,
63  uint32_t sequence_number, uint16_t endpoint_id);
64 
65  ola::io::MemoryBlockPool *pool() { return &m_memory_pool; }
66 
67  private:
68  const CID m_cid;
69  const string m_source_name;
70  ola::io::MemoryBlockPool m_memory_pool;
71 
72  DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
73 };
74 } // namespace e133
75 } // namespace ola
76 #endif // INCLUDE_OLA_E133_MESSAGEBUILDER_H_
Definition: MessageBuilder.h:42
The ACN component identifier.
The ACN component identifier.
Definition: CID.h:47
Helper macros.
Definition: IOStack.h:40
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
MemoryBlockPool. This class is not thread safe.
Definition: MemoryBlockPool.h:35