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"
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
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"; }
80
81 /*
82 * Handle an RDM Request
83 */
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,
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 used throughout OLA.
A class used to hold a single universe of DMX data.
Definitions and Interfaces to implement an RDMController that sends a single message at a time.
Various constants used in RDM.
A RDM unique identifier (UID).
The base class for all 1 argument callbacks.
Definition Callback.h:982
Definition Port.h:283
Used to hold a single universe of DMX data.
Definition DmxBuffer.h:49
Definition DummyDevice.h:35
Definition DummyPort.h:39
bool WriteDMX(const DmxBuffer &buffer, uint8_t priority)
Write DMX data to this port.
Definition DummyPort.cpp:113
void RunFullDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition DummyPort.cpp:127
DummyPort(class DummyDevice *parent, const Options &options, unsigned int id)
Definition DummyPort.cpp:73
std::string Description() const
Fetch the string description for a Port.
Definition DummyPort.h:77
void SendRDMRequest(ola::rdm::RDMRequest *request, ola::rdm::RDMCallback *callback)
Handle an RDMRequest, subclasses can implement this to support RDM.
Definition DummyPort.cpp:135
void RunIncrementalDiscovery(ola::rdm::RDMDiscoveryCallback *callback)
This is a noop for ports that don't support RDM.
Definition DummyPort.cpp:131
The interface that can send RDMRequest.
Definition RDMControllerInterface.h:73
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
Represents a RDM UID.
Definition UID.h:57
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
Holds the final state of an RDM request.
Definition RDMReply.h:43