Open Lighting Architecture  0.9.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 PLUGINS_E131_E131_ROOTSENDER_H_
22 #define PLUGINS_E131_E131_ROOTSENDER_H_
23 
24 #include "ola/acn/CID.h"
25 #include "plugins/e131/e131/PDU.h"
26 #include "plugins/e131/e131/RootPDU.h"
27 #include "plugins/e131/e131/Transport.h"
28 
29 namespace ola {
30 namespace plugin {
31 namespace e131 {
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  RootSender(const RootSender&);
64  RootSender& operator=(const RootSender&);
65 };
66 } // namespace e131
67 } // namespace plugin
68 } // namespace ola
69 #endif // PLUGINS_E131_E131_ROOTSENDER_H_