39 #ifndef INCLUDE_OLA_RDM_RDMAPI_H_
40 #define INCLUDE_OLA_RDM_RDMAPI_H_
59 uint16_t status_message_id;
73 uint8_t command_class;
77 uint32_t default_value;
79 std::string description;
87 uint8_t protocol_version_high;
88 uint8_t protocol_version_low;
89 uint16_t device_model;
90 uint16_t product_category;
91 uint32_t software_version;
92 uint16_t dmx_footprint;
93 uint8_t current_personality;
94 uint8_t personality_count;
95 uint16_t dmx_start_address;
96 uint16_t sub_device_count;
98 } __attribute__((packed));
107 uint16_t slot_offset;
110 } __attribute__((packed));
118 uint16_t slot_offset;
119 uint8_t default_value;
120 } __attribute__((packed));
129 uint8_t sensor_number;
137 uint8_t recorded_value_support;
138 std::string description;
146 uint8_t sensor_number;
147 int16_t present_value;
151 } __attribute__((packed));
165 } __attribute__((packed));
177 uint16_t device_count,
178 bool list_changed) = 0;
180 const std::vector<UID> &uids) = 0;
182 uint16_t short_message,
183 uint16_t length_mismatch,
184 uint16_t checksum_fail) = 0;
186 const std::vector<StatusMessage> &messages) = 0;
188 const std::string &status_id) = 0;
190 uint8_t status_type) = 0;
191 virtual void SupportedParameters(
193 const std::vector<uint16_t> ¶meters) = 0;
194 virtual void ParameterDescription(
200 const std::vector<uint16_t> &ids) = 0;
202 const std::string &description) = 0;
204 const std::string &label) = 0;
206 const std::string &label) = 0;
208 bool using_defaults) = 0;
209 virtual void LanguageCapabilities(
211 const std::vector<std::string> &langs) = 0;
213 const std::string &language) = 0;
215 const std::string &label) = 0;
217 uint32_t version) = 0;
218 virtual void BootSoftwareVersionLabel(
const ResponseStatus &status,
219 const std::string &label) = 0;
221 uint8_t current_personality,
222 uint8_t personality_count) = 0;
223 virtual void DMXPersonalityDescription(
const ResponseStatus &status,
225 uint16_t slots_requires,
226 const std::string &label) = 0;
228 uint16_t start_address) = 0;
230 const std::vector<SlotDescriptor> &slots) = 0;
232 uint16_t slot_offset,
233 const std::string &description) = 0;
234 virtual void SlotDefaultValues(
236 const std::vector<SlotDefault> &defaults) = 0;
254 uint8_t invert_mode) = 0;
258 uint8_t inverted) = 0;
260 uint8_t inverted) = 0;
262 uint8_t inverted) = 0;
268 uint8_t power_state) = 0;
270 uint8_t reset_device) = 0;
272 bool is_enabled) = 0;
274 uint8_t self_test_number,
275 const std::string &description) = 0;
277 uint16_t preset_mode,
282 const std::string &data) = 0;
297 uint8_t OutstandingMessagesCount(
const UID &uid);
300 bool GetProxiedDeviceCount(
301 unsigned int universe,
309 bool GetProxiedDevices(
310 unsigned int universe,
314 const std::vector<UID>&> *callback,
319 unsigned int universe,
328 bool ClearCommStatus(
329 unsigned int universe,
339 unsigned int universe,
341 rdm_status_type status_type,
348 unsigned int universe,
350 rdm_status_type status_type,
354 const std::string&> *callback,
357 bool GetStatusMessage(
358 unsigned int universe,
360 rdm_status_type status_type,
363 const std::vector<StatusMessage>&> *callback,
366 bool GetStatusIdDescription(
367 unsigned int universe,
371 const std::string&> *callback,
375 unsigned int universe,
381 bool GetSubDeviceReporting(
382 unsigned int universe,
390 bool SetSubDeviceReporting(
391 unsigned int universe,
394 rdm_status_type status_type,
399 bool GetSupportedParameters(
400 unsigned int universe,
405 const std::vector<uint16_t> &> *callback,
408 bool GetParameterDescription(
409 unsigned int universe,
418 unsigned int universe,
426 bool GetProductDetailIdList(
427 unsigned int universe,
432 const std::vector<uint16_t> &> *callback,
435 bool GetDeviceModelDescription(
436 unsigned int universe,
441 const std::string&> *callback,
444 bool GetManufacturerLabel(
445 unsigned int universe,
450 const std::string&> *callback,
454 unsigned int universe,
459 const std::string&> *callback,
463 unsigned int universe,
466 const std::string &label,
470 bool GetFactoryDefaults(
471 unsigned int universe,
479 bool ResetToFactoryDefaults(
480 unsigned int universe,
486 bool GetLanguageCapabilities(
487 unsigned int universe,
492 const std::vector<std::string>&> *callback,
496 unsigned int universe,
501 const std::string&> *callback,
505 unsigned int universe,
508 const std::string &language,
512 bool GetSoftwareVersionLabel(
513 unsigned int universe,
518 const std::string&> *callback,
521 bool GetBootSoftwareVersion(
522 unsigned int universe,
530 bool GetBootSoftwareVersionLabel(
531 unsigned int universe,
536 const std::string&> *callback,
539 bool GetDMXPersonality(
540 unsigned int universe,
549 bool SetDMXPersonality(
550 unsigned int universe,
557 bool GetDMXPersonalityDescription(
558 unsigned int universe,
566 const std::string&> *callback,
570 unsigned int universe,
579 unsigned int universe,
582 uint16_t start_address,
587 unsigned int universe,
592 const std::vector<SlotDescriptor>&> *callback,
595 bool GetSlotDescription(
596 unsigned int universe,
599 uint16_t slot_offset,
603 const std::string&> *callback,
606 bool GetSlotDefaultValues(
607 unsigned int universe,
612 const std::vector<SlotDefault>&> *callback,
615 bool GetSensorDefinition(
616 unsigned int universe,
619 uint8_t sensor_number,
626 unsigned int universe,
629 uint8_t sensor_number,
636 unsigned int universe,
639 uint8_t sensor_number,
646 unsigned int universe,
649 uint8_t sensor_number,
654 unsigned int universe,
663 unsigned int universe,
666 uint32_t device_hours,
671 unsigned int universe,
680 unsigned int universe,
688 unsigned int universe,
697 unsigned int universe,
700 uint32_t lamp_strikes,
705 unsigned int universe,
712 unsigned int universe,
720 unsigned int universe,
727 unsigned int universe,
734 bool GetDevicePowerCycles(
735 unsigned int universe,
743 bool SetDevicePowerCycles(
744 unsigned int universe,
747 uint32_t power_cycles,
751 bool GetDisplayInvert(
752 unsigned int universe,
758 bool SetDisplayInvert(
759 unsigned int universe,
762 uint8_t display_invert,
766 bool GetDisplayLevel(
767 unsigned int universe,
773 bool SetDisplayLevel(
774 unsigned int universe,
777 uint8_t display_level,
782 unsigned int universe,
789 unsigned int universe,
797 unsigned int universe,
804 unsigned int universe,
812 unsigned int universe,
819 unsigned int universe,
827 unsigned int universe,
836 unsigned int universe,
843 bool GetIdentifyMode(
844 unsigned int universe,
851 unsigned int universe,
859 unsigned int universe,
867 unsigned int universe,
874 unsigned int universe,
877 rdm_power_state power_state,
882 unsigned int universe,
885 rdm_reset_device_mode reset_device,
889 bool SelfTestEnabled(
890 unsigned int universe,
896 bool PerformSelfTest(
897 unsigned int universe,
900 uint8_t self_test_number,
904 bool SelfTestDescription(
905 unsigned int universe,
908 uint8_t self_test_number,
912 const std::string&> *callback,
916 unsigned int universe,
920 uint16_t fade_up_time,
921 uint16_t fade_down_time,
926 bool PresetPlaybackMode(
927 unsigned int universe,
936 bool SetPresetPlaybackMode(
937 unsigned int universe,
940 uint16_t playback_mode,
948 void _HandleLabelResponse(
951 const std::string&> *callback,
953 const std::string &data);
955 void _HandleBoolResponse(
960 const std::string &data);
962 void _HandleU8Response(
967 const std::string &data);
969 void _HandleU32Response(
974 const std::string &data);
976 void _HandleEmptyResponse(
979 const std::string &data);
982 void _HandleGetProxiedDeviceCount(
988 const std::string &data);
990 void _HandleGetProxiedDevices(
993 const std::vector<UID>&> *callback,
995 const std::string &data);
997 void _HandleGetCommStatus(
1002 uint16_t> *callback,
1004 const std::string &data);
1006 void _HandleQueuedMessage(
1010 const std::string &data);
1012 void _HandleGetStatusMessage(
1015 const std::vector<StatusMessage>&> *callback,
1017 const std::string &data);
1019 void _HandleGetSubDeviceReporting(
1024 const std::string &data);
1026 void _HandleGetSupportedParameters(
1029 const std::vector<uint16_t>&> *callback,
1031 const std::string &data);
1033 void _HandleGetParameterDescriptor(
1038 const std::string &data);
1040 void _HandleGetDeviceDescriptor(
1045 const std::string &data);
1047 void _HandleGetProductDetailIdList(
1050 const std::vector<uint16_t>&> *callback,
1052 const std::string &data);
1054 void _HandleGetLanguageCapabilities(
1057 const std::vector<std::string>&> *callback,
1059 const std::string &data);
1061 void _HandleGetLanguage(
1064 const std::string&> *callback,
1066 const std::string &data);
1068 void _HandleGetBootSoftwareVersion(
1071 uint32_t> *callback,
1073 const std::string &data);
1075 void _HandleGetDMXPersonality(
1081 const std::string &data);
1083 void _HandleGetDMXPersonalityDescription(
1088 const std::string&> *callback,
1090 const std::string &data);
1092 void _HandleGetDMXAddress(
1095 uint16_t> *callback,
1097 const std::string &data);
1099 void _HandleGetSlotInfo(
1102 const std::vector<SlotDescriptor>&> *callback,
1104 const std::string &data);
1106 void _HandleGetSlotDescription(
1110 const std::string&> *callback,
1112 const std::string &data);
1114 void _HandleGetSlotDefaultValues(
1117 const std::vector<SlotDefault>&> *callback,
1119 const std::string &data);
1121 void _HandleGetSensorDefinition(
1126 const std::string &data);
1128 void _HandleSensorValue(
1133 const std::string &data);
1140 const std::string &data);
1146 const std::string&> *callback,
1148 const std::string &data);
1156 const std::string &data);
1160 std::map<UID, uint8_t> m_outstanding_messages;
1162 enum {LABEL_SIZE = 32};
1165 unsigned int universe,
1170 std::string *error);
1173 unsigned int universe,
1175 uint16_t sub_device,
1179 std::string *error);
1182 unsigned int universe,
1184 uint16_t sub_device,
1187 uint32_t> *callback,
1189 std::string *error);
1192 unsigned int universe,
1194 uint16_t sub_device,
1198 std::string *error);
1201 template <
typename callback_type>
1202 bool CheckCallback(std::string *error,
const callback_type *cb) {
1205 *error =
"Callback is null, this is a programming error";
1212 template <
typename callback_type>
1213 bool CheckNotBroadcast(
const UID &uid, std::string *error,
1214 const callback_type *cb) {
1217 *error =
"Cannot send to broadcast address";
1225 template <
typename callback_type>
1226 bool CheckValidSubDevice(uint16_t sub_device,
1227 bool broadcast_allowed,
1229 const callback_type *cb) {
1230 if (sub_device <= 0x0200)
1233 if (broadcast_allowed && sub_device == ALL_RDM_SUBDEVICES)
1237 *error =
"Sub device must be <= 0x0200";
1238 if (broadcast_allowed)
1239 *error +=
" or 0xffff";
1245 bool CheckReturnStatus(
bool status, std::string *error);
1247 unsigned int actual,
1248 unsigned int expected);
1252 #endif // INCLUDE_OLA_RDM_RDMAPI_H_