21 #ifndef OLAD_RDMHTTPMODULE_H_
22 #define OLAD_RDMHTTPMODULE_H_
29 #include "ola/OlaCallbackClient.h"
30 #include "ola/http/HTTPServer.h"
34 #include "ola/thread/Mutex.h"
35 #include "ola/web/JsonSections.h"
92 map<UID, resolved_uid> resolved_uids;
93 std::queue<std::pair<UID, uid_resolve_action> > pending_uids;
94 bool uid_resolution_running;
96 } uid_resolution_state;
101 map<unsigned int, uid_resolution_state*> m_universe_uids;
112 struct lt_section_info {
113 bool operator()(
const section_info &left,
const section_info &right) {
114 return left.name < right.name;
119 unsigned int universe_id;
123 string software_version;
127 unsigned int universe_id;
129 bool include_descriptions;
130 bool return_as_section;
134 vector<std::pair<uint32_t, string> > personalities;
142 unsigned int universe_id,
144 const string &error);
146 void ResolveNextUID(
unsigned int universe_id);
148 void UpdateUIDManufacturerLabel(
unsigned int universe,
151 const string &device_label);
153 void UpdateUIDDeviceLabel(
unsigned int universe,
156 const string &device_label);
158 uid_resolution_state *GetUniverseUids(
unsigned int universe);
159 uid_resolution_state *GetUniverseUidsOrCreate(
unsigned int universe);
173 personality_info *info);
179 const vector<uint16_t> &pids);
181 unsigned int universe,
184 const vector<uint16_t> &pids);
185 void SupportedSectionsDeviceInfoHandler(
187 const vector<uint16_t> pids,
193 unsigned int universe_id,
198 uint16_t short_messages,
199 uint16_t length_mismatch,
200 uint16_t checksum_fail);
203 unsigned int universe_id,
207 unsigned int universe_id,
212 unsigned int universe_id,
214 const vector<UID> &uids);
218 unsigned int universe_id,
222 device_info dev_info,
224 const string &software_version);
227 device_info dev_info,
229 const string &device_model);
232 device_info dev_info,
238 unsigned int universe_id,
243 const vector<uint16_t> &ids);
245 string GetManufacturerLabel(
const HTTPRequest *request,
247 unsigned int universe_id,
250 void GetManufacturerLabelHandler(
HTTPResponse *response,
251 unsigned int universe_id,
254 const string &label);
258 unsigned int universe_id,
262 unsigned int universe_id,
265 const string &label);
269 unsigned int universe_id,
273 unsigned int universe_id,
281 unsigned int universe_id,
285 unsigned int universe_id,
288 void GetSupportedLanguagesHandler(
HTTPResponse *response,
289 unsigned int universe_id,
292 const vector<string> &languages);
295 vector<string> languages,
297 const string &language);
301 unsigned int universe_id,
305 unsigned int universe_id,
308 void GetBootSoftwareLabelHandler(
HTTPResponse *response,
309 unsigned int universe_id,
312 const string &label);
314 void GetBootSoftwareVersionHandler(
320 string GetPersonalities(
const HTTPRequest *request,
322 unsigned int universe_id,
324 bool return_as_section,
325 bool include_description =
false);
327 void GetPersonalityHandler(
329 personality_info *info,
334 void GetNextPersonalityDescription(
HTTPResponse *response,
335 personality_info *info);
337 void GetPersonalityLabelHandler(
339 personality_info *info,
343 const string &label);
345 void SendSectionPersonalityResponse(
HTTPResponse *response,
346 personality_info *info);
350 unsigned int universe_id,
355 unsigned int universe_id,
364 unsigned int universe_id,
369 unsigned int universe_id,
373 unsigned int universe_id,
386 unsigned int universe_id,
391 unsigned int universe_id,
396 unsigned int universe_id,
401 unsigned int universe_id,
406 unsigned int universe_id,
411 unsigned int universe_id,
416 unsigned int universe_id,
421 unsigned int universe_id,
430 unsigned int universe_id,
435 unsigned int universe_id,
444 unsigned int universe_id,
449 unsigned int universe_id,
454 unsigned int universe_id,
458 unsigned int universe_id,
465 string SetDisplayInvert(
const HTTPRequest *request,
467 unsigned int universe_id,
471 unsigned int universe_id,
480 unsigned int universe_id,
484 unsigned int universe_id,
489 unsigned int universe_id,
493 unsigned int universe_id,
498 unsigned int universe_id,
502 unsigned int universe_id,
507 unsigned int universe_id,
511 unsigned int universe_id,
519 unsigned int universe_id,
523 unsigned int universe_id,
528 unsigned int universe_id,
532 unsigned int universe_id,
541 unsigned int universe_id,
548 unsigned int universe_id,
553 unsigned int *universe_id);
557 uint16_t SubDeviceOrRoot(
const HTTPRequest *request);
578 int RespondWithError(
HTTPResponse *response,
const string &error);
586 void HandleBoolResponse(
HTTPResponse *response,
const string &error);
588 void AddSection(vector<section_info> *sections,
589 const string §ion_id,
590 const string §ion_name,
591 const string &hint=
"");
593 static const uint32_t INVALID_PERSONALITY = 0xffff;
594 static const char BACKEND_DISCONNECTED_ERROR[];
596 static const char HINT_KEY[];
597 static const char ID_KEY[];
598 static const char SECTION_KEY[];
599 static const char UID_KEY[];
601 static const char ADDRESS_FIELD[];
602 static const char DISPLAY_INVERT_FIELD[];
603 static const char GENERIC_BOOL_FIELD[];
604 static const char GENERIC_STRING_FIELD[];
605 static const char GENERIC_UINT_FIELD[];
606 static const char IDENTIFY_FIELD[];
607 static const char LABEL_FIELD[];
608 static const char LANGUAGE_FIELD[];
609 static const char RECORD_SENSOR_FIELD[];
610 static const char SUB_DEVICE_FIELD[];
612 static const char BOOT_SOFTWARE_SECTION[];
613 static const char CLOCK_SECTION[];
614 static const char COMMS_STATUS_SECTION[];
615 static const char DEVICE_HOURS_SECTION[];
616 static const char DEVICE_INFO_SECTION[];
617 static const char DEVICE_LABEL_SECTION[];
618 static const char DISPLAY_INVERT_SECTION[];
619 static const char DISPLAY_LEVEL_SECTION[];
620 static const char DMX_ADDRESS_SECTION[];
621 static const char FACTORY_DEFAULTS_SECTION[];
622 static const char IDENTIFY_SECTION[];
623 static const char LAMP_HOURS_SECTION[];
624 static const char LAMP_MODE_SECTION[];
625 static const char LAMP_STATE_SECTION[];
626 static const char LAMP_STRIKES_SECTION[];
627 static const char LANGUAGE_SECTION[];
628 static const char MANUFACTURER_LABEL_SECTION[];
629 static const char PAN_INVERT_SECTION[];
630 static const char PAN_TILT_SWAP_SECTION[];
631 static const char PERSONALITY_SECTION[];
632 static const char POWER_CYCLES_SECTION[];
633 static const char POWER_STATE_SECTION[];
634 static const char PRODUCT_DETAIL_SECTION[];
635 static const char PROXIED_DEVICES_SECTION[];
636 static const char RESET_DEVICE_SECTION[];
637 static const char SENSOR_SECTION[];
638 static const char TILT_INVERT_SECTION[];
640 static const char BOOT_SOFTWARE_SECTION_NAME[];
641 static const char CLOCK_SECTION_NAME[];
642 static const char COMMS_STATUS_SECTION_NAME[];
643 static const char DEVICE_HOURS_SECTION_NAME[];
644 static const char DEVICE_INFO_SECTION_NAME[];
645 static const char DEVICE_LABEL_SECTION_NAME[];
646 static const char DISPLAY_INVERT_SECTION_NAME[];
647 static const char DISPLAY_LEVEL_SECTION_NAME[];
648 static const char DMX_ADDRESS_SECTION_NAME[];
649 static const char FACTORY_DEFAULTS_SECTION_NAME[];
650 static const char IDENTIFY_SECTION_NAME[];
651 static const char LAMP_HOURS_SECTION_NAME[];
652 static const char LAMP_MODE_SECTION_NAME[];
653 static const char LAMP_STATE_SECTION_NAME[];
654 static const char LAMP_STRIKES_SECTION_NAME[];
655 static const char LANGUAGE_SECTION_NAME[];
656 static const char MANUFACTURER_LABEL_SECTION_NAME[];
657 static const char PAN_INVERT_SECTION_NAME[];
658 static const char PAN_TILT_SWAP_SECTION_NAME[];
659 static const char PERSONALITY_SECTION_NAME[];
660 static const char POWER_CYCLES_SECTION_NAME[];
661 static const char POWER_STATE_SECTION_NAME[];
662 static const char PRODUCT_DETAIL_SECTION_NAME[];
663 static const char PROXIED_DEVICES_SECTION_NAME[];
664 static const char RESET_DEVICE_SECTION_NAME[];
665 static const char TILT_INVERT_SECTION_NAME[];
668 #endif // OLAD_RDMHTTPMODULE_H_