Open Lighting Architecture
 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 using ola::acn::CID;
34 
35 class RootSender {
36  public:
37  explicit RootSender(const CID &cid);
38  ~RootSender() {}
39 
40  // Convenience method to encapsulate & send a single PDU
41  bool SendPDU(unsigned int vector,
42  const PDU &pdu,
43  OutgoingTransport *transport);
44  // Send a RootPDU with no data
45  bool SendEmpty(unsigned int vector,
46  OutgoingTransport *transport);
47  // Use for testing to force a message from a particular cid
48  bool SendPDU(unsigned int vector,
49  const PDU &pdu,
50  const CID &cid,
51  OutgoingTransport *transport);
52  // Encapsulation & send a block of PDUs
53  bool SendPDUBlock(unsigned int vector,
54  const PDUBlock<PDU> &block,
55  OutgoingTransport *transport);
56 
57  // TODO(simon): add methods to queue and send PDUs/blocks with different
58  // vectors
59 
60  private:
61  PDUBlock<PDU> m_working_block;
62  PDUBlock<PDU> m_root_block;
63  RootPDU m_root_pdu;
64 
65  RootSender(const RootSender&);
66  RootSender& operator=(const RootSender&);
67 };
68 } // namespace e131
69 } // namespace plugin
70 } // namespace ola
71 #endif // PLUGINS_E131_E131_ROOTSENDER_H_