39 #ifndef INCLUDE_OLA_RDM_RDMAPI_H_
40 #define INCLUDE_OLA_RDM_RDMAPI_H_
60 uint16_t status_message_id;
74 uint8_t command_class;
78 uint32_t default_value;
80 std::string description;
88 struct 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;
102 typedef struct device_info_s DeviceDescriptor;
110 uint16_t slot_offset;
115 typedef struct slot_info_s SlotDescriptor;
121 struct slot_default_s {
122 uint16_t slot_offset;
123 uint8_t default_value;
126 typedef struct slot_default_s SlotDefault;
133 uint8_t sensor_number;
141 uint8_t recorded_value_support;
142 std::string description;
150 struct sensor_values_s {
151 uint8_t sensor_number;
152 int16_t present_value;
158 typedef struct sensor_values_s SensorValueDescriptor;
164 struct clock_value_s {
173 typedef struct clock_value_s ClockValue;
183 uint16_t device_count,
184 bool list_changed) = 0;
186 const std::vector<UID> &uids) = 0;
188 uint16_t short_message,
189 uint16_t length_mismatch,
190 uint16_t checksum_fail) = 0;
192 const std::vector<StatusMessage> &messages) = 0;
194 const std::string &status_id) = 0;
196 uint8_t status_type) = 0;
197 virtual void SupportedParameters(
199 const std::vector<uint16_t> ¶meters) = 0;
200 virtual void ParameterDescription(
204 const DeviceDescriptor &device_info) = 0;
206 const std::vector<uint16_t> &ids) = 0;
208 const std::string &description) = 0;
210 const std::string &label) = 0;
212 const std::string &label) = 0;
214 bool using_defaults) = 0;
215 virtual void LanguageCapabilities(
217 const std::vector<std::string> &langs) = 0;
219 const std::string &language) = 0;
221 const std::string &label) = 0;
223 uint32_t version) = 0;
224 virtual void BootSoftwareVersionLabel(
const ResponseStatus &status,
225 const std::string &label) = 0;
227 uint8_t current_personality,
228 uint8_t personality_count) = 0;
229 virtual void DMXPersonalityDescription(
const ResponseStatus &status,
231 uint16_t slots_requires,
232 const std::string &label) = 0;
234 uint16_t start_address) = 0;
236 const std::vector<SlotDescriptor> &slots) = 0;
238 uint16_t slot_offset,
239 const std::string &description) = 0;
240 virtual void SlotDefaultValues(
242 const std::vector<SlotDefault> &defaults) = 0;
246 const SensorValueDescriptor &descriptor) = 0;
260 uint8_t invert_mode) = 0;
264 uint8_t inverted) = 0;
266 uint8_t inverted) = 0;
268 uint8_t inverted) = 0;
272 const ClockValue &clock) = 0;
274 uint8_t power_state) = 0;
276 uint8_t reset_device) = 0;
278 bool is_enabled) = 0;
280 uint8_t self_test_number,
281 const std::string &description) = 0;
283 uint16_t preset_mode,
288 const std::string &data) = 0;
303 uint8_t OutstandingMessagesCount(
const UID &uid);
306 bool GetProxiedDeviceCount(
307 unsigned int universe,
315 bool GetProxiedDevices(
316 unsigned int universe,
320 const std::vector<UID>&> *callback,
325 unsigned int universe,
334 bool ClearCommStatus(
335 unsigned int universe,
345 unsigned int universe,
347 rdm_status_type status_type,
354 unsigned int universe,
356 rdm_status_type status_type,
360 const std::string&> *callback,
363 bool GetStatusMessage(
364 unsigned int universe,
366 rdm_status_type status_type,
369 const std::vector<StatusMessage>&> *callback,
372 bool GetStatusIdDescription(
373 unsigned int universe,
377 const std::string&> *callback,
381 unsigned int universe,
387 bool GetSubDeviceReporting(
388 unsigned int universe,
396 bool SetSubDeviceReporting(
397 unsigned int universe,
400 rdm_status_type status_type,
405 bool GetSupportedParameters(
406 unsigned int universe,
411 const std::vector<uint16_t> &> *callback,
414 bool GetParameterDescription(
415 unsigned int universe,
424 unsigned int universe,
429 const DeviceDescriptor&> *callback,
432 bool GetProductDetailIdList(
433 unsigned int universe,
438 const std::vector<uint16_t> &> *callback,
441 bool GetDeviceModelDescription(
442 unsigned int universe,
447 const std::string&> *callback,
450 bool GetManufacturerLabel(
451 unsigned int universe,
456 const std::string&> *callback,
460 unsigned int universe,
465 const std::string&> *callback,
469 unsigned int universe,
472 const std::string &label,
476 bool GetFactoryDefaults(
477 unsigned int universe,
485 bool ResetToFactoryDefaults(
486 unsigned int universe,
492 bool GetLanguageCapabilities(
493 unsigned int universe,
498 const std::vector<std::string>&> *callback,
502 unsigned int universe,
507 const std::string&> *callback,
511 unsigned int universe,
514 const std::string &language,
518 bool GetSoftwareVersionLabel(
519 unsigned int universe,
524 const std::string&> *callback,
527 bool GetBootSoftwareVersion(
528 unsigned int universe,
536 bool GetBootSoftwareVersionLabel(
537 unsigned int universe,
542 const std::string&> *callback,
545 bool GetDMXPersonality(
546 unsigned int universe,
555 bool SetDMXPersonality(
556 unsigned int universe,
563 bool GetDMXPersonalityDescription(
564 unsigned int universe,
572 const std::string&> *callback,
576 unsigned int universe,
585 unsigned int universe,
588 uint16_t start_address,
593 unsigned int universe,
598 const std::vector<SlotDescriptor>&> *callback,
601 bool GetSlotDescription(
602 unsigned int universe,
605 uint16_t slot_offset,
609 const std::string&> *callback,
612 bool GetSlotDefaultValues(
613 unsigned int universe,
618 const std::vector<SlotDefault>&> *callback,
621 bool GetSensorDefinition(
622 unsigned int universe,
625 uint8_t sensor_number,
632 unsigned int universe,
635 uint8_t sensor_number,
638 const SensorValueDescriptor&> *callback,
642 unsigned int universe,
645 uint8_t sensor_number,
648 const SensorValueDescriptor&> *callback,
652 unsigned int universe,
655 uint8_t sensor_number,
660 unsigned int universe,
669 unsigned int universe,
672 uint32_t device_hours,
677 unsigned int universe,
686 unsigned int universe,
694 unsigned int universe,
703 unsigned int universe,
706 uint32_t lamp_strikes,
711 unsigned int universe,
718 unsigned int universe,
726 unsigned int universe,
733 unsigned int universe,
740 bool GetDevicePowerCycles(
741 unsigned int universe,
749 bool SetDevicePowerCycles(
750 unsigned int universe,
753 uint32_t power_cycles,
757 bool GetDisplayInvert(
758 unsigned int universe,
764 bool SetDisplayInvert(
765 unsigned int universe,
768 uint8_t display_invert,
772 bool GetDisplayLevel(
773 unsigned int universe,
779 bool SetDisplayLevel(
780 unsigned int universe,
783 uint8_t display_level,
788 unsigned int universe,
795 unsigned int universe,
803 unsigned int universe,
810 unsigned int universe,
818 unsigned int universe,
825 unsigned int universe,
833 unsigned int universe,
838 const ClockValue&> *callback,
842 unsigned int universe,
845 const ClockValue &clock,
849 bool GetIdentifyDevice(
850 unsigned int universe,
857 unsigned int universe,
865 unsigned int universe,
873 unsigned int universe,
880 unsigned int universe,
883 rdm_power_state power_state,
888 unsigned int universe,
891 rdm_reset_device_mode reset_device,
895 bool SelfTestEnabled(
896 unsigned int universe,
902 bool PerformSelfTest(
903 unsigned int universe,
906 uint8_t self_test_number,
910 bool SelfTestDescription(
911 unsigned int universe,
914 uint8_t self_test_number,
918 const std::string&> *callback,
922 unsigned int universe,
926 uint16_t fade_up_time,
927 uint16_t fade_down_time,
932 bool PresetPlaybackMode(
933 unsigned int universe,
942 bool SetPresetPlaybackMode(
943 unsigned int universe,
946 uint16_t playback_mode,
954 void _HandleLabelResponse(
957 const std::string&> *callback,
959 const std::string &data);
961 void _HandleBoolResponse(
966 const std::string &data);
968 void _HandleU8Response(
973 const std::string &data);
975 void _HandleU32Response(
980 const std::string &data);
982 void _HandleEmptyResponse(
985 const std::string &data);
988 void _HandleGetProxiedDeviceCount(
994 const std::string &data);
996 void _HandleGetProxiedDevices(
999 const std::vector<UID>&> *callback,
1001 const std::string &data);
1003 void _HandleGetCommStatus(
1008 uint16_t> *callback,
1010 const std::string &data);
1012 void _HandleQueuedMessage(
1016 const std::string &data);
1018 void _HandleGetStatusMessage(
1021 const std::vector<StatusMessage>&> *callback,
1023 const std::string &data);
1025 void _HandleGetSubDeviceReporting(
1030 const std::string &data);
1032 void _HandleGetSupportedParameters(
1035 const std::vector<uint16_t>&> *callback,
1037 const std::string &data);
1039 void _HandleGetParameterDescriptor(
1044 const std::string &data);
1046 void _HandleGetDeviceDescriptor(
1049 const DeviceDescriptor&> *callback,
1051 const std::string &data);
1053 void _HandleGetProductDetailIdList(
1056 const std::vector<uint16_t>&> *callback,
1058 const std::string &data);
1060 void _HandleGetLanguageCapabilities(
1063 const std::vector<std::string>&> *callback,
1065 const std::string &data);
1067 void _HandleGetLanguage(
1070 const std::string&> *callback,
1072 const std::string &data);
1074 void _HandleGetBootSoftwareVersion(
1077 uint32_t> *callback,
1079 const std::string &data);
1081 void _HandleGetDMXPersonality(
1087 const std::string &data);
1089 void _HandleGetDMXPersonalityDescription(
1094 const std::string&> *callback,
1096 const std::string &data);
1098 void _HandleGetDMXAddress(
1101 uint16_t> *callback,
1103 const std::string &data);
1105 void _HandleGetSlotInfo(
1108 const std::vector<SlotDescriptor>&> *callback,
1110 const std::string &data);
1112 void _HandleGetSlotDescription(
1116 const std::string&> *callback,
1118 const std::string &data);
1120 void _HandleGetSlotDefaultValues(
1123 const std::vector<SlotDefault>&> *callback,
1125 const std::string &data);
1127 void _HandleGetSensorDefinition(
1132 const std::string &data);
1134 void _HandleSensorValue(
1137 const SensorValueDescriptor&> *callback,
1139 const std::string &data);
1144 const ClockValue&> *callback,
1146 const std::string &data);
1152 const std::string&> *callback,
1154 const std::string &data);
1162 const std::string &data);
1166 std::map<UID, uint8_t> m_outstanding_messages;
1168 enum {LABEL_SIZE = 32};
1171 unsigned int universe,
1176 std::string *error);
1179 unsigned int universe,
1181 uint16_t sub_device,
1185 std::string *error);
1188 unsigned int universe,
1190 uint16_t sub_device,
1193 uint32_t> *callback,
1195 std::string *error);
1198 unsigned int universe,
1200 uint16_t sub_device,
1204 std::string *error);
1207 template <
typename callback_type>
1208 bool CheckCallback(std::string *error,
const callback_type *cb) {
1211 *error =
"Callback is null, this is a programming error";
1218 template <
typename callback_type>
1219 bool CheckNotBroadcast(
const UID &uid, std::string *error,
1220 const callback_type *cb) {
1223 *error =
"Cannot send to broadcast address";
1231 template <
typename callback_type>
1232 bool CheckValidSubDevice(uint16_t sub_device,
1233 bool broadcast_allowed,
1235 const callback_type *cb) {
1236 if (sub_device <= 0x0200)
1239 if (broadcast_allowed && sub_device == ALL_RDM_SUBDEVICES)
1243 *error =
"Sub device must be <= 0x0200";
1244 if (broadcast_allowed)
1245 *error +=
" or 0xffff";
1251 bool CheckReturnStatus(
bool status, std::string *error);
1253 unsigned int actual,
1254 unsigned int expected);
1258 #endif // INCLUDE_OLA_RDM_RDMAPI_H_