Open Lighting Architecture: include/ola/rdm/RDMAPI.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
RDMAPI.h
Go to the documentation of this file.
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library 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 GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * RDMAPI.h
17 * Provide a generic RDM API that can use different implementations.
18 * Copyright (C) 2010 Simon Newton
19 *
20 * This class provides a high level C++ RDM API for PIDs defined in
21 * E1.20. It includes errors checking for out-of-range arguments. Each RDM
22 * method takes a pointer to a string, which will be populated with an English
23 * error message if the command fails.
24 */
25
39#ifndef INCLUDE_OLA_RDM_RDMAPI_H_
40#define INCLUDE_OLA_RDM_RDMAPI_H_
41
42#include <stdint.h>
43#include <ola/Callback.h>
44#include <ola/base/Macro.h>
45#include <ola/rdm/RDMAPIImplInterface.h>
46#include <ola/rdm/RDMEnums.h>
47#include <ola/rdm/UID.h>
48#include <map>
49#include <string>
50#include <vector>
51
52namespace ola {
53namespace rdm {
54
55/*
56 * Represents a Status Message
57 */
58 typedef struct {
59 uint16_t sub_device;
60 uint16_t status_message_id;
61 int16_t value1;
62 int16_t value2;
63 uint8_t status_type;
64} StatusMessage;
65
66
67/*
68 * Represents the description for a parameter
69 */
70 typedef struct {
71 uint16_t pid;
72 uint8_t pdl_size;
73 uint8_t data_type;
74 uint8_t command_class;
75 uint8_t unit;
76 uint8_t prefix;
77 uint32_t min_value;
78 uint32_t default_value;
79 uint32_t max_value;
80 std::string description;
81} ParameterDescriptor;
82
83
84/*
85 * Represents a DeviceDescriptor reply
86 */
87 PACK(
88struct device_info_s {
89 uint8_t protocol_version_high;
90 uint8_t protocol_version_low;
91 uint16_t device_model;
92 uint16_t product_category;
93 uint32_t software_version;
94 uint16_t dmx_footprint;
95 uint8_t current_personality;
96 uint8_t personality_count;
97 uint16_t dmx_start_address;
98 uint16_t sub_device_count;
99 uint8_t sensor_count;
100});
101
102typedef struct device_info_s DeviceDescriptor;
103
104
105/*
106 * Information about a DMX slot
107 */
108 PACK(
109struct slot_info_s {
110 uint16_t slot_offset;
111 uint8_t slot_type;
112 uint16_t slot_label;
113});
114
115typedef struct slot_info_s SlotDescriptor;
116
117/*
118 * The default values for a slot
119 */
120 PACK(
121struct slot_default_s {
122 uint16_t slot_offset;
123 uint8_t default_value;
124});
125
126typedef struct slot_default_s SlotDefault;
127
128
129/*
130 * Sensor definition
131 */
132 typedef struct {
133 uint8_t sensor_number;
134 uint8_t type;
135 uint8_t unit;
136 uint8_t prefix;
137 int16_t range_min;
138 int16_t range_max;
139 int16_t normal_min;
140 int16_t normal_max;
141 uint8_t recorded_value_support;
142 std::string description;
143} SensorDescriptor;
144
145
146/*
147 * Sensor values
148 */
149 PACK(
150struct sensor_values_s {
151 uint8_t sensor_number;
152 int16_t present_value;
153 int16_t lowest;
154 int16_t highest;
155 int16_t recorded;
156});
157
158typedef struct sensor_values_s SensorValueDescriptor;
159
160/*
161 * Clock structure
162 */
163 PACK(
164struct clock_value_s {
165 uint16_t year;
166 uint8_t month;
167 uint8_t day;
168 uint8_t hour;
169 uint8_t minute;
170 uint8_t second;
171});
172
173typedef struct clock_value_s ClockValue;
174
175/*
176 * The interface for objects which deal with queued messages
177 */
178 class QueuedMessageHandler {
179 public:
180 virtual ~QueuedMessageHandler() {}
181
182 virtual void ProxiedDeviceCount(const ResponseStatus &status,
183 uint16_t device_count,
184 bool list_changed) = 0;
185 virtual void ProxiedDevices(const ResponseStatus &status,
186 const std::vector<UID> &uids) = 0;
187 virtual void CommStatus(const ResponseStatus &status,
188 uint16_t short_message,
189 uint16_t length_mismatch,
190 uint16_t checksum_fail) = 0;
191 virtual void StatusMessages(const ResponseStatus &status,
192 const std::vector<StatusMessage> &messages) = 0;
193 virtual void StatusIdDescription(const ResponseStatus &status,
194 const std::string &status_id) = 0;
195 virtual void SubDeviceReporting(const ResponseStatus &status,
196 uint8_t status_type) = 0;
197 virtual void SupportedParameters(
198 const ResponseStatus &status,
199 const std::vector<uint16_t> &parameters) = 0;
200 virtual void ParameterDescription(
201 const ResponseStatus &status,
202 const ParameterDescriptor &description) = 0;
203 virtual void DeviceInfo(const ResponseStatus &status,
204 const DeviceDescriptor &device_info) = 0;
205 virtual void ProductDetailIdList(const ResponseStatus &status,
206 const std::vector<uint16_t> &ids) = 0;
207 virtual void DeviceModelDescription(const ResponseStatus &status,
208 const std::string &description) = 0;
209 virtual void ManufacturerLabel(const ResponseStatus &status,
210 const std::string &label) = 0;
211 virtual void DeviceLabel(const ResponseStatus &status,
212 const std::string &label) = 0;
213 virtual void FactoryDefaults(const ResponseStatus &status,
214 bool using_defaults) = 0;
215 virtual void LanguageCapabilities(
216 const ResponseStatus &status,
217 const std::vector<std::string> &langs) = 0;
218 virtual void Language(const ResponseStatus &status,
219 const std::string &language) = 0;
220 virtual void SoftwareVersionLabel(const ResponseStatus &status,
221 const std::string &label) = 0;
222 virtual void BootSoftwareVersion(const ResponseStatus &status,
223 uint32_t version) = 0;
224 virtual void BootSoftwareVersionLabel(const ResponseStatus &status,
225 const std::string &label) = 0;
226 virtual void DMXPersonality(const ResponseStatus &status,
227 uint8_t current_personality,
228 uint8_t personality_count) = 0;
229 virtual void DMXPersonalityDescription(const ResponseStatus &status,
230 uint8_t personality,
231 uint16_t slots_requires,
232 const std::string &label) = 0;
233 virtual void DMXAddress(const ResponseStatus &status,
234 uint16_t start_address) = 0;
235 virtual void SlotInfo(const ResponseStatus &status,
236 const std::vector<SlotDescriptor> &slots) = 0;
237 virtual void SlotDescription(const ResponseStatus &status,
238 uint16_t slot_offset,
239 const std::string &description) = 0;
240 virtual void SlotDefaultValues(
241 const ResponseStatus &status,
242 const std::vector<SlotDefault> &defaults) = 0;
243 virtual void SensorDefinition(const ResponseStatus &status,
244 const SensorDescriptor &descriptor) = 0;
245 virtual void SensorValue(const ResponseStatus &status,
246 const SensorValueDescriptor &descriptor) = 0;
247 virtual void DeviceHours(const ResponseStatus &status,
248 uint32_t hours) = 0;
249 virtual void LampHours(const ResponseStatus &status,
250 uint32_t hours) = 0;
251 virtual void LampStrikes(const ResponseStatus &status,
252 uint32_t hours) = 0;
253 virtual void LampState(const ResponseStatus &status,
254 uint8_t state) = 0;
255 virtual void LampMode(const ResponseStatus &status,
256 uint8_t mode) = 0;
257 virtual void DevicePowerCycles(const ResponseStatus &status,
258 uint32_t hours) = 0;
259 virtual void DisplayInvert(const ResponseStatus &status,
260 uint8_t invert_mode) = 0;
261 virtual void DisplayLevel(const ResponseStatus &status,
262 uint8_t level) = 0;
263 virtual void PanInvert(const ResponseStatus &status,
264 uint8_t inverted) = 0;
265 virtual void TiltInvert(const ResponseStatus &status,
266 uint8_t inverted) = 0;
267 virtual void PanTiltSwap(const ResponseStatus &status,
268 uint8_t inverted) = 0;
269 virtual void IdentifyDevice(const ResponseStatus &status,
270 bool mode) = 0;
271 virtual void Clock(const ResponseStatus &status,
272 const ClockValue &clock) = 0;
273 virtual void PowerState(const ResponseStatus &status,
274 uint8_t power_state) = 0;
275 virtual void ResetDevice(const ResponseStatus &status,
276 uint8_t reset_device) = 0;
277 virtual void SelfTestEnabled(const ResponseStatus &status,
278 bool is_enabled) = 0;
279 virtual void SelfTestDescription(const ResponseStatus &status,
280 uint8_t self_test_number,
281 const std::string &description) = 0;
282 virtual void PresetPlaybackMode(const ResponseStatus &status,
283 uint16_t preset_mode,
284 uint8_t level) = 0;
285
286 virtual void DefaultHandler(const ResponseStatus &status,
287 uint16_t pid,
288 const std::string &data) = 0;
289};
290
291
292/*
293 * The high level RDM API.
294 */
295 class RDMAPI {
296 public:
297 explicit RDMAPI(class RDMAPIImplInterface *impl):
298 m_impl(impl) {
299 }
300 ~RDMAPI() {}
301
302 // This is used to check for queued messages
303 uint8_t OutstandingMessagesCount(const UID &uid);
304
305 // Proxy methods
306 bool GetProxiedDeviceCount(
307 unsigned int universe,
308 const UID &uid,
309 ola::SingleUseCallback3<void,
310 const ResponseStatus&,
311 uint16_t,
312 bool> *callback,
313 std::string *error);
314
315 bool GetProxiedDevices(
316 unsigned int universe,
317 const UID &uid,
318 ola::SingleUseCallback2<void,
319 const ResponseStatus&,
320 const std::vector<UID>&> *callback,
321 std::string *error);
322
323 // Network Management Methods
324 bool GetCommStatus(
325 unsigned int universe,
326 const UID &uid,
327 ola::SingleUseCallback4<void,
328 const ResponseStatus&,
329 uint16_t,
330 uint16_t,
331 uint16_t> *callback,
332 std::string *error);
333
334 bool ClearCommStatus(
335 unsigned int universe,
336 const UID &uid,
337 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
338 std::string *error);
339
340 // There are two types of queued message calls, one that takes a
341 // QueuedMessageHandler and the other than just takes a callback.
342
343 // When complete, the appropriate method will be called on the handler.
344 bool GetQueuedMessage(
345 unsigned int universe,
346 const UID &uid,
347 rdm_status_type status_type,
348 QueuedMessageHandler *handler,
349 std::string *error);
350
351 // When complete, the callback will be run. It's up to the caller to unpack
352 // the message.
353 bool GetQueuedMessage(
354 unsigned int universe,
355 const UID &uid,
356 rdm_status_type status_type,
357 ola::SingleUseCallback3<void,
358 const ResponseStatus&,
359 uint16_t,
360 const std::string&> *callback,
361 std::string *error);
362
363 bool GetStatusMessage(
364 unsigned int universe,
365 const UID &uid,
366 rdm_status_type status_type,
367 ola::SingleUseCallback2<void,
368 const ResponseStatus&,
369 const std::vector<StatusMessage>&> *callback,
370 std::string *error);
371
372 bool GetStatusIdDescription(
373 unsigned int universe,
374 const UID &uid,
375 uint16_t status_id,
376 ola::SingleUseCallback2<void, const ResponseStatus&,
377 const std::string&> *callback,
378 std::string *error);
379
380 bool ClearStatusId(
381 unsigned int universe,
382 const UID &uid,
383 uint16_t sub_device,
384 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
385 std::string *error);
386
387 bool GetSubDeviceReporting(
388 unsigned int universe,
389 const UID &uid,
390 uint16_t sub_device,
391 ola::SingleUseCallback2<void,
392 const ResponseStatus&,
393 uint8_t> *callback,
394 std::string *error);
395
396 bool SetSubDeviceReporting(
397 unsigned int universe,
398 const UID &uid,
399 uint16_t sub_device,
400 rdm_status_type status_type,
401 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
402 std::string *error);
403
404 // Information Methods
405 bool GetSupportedParameters(
406 unsigned int universe,
407 const UID &uid,
408 uint16_t sub_device,
409 ola::SingleUseCallback2<void,
410 const ResponseStatus&,
411 const std::vector<uint16_t> &> *callback,
412 std::string *error);
413
414 bool GetParameterDescription(
415 unsigned int universe,
416 const UID &uid,
417 uint16_t pid,
418 ola::SingleUseCallback2<void,
419 const ResponseStatus&,
420 const ParameterDescriptor&> *callback,
421 std::string *error);
422
423 bool GetDeviceInfo(
424 unsigned int universe,
425 const UID &uid,
426 uint16_t sub_device,
427 ola::SingleUseCallback2<void,
428 const ResponseStatus&,
429 const DeviceDescriptor&> *callback,
430 std::string *error);
431
432 bool GetProductDetailIdList(
433 unsigned int universe,
434 const UID &uid,
435 uint16_t sub_device,
436 ola::SingleUseCallback2<void,
437 const ResponseStatus&,
438 const std::vector<uint16_t> &> *callback,
439 std::string *error);
440
441 bool GetDeviceModelDescription(
442 unsigned int universe,
443 const UID &uid,
444 uint16_t sub_device,
445 ola::SingleUseCallback2<void,
446 const ResponseStatus&,
447 const std::string&> *callback,
448 std::string *error);
449
450 bool GetManufacturerLabel(
451 unsigned int universe,
452 const UID &uid,
453 uint16_t sub_device,
454 ola::SingleUseCallback2<void,
455 const ResponseStatus&,
456 const std::string&> *callback,
457 std::string *error);
458
459 bool GetDeviceLabel(
460 unsigned int universe,
461 const UID &uid,
462 uint16_t sub_device,
463 ola::SingleUseCallback2<void,
464 const ResponseStatus&,
465 const std::string&> *callback,
466 std::string *error);
467
468 bool SetDeviceLabel(
469 unsigned int universe,
470 const UID &uid,
471 uint16_t sub_device,
472 const std::string &label,
473 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
474 std::string *error);
475
476 bool GetFactoryDefaults(
477 unsigned int universe,
478 const UID &uid,
479 uint16_t sub_device,
480 ola::SingleUseCallback2<void,
481 const ResponseStatus&,
482 bool> *callback,
483 std::string *error);
484
485 bool ResetToFactoryDefaults(
486 unsigned int universe,
487 const UID &uid,
488 uint16_t sub_device,
489 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
490 std::string *error);
491
492 bool GetLanguageCapabilities(
493 unsigned int universe,
494 const UID &uid,
495 uint16_t sub_device,
496 ola::SingleUseCallback2<void,
497 const ResponseStatus&,
498 const std::vector<std::string>&> *callback,
499 std::string *error);
500
501 bool GetLanguage(
502 unsigned int universe,
503 const UID &uid,
504 uint16_t sub_device,
505 ola::SingleUseCallback2<void,
506 const ResponseStatus&,
507 const std::string&> *callback,
508 std::string *error);
509
510 bool SetLanguage(
511 unsigned int universe,
512 const UID &uid,
513 uint16_t sub_device,
514 const std::string &language,
515 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
516 std::string *error);
517
518 bool GetSoftwareVersionLabel(
519 unsigned int universe,
520 const UID &uid,
521 uint16_t sub_device,
522 ola::SingleUseCallback2<void,
523 const ResponseStatus&,
524 const std::string&> *callback,
525 std::string *error);
526
527 bool GetBootSoftwareVersion(
528 unsigned int universe,
529 const UID &uid,
530 uint16_t sub_device,
531 ola::SingleUseCallback2<void,
532 const ResponseStatus&,
533 uint32_t> *callback,
534 std::string *error);
535
536 bool GetBootSoftwareVersionLabel(
537 unsigned int universe,
538 const UID &uid,
539 uint16_t sub_device,
540 ola::SingleUseCallback2<void,
541 const ResponseStatus&,
542 const std::string&> *callback,
543 std::string *error);
544
545 bool GetDMXPersonality(
546 unsigned int universe,
547 const UID &uid,
548 uint16_t sub_device,
549 ola::SingleUseCallback3<void,
550 const ResponseStatus&,
551 uint8_t,
552 uint8_t> *callback,
553 std::string *error);
554
555 bool SetDMXPersonality(
556 unsigned int universe,
557 const UID &uid,
558 uint16_t sub_device,
559 uint8_t personality,
560 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
561 std::string *error);
562
563 bool GetDMXPersonalityDescription(
564 unsigned int universe,
565 const UID &uid,
566 uint16_t sub_device,
567 uint8_t personality,
568 ola::SingleUseCallback4<void,
569 const ResponseStatus&,
570 uint8_t,
571 uint16_t,
572 const std::string&> *callback,
573 std::string *error);
574
575 bool GetDMXAddress(
576 unsigned int universe,
577 const UID &uid,
578 uint16_t sub_device,
579 ola::SingleUseCallback2<void,
580 const ResponseStatus&,
581 uint16_t> *callback,
582 std::string *error);
583
584 bool SetDMXAddress(
585 unsigned int universe,
586 const UID &uid,
587 uint16_t sub_device,
588 uint16_t start_address,
589 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
590 std::string *error);
591
592 bool GetSlotInfo(
593 unsigned int universe,
594 const UID &uid,
595 uint16_t sub_device,
596 ola::SingleUseCallback2<void,
597 const ResponseStatus&,
598 const std::vector<SlotDescriptor>&> *callback,
599 std::string *error);
600
601 bool GetSlotDescription(
602 unsigned int universe,
603 const UID &uid,
604 uint16_t sub_device,
605 uint16_t slot_offset,
606 ola::SingleUseCallback3<void,
607 const ResponseStatus&,
608 uint16_t,
609 const std::string&> *callback,
610 std::string *error);
611
612 bool GetSlotDefaultValues(
613 unsigned int universe,
614 const UID &uid,
615 uint16_t sub_device,
616 ola::SingleUseCallback2<void,
617 const ResponseStatus&,
618 const std::vector<SlotDefault>&> *callback,
619 std::string *error);
620
621 bool GetSensorDefinition(
622 unsigned int universe,
623 const UID &uid,
624 uint16_t sub_device,
625 uint8_t sensor_number,
626 ola::SingleUseCallback2<void,
627 const ResponseStatus&,
628 const SensorDescriptor&> *callback,
629 std::string *error);
630
631 bool GetSensorValue(
632 unsigned int universe,
633 const UID &uid,
634 uint16_t sub_device,
635 uint8_t sensor_number,
636 ola::SingleUseCallback2<void,
637 const ResponseStatus&,
638 const SensorValueDescriptor&> *callback,
639 std::string *error);
640
641 bool SetSensorValue(
642 unsigned int universe,
643 const UID &uid,
644 uint16_t sub_device,
645 uint8_t sensor_number,
646 ola::SingleUseCallback2<void,
647 const ResponseStatus&,
648 const SensorValueDescriptor&> *callback,
649 std::string *error);
650
651 bool RecordSensors(
652 unsigned int universe,
653 const UID &uid,
654 uint16_t sub_device,
655 uint8_t sensor_number,
656 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
657 std::string *error);
658
659 bool GetDeviceHours(
660 unsigned int universe,
661 const UID &uid,
662 uint16_t sub_device,
663 ola::SingleUseCallback2<void,
664 const ResponseStatus&,
665 uint32_t> *callback,
666 std::string *error);
667
668 bool SetDeviceHours(
669 unsigned int universe,
670 const UID &uid,
671 uint16_t sub_device,
672 uint32_t device_hours,
673 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
674 std::string *error);
675
676 bool GetLampHours(
677 unsigned int universe,
678 const UID &uid,
679 uint16_t sub_device,
680 ola::SingleUseCallback2<void,
681 const ResponseStatus&,
682 uint32_t> *callback,
683 std::string *error);
684
685 bool SetLampHours(
686 unsigned int universe,
687 const UID &uid,
688 uint16_t sub_device,
689 uint32_t lamp_hours,
690 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
691 std::string *error);
692
693 bool GetLampStrikes(
694 unsigned int universe,
695 const UID &uid,
696 uint16_t sub_device,
697 ola::SingleUseCallback2<void,
698 const ResponseStatus&,
699 uint32_t> *callback,
700 std::string *error);
701
702 bool SetLampStrikes(
703 unsigned int universe,
704 const UID &uid,
705 uint16_t sub_device,
706 uint32_t lamp_strikes,
707 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
708 std::string *error);
709
710 bool GetLampState(
711 unsigned int universe,
712 const UID &uid,
713 uint16_t sub_device,
714 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
715 std::string *error);
716
717 bool SetLampState(
718 unsigned int universe,
719 const UID &uid,
720 uint16_t sub_device,
721 uint8_t lamp_state,
722 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
723 std::string *error);
724
725 bool GetLampMode(
726 unsigned int universe,
727 const UID &uid,
728 uint16_t sub_device,
729 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
730 std::string *error);
731
732 bool SetLampMode(
733 unsigned int universe,
734 const UID &uid,
735 uint16_t sub_device,
736 uint8_t lamp_mode,
737 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
738 std::string *error);
739
740 bool GetDevicePowerCycles(
741 unsigned int universe,
742 const UID &uid,
743 uint16_t sub_device,
744 ola::SingleUseCallback2<void,
745 const ResponseStatus&,
746 uint32_t> *callback,
747 std::string *error);
748
749 bool SetDevicePowerCycles(
750 unsigned int universe,
751 const UID &uid,
752 uint16_t sub_device,
753 uint32_t power_cycles,
754 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
755 std::string *error);
756
757 bool GetDisplayInvert(
758 unsigned int universe,
759 const UID &uid,
760 uint16_t sub_device,
761 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
762 std::string *error);
763
764 bool SetDisplayInvert(
765 unsigned int universe,
766 const UID &uid,
767 uint16_t sub_device,
768 uint8_t display_invert,
769 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
770 std::string *error);
771
772 bool GetDisplayLevel(
773 unsigned int universe,
774 const UID &uid,
775 uint16_t sub_device,
776 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
777 std::string *error);
778
779 bool SetDisplayLevel(
780 unsigned int universe,
781 const UID &uid,
782 uint16_t sub_device,
783 uint8_t display_level,
784 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
785 std::string *error);
786
787 bool GetPanInvert(
788 unsigned int universe,
789 const UID &uid,
790 uint16_t sub_device,
791 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
792 std::string *error);
793
794 bool SetPanInvert(
795 unsigned int universe,
796 const UID &uid,
797 uint16_t sub_device,
798 uint8_t invert,
799 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
800 std::string *error);
801
802 bool GetTiltInvert(
803 unsigned int universe,
804 const UID &uid,
805 uint16_t sub_device,
806 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
807 std::string *error);
808
809 bool SetTiltInvert(
810 unsigned int universe,
811 const UID &uid,
812 uint16_t sub_device,
813 uint8_t invert,
814 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
815 std::string *error);
816
817 bool GetPanTiltSwap(
818 unsigned int universe,
819 const UID &uid,
820 uint16_t sub_device,
821 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
822 std::string *error);
823
824 bool SetPanTiltSwap(
825 unsigned int universe,
826 const UID &uid,
827 uint16_t sub_device,
828 uint8_t swap,
829 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
830 std::string *error);
831
832 bool GetClock(
833 unsigned int universe,
834 const UID &uid,
835 uint16_t sub_device,
836 ola::SingleUseCallback2<void,
837 const ResponseStatus&,
838 const ClockValue&> *callback,
839 std::string *error);
840
841 bool SetClock(
842 unsigned int universe,
843 const UID &uid,
844 uint16_t sub_device,
845 const ClockValue &clock,
846 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
847 std::string *error);
848
849 bool GetIdentifyDevice(
850 unsigned int universe,
851 const UID &uid,
852 uint16_t sub_device,
853 ola::SingleUseCallback2<void, const ResponseStatus&, bool> *callback,
854 std::string *error);
855
856 bool IdentifyDevice(
857 unsigned int universe,
858 const UID &uid,
859 uint16_t sub_device,
860 bool mode,
861 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
862 std::string *error);
863
864 bool ResetDevice(
865 unsigned int universe,
866 const UID &uid,
867 uint16_t sub_device,
868 bool warm_reset,
869 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
870 std::string *error);
871
872 bool GetPowerState(
873 unsigned int universe,
874 const UID &uid,
875 uint16_t sub_device,
876 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
877 std::string *error);
878
879 bool SetPowerState(
880 unsigned int universe,
881 const UID &uid,
882 uint16_t sub_device,
883 rdm_power_state power_state,
884 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
885 std::string *error);
886
887 bool SetResetDevice(
888 unsigned int universe,
889 const UID &uid,
890 uint16_t sub_device,
891 rdm_reset_device_mode reset_device,
892 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
893 std::string *error);
894
895 bool GetDnsHostname(
896 unsigned int universe,
897 const UID &uid,
898 uint16_t sub_device,
899 ola::SingleUseCallback2<void,
900 const ResponseStatus&,
901 const std::string&> *callback,
902 std::string *error);
903
904 bool SetDnsHostname(
905 unsigned int universe,
906 const UID &uid,
907 uint16_t sub_device,
908 const std::string &label,
909 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
910 std::string *error);
911
912 bool GetDnsDomainName(
913 unsigned int universe,
914 const UID &uid,
915 uint16_t sub_device,
916 ola::SingleUseCallback2<void,
917 const ResponseStatus&,
918 const std::string&> *callback,
919 std::string *error);
920
921 bool SetDnsDomainName(
922 unsigned int universe,
923 const UID &uid,
924 uint16_t sub_device,
925 const std::string &label,
926 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
927 std::string *error);
928
929 bool SelfTestEnabled(
930 unsigned int universe,
931 const UID &uid,
932 uint16_t sub_device,
933 ola::SingleUseCallback2<void, const ResponseStatus&, bool> *callback,
934 std::string *error);
935
936 bool PerformSelfTest(
937 unsigned int universe,
938 const UID &uid,
939 uint16_t sub_device,
940 uint8_t self_test_number,
941 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
942 std::string *error);
943
944 bool SelfTestDescription(
945 unsigned int universe,
946 const UID &uid,
947 uint16_t sub_device,
948 uint8_t self_test_number,
949 ola::SingleUseCallback3<void,
950 const ResponseStatus&,
951 uint8_t,
952 const std::string&> *callback,
953 std::string *error);
954
955 bool CapturePreset(
956 unsigned int universe,
957 const UID &uid,
958 uint16_t sub_device,
959 uint16_t scene,
960 uint16_t fade_up_time,
961 uint16_t fade_down_time,
962 uint16_t wait_time,
963 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
964 std::string *error);
965
966 bool PresetPlaybackMode(
967 unsigned int universe,
968 const UID &uid,
969 uint16_t sub_device,
970 ola::SingleUseCallback3<void,
971 const ResponseStatus&,
972 uint16_t,
973 uint8_t> *callback,
974 std::string *error);
975
976 bool SetPresetPlaybackMode(
977 unsigned int universe,
978 const UID &uid,
979 uint16_t sub_device,
980 uint16_t playback_mode,
981 uint8_t level,
982 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
983 std::string *error);
984
985 // Handlers, these are called by the RDMAPIImpl.
986
987 // Generic handlers
988 void _HandleCustomLengthLabelResponse(
989 ola::SingleUseCallback2<void,
990 const ResponseStatus&,
991 const std::string&> *callback,
992 uint8_t length,
993 const ResponseStatus &status,
994 const std::string &data);
995
996 void _HandleLabelResponse(
997 ola::SingleUseCallback2<void,
998 const ResponseStatus&,
999 const std::string&> *callback,
1000 const ResponseStatus &status,
1001 const std::string &data);
1002
1003 void _HandleBoolResponse(
1004 ola::SingleUseCallback2<void,
1005 const ResponseStatus&,
1006 bool> *callback,
1007 const ResponseStatus &status,
1008 const std::string &data);
1009
1010 void _HandleU8Response(
1011 ola::SingleUseCallback2<void,
1012 const ResponseStatus&,
1013 uint8_t> *callback,
1014 const ResponseStatus &status,
1015 const std::string &data);
1016
1017 void _HandleU32Response(
1018 ola::SingleUseCallback2<void,
1019 const ResponseStatus&,
1020 uint32_t> *callback,
1021 const ResponseStatus &status,
1022 const std::string &data);
1023
1024 void _HandleEmptyResponse(
1025 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
1026 const ResponseStatus &status,
1027 const std::string &data);
1028
1029 // specific handlers follow
1030 void _HandleGetProxiedDeviceCount(
1031 ola::SingleUseCallback3<void,
1032 const ResponseStatus&,
1033 uint16_t,
1034 bool> *callback,
1035 const ResponseStatus &status,
1036 const std::string &data);
1037
1038 void _HandleGetProxiedDevices(
1039 ola::SingleUseCallback2<void,
1040 const ResponseStatus&,
1041 const std::vector<UID>&> *callback,
1042 const ResponseStatus &status,
1043 const std::string &data);
1044
1045 void _HandleGetCommStatus(
1046 ola::SingleUseCallback4<void,
1047 const ResponseStatus&,
1048 uint16_t,
1049 uint16_t,
1050 uint16_t> *callback,
1051 const ResponseStatus &status,
1052 const std::string &data);
1053
1054 void _HandleQueuedMessage(
1055 QueuedMessageHandler *handler,
1056 const ResponseStatus &status,
1057 uint16_t pid,
1058 const std::string &data);
1059
1060 void _HandleGetStatusMessage(
1061 ola::SingleUseCallback2<void,
1062 const ResponseStatus&,
1063 const std::vector<StatusMessage>&> *callback,
1064 const ResponseStatus &status,
1065 const std::string &data);
1066
1067 void _HandleGetSubDeviceReporting(
1068 ola::SingleUseCallback2<void,
1069 const ResponseStatus&,
1070 uint8_t> *callback,
1071 const ResponseStatus &status,
1072 const std::string &data);
1073
1074 void _HandleGetSupportedParameters(
1075 ola::SingleUseCallback2<void,
1076 const ResponseStatus&,
1077 const std::vector<uint16_t>&> *callback,
1078 const ResponseStatus &status,
1079 const std::string &data);
1080
1081 void _HandleGetParameterDescriptor(
1082 ola::SingleUseCallback2<void,
1083 const ResponseStatus&,
1084 const ParameterDescriptor&> *callback,
1085 const ResponseStatus &status,
1086 const std::string &data);
1087
1088 void _HandleGetDeviceDescriptor(
1089 ola::SingleUseCallback2<void,
1090 const ResponseStatus&,
1091 const DeviceDescriptor&> *callback,
1092 const ResponseStatus &status,
1093 const std::string &data);
1094
1095 void _HandleGetProductDetailIdList(
1096 ola::SingleUseCallback2<void,
1097 const ResponseStatus&,
1098 const std::vector<uint16_t>&> *callback,
1099 const ResponseStatus &status,
1100 const std::string &data);
1101
1102 void _HandleGetLanguageCapabilities(
1103 ola::SingleUseCallback2<void,
1104 const ResponseStatus&,
1105 const std::vector<std::string>&> *callback,
1106 const ResponseStatus &status,
1107 const std::string &data);
1108
1109 void _HandleGetLanguage(
1110 ola::SingleUseCallback2<void,
1111 const ResponseStatus&,
1112 const std::string&> *callback,
1113 const ResponseStatus &status,
1114 const std::string &data);
1115
1116 void _HandleGetBootSoftwareVersion(
1117 ola::SingleUseCallback2<void,
1118 const ResponseStatus&,
1119 uint32_t> *callback,
1120 const ResponseStatus &status,
1121 const std::string &data);
1122
1123 void _HandleGetDMXPersonality(
1124 ola::SingleUseCallback3<void,
1125 const ResponseStatus&,
1126 uint8_t,
1127 uint8_t> *callback,
1128 const ResponseStatus &status,
1129 const std::string &data);
1130
1131 void _HandleGetDMXPersonalityDescription(
1132 ola::SingleUseCallback4<void,
1133 const ResponseStatus&,
1134 uint8_t,
1135 uint16_t,
1136 const std::string&> *callback,
1137 const ResponseStatus &status,
1138 const std::string &data);
1139
1140 void _HandleGetDMXAddress(
1141 ola::SingleUseCallback2<void,
1142 const ResponseStatus&,
1143 uint16_t> *callback,
1144 const ResponseStatus &status,
1145 const std::string &data);
1146
1147 void _HandleGetSlotInfo(
1148 ola::SingleUseCallback2<void,
1149 const ResponseStatus&,
1150 const std::vector<SlotDescriptor>&> *callback,
1151 const ResponseStatus &status,
1152 const std::string &data);
1153
1154 void _HandleGetSlotDescription(
1155 ola::SingleUseCallback3<void,
1156 const ResponseStatus&,
1157 uint16_t,
1158 const std::string&> *callback,
1159 const ResponseStatus &status,
1160 const std::string &data);
1161
1162 void _HandleGetSlotDefaultValues(
1163 ola::SingleUseCallback2<void,
1164 const ResponseStatus&,
1165 const std::vector<SlotDefault>&> *callback,
1166 const ResponseStatus &status,
1167 const std::string &data);
1168
1169 void _HandleGetSensorDefinition(
1170 ola::SingleUseCallback2<void,
1171 const ResponseStatus&,
1172 const SensorDescriptor&> *callback,
1173 const ResponseStatus &status,
1174 const std::string &data);
1175
1176 void _HandleSensorValue(
1177 ola::SingleUseCallback2<void,
1178 const ResponseStatus&,
1179 const SensorValueDescriptor&> *callback,
1180 const ResponseStatus &status,
1181 const std::string &data);
1182
1183 void _HandleClock(
1184 ola::SingleUseCallback2<void,
1185 const ResponseStatus&,
1186 const ClockValue&> *callback,
1187 const ResponseStatus &status,
1188 const std::string &data);
1189
1190 void _HandleSelfTestDescription(
1191 ola::SingleUseCallback3<void,
1192 const ResponseStatus&,
1193 uint8_t,
1194 const std::string&> *callback,
1195 const ResponseStatus &status,
1196 const std::string &data);
1197
1198 void _HandlePlaybackMode(
1199 ola::SingleUseCallback3<void,
1200 const ResponseStatus&,
1201 uint16_t,
1202 uint8_t> *callback,
1203 const ResponseStatus &status,
1204 const std::string &data);
1205
1206 private:
1207 class RDMAPIImplInterface *m_impl;
1208 std::map<UID, uint8_t> m_outstanding_messages;
1209
1210 bool GenericGetU8(
1211 unsigned int universe,
1212 const UID &uid,
1213 uint8_t sub_device,
1214 ola::SingleUseCallback2<void, const ResponseStatus&, uint8_t> *callback,
1215 uint16_t pid,
1216 std::string *error);
1217
1218 bool GenericSetU8(
1219 unsigned int universe,
1220 const UID &uid,
1221 uint16_t sub_device,
1222 uint8_t value,
1223 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
1224 uint16_t pid,
1225 std::string *error);
1226
1227 bool GenericGetU32(
1228 unsigned int universe,
1229 const UID &uid,
1230 uint16_t sub_device,
1231 ola::SingleUseCallback2<void,
1232 const ResponseStatus&,
1233 uint32_t> *callback,
1234 uint16_t pid,
1235 std::string *error);
1236
1237 bool GenericSetU32(
1238 unsigned int universe,
1239 const UID &uid,
1240 uint16_t sub_device,
1241 uint32_t value,
1242 ola::SingleUseCallback1<void, const ResponseStatus&> *callback,
1243 uint16_t pid,
1244 std::string *error);
1245
1246 // Check that a callback is not null
1247 template <typename callback_type>
1248 bool CheckCallback(std::string *error, const callback_type *cb) {
1249 if (cb == NULL) {
1250 if (error)
1251 *error = "Callback is null, this is a programming error";
1252 return true;
1253 }
1254 return false;
1255 }
1256
1257 // Check that a UID is not a broadcast address
1258 template <typename callback_type>
1259 bool CheckNotBroadcast(const UID &uid, std::string *error,
1260 const callback_type *cb) {
1261 if (uid.IsBroadcast()) {
1262 if (error)
1263 *error = "Cannot send to broadcast address";
1264 delete cb;
1265 return true;
1266 }
1267 return false;
1268 }
1269
1270 // Check the subdevice value is valid
1271 template <typename callback_type>
1272 bool CheckValidSubDevice(uint16_t sub_device,
1273 bool broadcast_allowed,
1274 std::string *error,
1275 const callback_type *cb) {
1276 if (sub_device <= 0x0200)
1277 return false;
1278
1279 if (broadcast_allowed && sub_device == ALL_RDM_SUBDEVICES)
1280 return false;
1281
1282 if (error) {
1283 *error = "Sub device must be <= 0x0200";
1284 if (broadcast_allowed)
1285 *error += " or 0xffff";
1286 }
1287 delete cb;
1288 return true;
1289 }
1290
1291 bool CheckReturnStatus(bool status, std::string *error);
1292 void SetIncorrectPDL(ResponseStatus *status,
1293 unsigned int actual,
1294 unsigned int expected);
1295};
1296} // namespace rdm
1297} // namespace ola
1298#endif // INCLUDE_OLA_RDM_RDMAPI_H_
Callback.h
Macro.h
Helper macros.
PACK
#define PACK(__Declaration__)
Pack structures.
Definition Macro.h:171
RDMAPIImplInterface.h
The interface for an RDM API Implementation.
RDMEnums.h
Various constants used in RDM.
UID.h
A RDM unique identifier (UID).
ola::SingleUseCallback1
A 1 argument callback which deletes itself after it's run.
Definition Callback.h:1004
ola::SingleUseCallback2
A 2 argument callback which deletes itself after it's run.
Definition Callback.h:1907
ola::SingleUseCallback3
A 3 argument callback which deletes itself after it's run.
Definition Callback.h:2850
ola::SingleUseCallback4
A 4 argument callback which deletes itself after it's run.
Definition Callback.h:3833
ola::rdm::QueuedMessageHandler
Definition RDMAPI.h:178
ola::rdm::RDMAPI::_HandlePlaybackMode
void _HandlePlaybackMode(ola::SingleUseCallback3< void, const ResponseStatus &, uint16_t, uint8_t > *callback, const ResponseStatus &status, const std::string &data)
Definition RDMAPI.cpp:3756
ola::rdm::RDMAPI::_HandleSelfTestDescription
void _HandleSelfTestDescription(ola::SingleUseCallback3< void, const ResponseStatus &, uint8_t, const std::string & > *callback, const ResponseStatus &status, const std::string &data)
Definition RDMAPI.cpp:3710
ola::rdm::RDMAPI::GetQueuedMessage
bool GetQueuedMessage(unsigned int universe, const UID &uid, rdm_status_type status_type, QueuedMessageHandler *handler, std::string *error)
Definition RDMAPI.cpp:198
ola::rdm::RDMAPIImplInterface
This is the interface for an RDMAPI implementation.
Definition RDMAPIImplInterface.h:83
ola::rdm::ResponseStatus
Represents the state of a response and/or any error codes.
Definition RDMAPIImplInterface.h:51
ola::rdm::UID
Represents a RDM UID.
Definition UID.h:57
ola::rdm::UID::IsBroadcast
bool IsBroadcast() const
Check if this UID is a broadcast or vendorcast UID.
Definition UID.h:150
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::rdm::ParameterDescriptor
Definition RDMAPI.h:70
ola::rdm::SensorDescriptor
Definition RDMAPI.h:132
ola::rdm::StatusMessage
Definition RDMAPI.h:58