Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RootSender.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  * RootSender.h
17  * The RootSender class manages the sending of Root Layer PDUs.
18  * Copyright (C) 2007 Simon Newton
19  */
20 
21 #ifndef LIBS_ACN_ROOTSENDER_H_
22 #define LIBS_ACN_ROOTSENDER_H_
23 
24 #include "ola/acn/CID.h"
25 #include "ola/base/Macro.h"
26 #include "libs/acn/PDU.h"
27 #include "libs/acn/RootPDU.h"
28 #include "libs/acn/Transport.h"
29 
30 namespace ola {
31 namespace acn {
32 
33 class RootSender {
34  public:
35  explicit RootSender(const ola::acn::CID &cid);
36  ~RootSender() {}
37 
38  // Convenience method to encapsulate & send a single PDU
39  bool SendPDU(unsigned int vector,
40  const PDU &pdu,
41  OutgoingTransport *transport);
42  // Send a RootPDU with no data
43  bool SendEmpty(unsigned int vector,
44  OutgoingTransport *transport);
45  // Use for testing to force a message from a particular cid
46  bool SendPDU(unsigned int vector,
47  const PDU &pdu,
48  const ola::acn::CID &cid,
49  OutgoingTransport *transport);
50  // Encapsulation & send a block of PDUs
51  bool SendPDUBlock(unsigned int vector,
52  const PDUBlock<PDU> &block,
53  OutgoingTransport *transport);
54 
55  // TODO(simon): add methods to queue and send PDUs/blocks with different
56  // vectors
57 
58  private:
59  PDUBlock<PDU> m_working_block;
60  PDUBlock<PDU> m_root_block;
61  RootPDU m_root_pdu;
62 
63  DISALLOW_COPY_AND_ASSIGN(RootSender);
64 };
65 } // namespace acn
66 } // namespace ola
67 #endif // LIBS_ACN_ROOTSENDER_H_
Definition: Transport.h:37
The ACN component identifier.
The ACN component identifier.
Definition: CID.h:47
Definition: RootSender.h:33
Definition: RootPDU.h:34
Helper macros.
Definition: PDU.h:36
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: PDU.h:103