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
plugins
usbpro
EnttecUsbProWidget.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
* EnttecUsbProWidget.h
17
* The Enttec USB Pro Widget
18
* Copyright (C) 2010 Simon Newton
19
*/
20
21
#ifndef PLUGINS_USBPRO_ENTTECUSBPROWIDGET_H_
22
#define PLUGINS_USBPRO_ENTTECUSBPROWIDGET_H_
23
24
#include <deque>
25
#include <memory>
26
#include <string>
27
#include "
ola/Callback.h
"
28
#include "
ola/DmxBuffer.h
"
29
#include "ola/thread/SchedulerInterface.h"
30
#include "
ola/rdm/DiscoveryAgent.h
"
31
#include "
ola/rdm/QueueingRDMController.h
"
32
#include "
ola/rdm/RDMControllerInterface.h
"
33
#include "
ola/rdm/UIDSet.h
"
34
#include "plugins/usbpro/GenericUsbProWidget.h"
35
36
class
EnttecUsbProWidgetTest;
37
38
namespace
ola {
39
namespace
plugin {
40
namespace
usbpro {
41
42
43
class
EnttecPortImpl;
44
49
class
EnttecPort
50
:
public
ola::rdm::DiscoverableRDMControllerInterface
{
51
public
:
52
// Ownership not transferred.
53
EnttecPort
(
EnttecPortImpl
*impl,
unsigned
int
queue_size,
bool
enable_rdm);
54
55
bool
SendDMX(
const
DmxBuffer
&buffer);
56
const
DmxBuffer
&FetchDMX()
const
;
57
void
SetDMXCallback(
ola::Callback0<void>
*callback);
58
bool
ChangeToReceiveMode(
bool
change_only);
59
void
GetParameters(
usb_pro_params_callback
*callback);
60
bool
SetParameters(uint8_t break_time, uint8_t mab_time, uint8_t rate);
61
bool
SupportsRDM()
const
{
return
m_enable_rdm; }
62
63
// the following are from DiscoverableRDMControllerInterface
64
void
SendRDMRequest
(
ola::rdm::RDMRequest
*request,
65
ola::rdm::RDMCallback
*on_complete);
66
67
void
RunFullDiscovery
(
ola::rdm::RDMDiscoveryCallback
*callback);
68
void
RunIncrementalDiscovery
(
ola::rdm::RDMDiscoveryCallback
*callback);
69
70
// the tests access the implementation directly.
71
friend
class ::EnttecUsbProWidgetTest;
72
73
private
:
74
EnttecPortImpl
*m_impl;
75
const
bool
m_enable_rdm;
76
std::auto_ptr<ola::rdm::DiscoverableQueueingRDMController> m_controller;
77
};
78
79
80
/*
81
* An Enttec Usb Pro Widget
82
*/
83
class
EnttecUsbProWidget
:
public
SerialWidgetInterface
{
84
public
:
85
/*
86
* The callback to run when we receive a port assignment response
87
* @param true if this command completed ok
88
* @param DMX port 1 assignment
89
* @param DMX port 2 assignment
90
*/
91
typedef
ola::SingleUseCallback3<void, bool, uint8_t, uint8_t>
92
EnttecUsbProPortAssignmentCallback
;
93
94
struct
EnttecUsbProWidgetOptions
{
95
uint16_t esta_id;
96
uint32_t serial;
97
bool
dual_ports;
98
unsigned
int
queue_size;
99
bool
enable_rdm;
100
101
EnttecUsbProWidgetOptions
()
102
: esta_id(0),
103
serial(0),
104
dual_ports(
false
),
105
queue_size(20),
106
enable_rdm(
false
) {
107
}
108
109
EnttecUsbProWidgetOptions
(uint16_t esta_id, uint32_t serial)
110
: esta_id(esta_id),
111
serial(serial),
112
dual_ports(
false
),
113
queue_size(20),
114
enable_rdm(
false
) {
115
}
116
};
117
118
EnttecUsbProWidget
(
ola::thread::SchedulerInterface
*ss,
119
ola::io::ConnectedDescriptor
*descriptor,
120
const
EnttecUsbProWidgetOptions
&options);
121
~
EnttecUsbProWidget
();
122
123
void
GetPortAssignments(
EnttecUsbProPortAssignmentCallback
*callback);
124
125
void
Stop();
126
unsigned
int
PortCount()
const
;
127
EnttecPort
*GetPort(
unsigned
int
i);
128
ola::io::ConnectedDescriptor
*GetDescriptor()
const
;
129
130
static
const
uint16_t ENTTEC_ESTA_ID;
131
132
private
:
133
class
EnttecUsbProWidgetImpl
*m_impl;
134
};
135
}
// namespace usbpro
136
}
// namespace plugin
137
}
// namespace ola
138
#endif // PLUGINS_USBPRO_ENTTECUSBPROWIDGET_H_
Generated on Fri Jul 3 2015 15:58:46 for Open Lighting Architecture by
1.8.1.2