Open Lighting Architecture: plugins/dummy/DummyPort.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
DummyPort.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 * DummyPort.h
17 * The interface to the Dummy port
18 * Copyright (C) 2005 Simon Newton
19 */
20
21#ifndef PLUGINS_DUMMY_DUMMYPORT_H_
22#define PLUGINS_DUMMY_DUMMYPORT_H_
23
24#include <stdint.h>
25#include <string>
26#include <map>
27#include <vector>
28#include "ola/Constants.h"
29#include "ola/DmxBuffer.h"
30#include "ola/rdm/RDMControllerInterface.h"
31#include "ola/rdm/RDMEnums.h"
32#include "ola/rdm/UID.h"
33#include "olad/Port.h"
34
35namespace ola {
36namespace plugin {
37namespace dummy {
38
39 class DummyPort: public BasicOutputPort {
40 public:
41 struct Options {
42 public:
43 Options()
44 : number_of_dimmers(1),
45 dimmer_sub_device_count(4),
46 number_of_moving_lights(1),
47 number_of_dummy_responders(1),
48 number_of_ack_timer_responders(0),
49 number_of_advanced_dimmers(1),
50 number_of_sensor_responders(1),
51 number_of_network_responders(1) {
52 }
53
54 uint8_t number_of_dimmers;
55 uint16_t dimmer_sub_device_count;
56 uint8_t number_of_moving_lights;
57 uint8_t number_of_dummy_responders;
58 uint8_t number_of_ack_timer_responders;
59 uint8_t number_of_advanced_dimmers;
60 uint8_t number_of_sensor_responders;
61 uint8_t number_of_network_responders;
62 };
63
64
72 DummyPort(class DummyDevice *parent,
73 const Options &options,
74 unsigned int id);
75 virtual ~DummyPort();
76 bool WriteDMX(const DmxBuffer &buffer, uint8_t priority);
77 std::string Description() const { return "Dummy Port"; }
78 void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
79 void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
80
81 /*
82 * Handle an RDM Request
83 */
84 void SendRDMRequest(ola::rdm::RDMRequest *request,
85 ola::rdm::RDMCallback *callback);
86
87 private:
88 typedef struct {
89 unsigned int expected_count;
90 unsigned int current_count;
91 bool failed;
92 ola::rdm::RDMCallback *callback;
93 } broadcast_request_tracker;
94
95 typedef std::map<ola::rdm::UID,
96 ola::rdm::RDMControllerInterface*> ResponderMap;
97
98 DmxBuffer m_buffer;
99 ResponderMap m_responders;
100
101 void RunDiscovery(ola::rdm::RDMDiscoveryCallback *callback);
102 void HandleBroadcastAck(broadcast_request_tracker *tracker,
103 ola::rdm::RDMReply *reply);
104
105 // See https://wiki.openlighting.org/index.php/Open_Lighting_Allocations
106 // Do not change.
107 static const unsigned int kStartAddress = 0xffffff00;
108};
109} // namespace dummy
110} // namespace plugin
111} // namespace ola
112#endif // PLUGINS_DUMMY_DUMMYPORT_H_
Constants.h
Constants used throughout OLA.
DmxBuffer.h
A class used to hold a single universe of DMX data.
RDMControllerInterface.h
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
RDMEnums.h
Various constants used in RDM.
UID.h
A RDM unique identifier (UID).
ola::BasicOutputPort::BasicOutputPort
BasicOutputPort(AbstractDevice *parent, unsigned int port_id, bool start_rdm_discovery_on_patch=false, bool supports_rdm=false)
Create a new BasicOutputPort.
Definition Port.cpp:120
ola::DmxBuffer
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
ola::plugin::dummy::DummyDevice
Definition DummyDevice.h:35
ola::plugin::dummy::DummyPort::WriteDMX
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition DummyPort.cpp:113
ola::plugin::dummy::DummyPort::RunFullDiscovery
void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition DummyPort.cpp:127
ola::plugin::dummy::DummyPort::DummyPort
DummyPort(class DummyDevice *parent, const Options &options, unsigned int id)
Definition DummyPort.cpp:73
ola::plugin::dummy::DummyPort::Description
std::string Description() const
Fetch the string description for a Port.
Definition DummyPort.h:77
ola::plugin::dummy::DummyPort::SendRDMRequest
void SendRDMRequest(ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *callback)
Handle an RDMRequest, subclasses can implement this to support RDM.
Definition DummyPort.cpp:135
ola::plugin::dummy::DummyPort::RunIncrementalDiscovery
void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition DummyPort.cpp:131
ola::rdm::RDMControllerInterface
The interface that can send RDMRequest.
Definition RDMControllerInterface.h:73
ola::rdm::RDMRequest
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::plugin::dummy
The Dummy plugin.
ola::plugin
Code for supported devices and protocols.
ola::rdm::RDMCallback
ola::BaseCallback1< void, RDMReply * > RDMCallback
The callback run when a RDM request completes.
Definition RDMControllerInterface.h:52
ola::rdm::RDMDiscoveryCallback
ola::BaseCallback1< void, const ola::rdm::UIDSet & > RDMDiscoveryCallback
The callback run when a discovery operation completes.
Definition RDMControllerInterface.h:68
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::plugin::dummy::DummyPort::Options
Definition DummyPort.h:41
ola::rdm::RDMReply
Holds the final state of an RDM request.
Definition RDMReply.h:43