Open Lighting Architecture
0.9.6
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
e133
DeviceManager.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
* DeviceManager.cpp
17
* Copyright (C) 2013 Simon Newton
18
* The DeviceManager attempts to maintain a TCP connection to each E1.33 device.
19
*/
20
21
#ifndef INCLUDE_OLA_E133_DEVICEMANAGER_H_
22
#define INCLUDE_OLA_E133_DEVICEMANAGER_H_
23
24
#include <
ola/Callback.h
>
25
#include <
ola/base/Macro.h
>
26
#include <ola/e133/MessageBuilder.h>
27
#include <ola/io/SelectServerInterface.h>
28
#include <
ola/network/IPV4Address.h
>
29
#include <
ola/network/SocketAddress.h
>
30
31
#include <memory>
32
#include <string>
33
#include <vector>
34
35
namespace
ola {
36
namespace
e133 {
37
38
using
ola::network::IPV4Address
;
39
using
ola::network::IPV4SocketAddress
;
40
using
std::auto_ptr;
41
using
std::string;
42
using
std::vector;
43
49
class
DeviceManager
{
50
public
:
51
/*
52
* The callback used to receive RDMNet layer messages from the devices.
53
* @returns true if the data should be acknowledged, false otherwise.
54
*/
55
typedef
ola::Callback3
<bool,
const
IPV4Address
&, uint16_t,
56
const
string
&>
RDMMesssageCallback
;
57
58
// Run when we acquire designated controller status for a device.
59
typedef
ola::Callback1<void, const IPV4Address&>
AcquireDeviceCallback
;
60
61
// Run when we give up (or lose) designated controller status.
62
typedef
ola::Callback1<void, const IPV4Address&>
ReleaseDeviceCallback
;
63
64
DeviceManager
(
ola::io::SelectServerInterface
*ss,
65
ola::e133::MessageBuilder
*message_builder);
66
~
DeviceManager
();
67
68
// Ownership of the callbacks is transferred.
69
void
SetRDMMessageCallback(
RDMMesssageCallback
*callback);
70
void
SetAcquireDeviceCallback(
AcquireDeviceCallback
*callback);
71
void
SetReleaseDeviceCallback(
ReleaseDeviceCallback
*callback);
72
73
void
AddDevice(
const
IPV4Address
&ip_address);
74
void
RemoveDevice(
const
IPV4Address
&ip_address);
75
void
RemoveDeviceIfNotConnected(
const
IPV4Address
&ip_address);
76
void
ListManagedDevices(vector<IPV4Address> *devices)
const
;
77
78
private
:
79
class
DeviceManagerImpl *m_impl;
80
81
DISALLOW_COPY_AND_ASSIGN
(
DeviceManager
);
82
};
83
}
// namespace e133
84
}
// namespace ola
85
#endif // INCLUDE_OLA_E133_DEVICEMANAGER_H_
Generated on Fri Jul 3 2015 15:58:45 for Open Lighting Architecture by
1.8.1.2