21 #ifndef OLAD_RDMHTTPMODULE_H_ 22 #define OLAD_RDMHTTPMODULE_H_ 30 #include "ola/client/ClientRDMAPIShim.h" 31 #include "ola/client/OlaClient.h" 32 #include "ola/http/HTTPServer.h" 36 #include "ola/thread/Mutex.h" 37 #include "ola/web/JsonSections.h" 81 std::string manufacturer;
92 std::map<ola::rdm::UID, resolved_uid> resolved_uids;
93 std::queue<std::pair<ola::rdm::UID, uid_resolve_action> > pending_uids;
94 bool uid_resolution_running;
96 } uid_resolution_state;
102 std::map<unsigned int, uid_resolution_state*> m_universe_uids;
113 struct lt_section_info {
114 bool operator()(
const section_info &left,
const section_info &right) {
115 return left.name < right.name;
120 unsigned int universe_id;
123 std::string device_model;
124 std::string software_version;
128 unsigned int universe_id;
130 bool include_descriptions;
131 bool return_as_section;
135 std::vector<std::pair<uint32_t, std::string> > personalities;
139 unsigned int universe_id;
141 bool include_descriptions;
145 std::vector<std::string> curve_descriptions;
150 unsigned int universe_id,
154 void ResolveNextUID(
unsigned int universe_id);
156 void UpdateUIDManufacturerLabel(
unsigned int universe,
159 const std::string &device_label);
161 void UpdateUIDDeviceLabel(
unsigned int universe,
164 const std::string &device_label);
166 uid_resolution_state *GetUniverseUids(
unsigned int universe);
167 uid_resolution_state *GetUniverseUidsOrCreate(
unsigned int universe);
172 const ola::rdm::DeviceDescriptor &device);
181 personality_info *info);
187 const std::vector<uint16_t> &pids);
189 unsigned int universe,
192 const std::vector<uint16_t> &pids);
193 void SupportedSectionsDeviceInfoHandler(
195 const std::vector<uint16_t> pids,
197 const ola::rdm::DeviceDescriptor &device);
201 unsigned int universe_id,
206 uint16_t short_messages,
207 uint16_t length_mismatch,
208 uint16_t checksum_fail);
211 unsigned int universe_id,
215 unsigned int universe_id,
220 unsigned int universe_id,
222 const std::vector<ola::rdm::UID> &uids);
226 unsigned int universe_id,
230 device_info dev_info,
232 const std::string &software_version);
235 device_info dev_info,
237 const std::string &device_model);
240 device_info dev_info,
242 const ola::rdm::DeviceDescriptor &device);
246 unsigned int universe_id,
251 const std::vector<uint16_t> &ids);
255 unsigned int universe_id,
259 unsigned int universe_id,
262 const std::string &label);
266 unsigned int universe_id,
270 unsigned int universe_id,
273 const std::string &label);
277 unsigned int universe_id,
281 unsigned int universe_id,
289 unsigned int universe_id,
293 unsigned int universe_id,
296 void GetSupportedLanguagesHandler(
298 unsigned int universe_id,
301 const std::vector<std::string> &languages);
304 std::vector<std::string> languages,
306 const std::string &language);
310 unsigned int universe_id,
314 unsigned int universe_id,
318 unsigned int universe_id,
321 const std::string &label);
323 void GetBootSoftwareVersionHandler(
331 unsigned int universe_id,
333 bool return_as_section,
334 bool include_description =
false);
336 void GetPersonalityHandler(
338 personality_info *info,
344 personality_info *info);
346 void GetPersonalityLabelHandler(
348 personality_info *info,
352 const std::string &label);
355 personality_info *info);
359 unsigned int universe_id,
364 unsigned int universe_id,
373 unsigned int universe_id,
378 unsigned int universe_id,
382 unsigned int universe_id,
391 const ola::rdm::SensorValueDescriptor &value);
395 unsigned int universe_id,
400 unsigned int universe_id,
405 unsigned int universe_id,
410 unsigned int universe_id,
415 unsigned int universe_id,
420 unsigned int universe_id,
425 unsigned int universe_id,
430 unsigned int universe_id,
439 unsigned int universe_id,
444 unsigned int universe_id,
453 unsigned int universe_id,
458 unsigned int universe_id,
463 unsigned int universe_id,
467 unsigned int universe_id,
476 unsigned int universe_id,
480 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,
516 unsigned int universe_id,
520 unsigned int universe_id,
525 const ola::rdm::ClockValue &clock);
528 unsigned int universe_id,
532 unsigned int universe_id,
537 unsigned int universe_id,
541 unsigned int universe_id,
550 unsigned int universe_id,
557 unsigned int universe_id,
561 unsigned int universe_id,
566 const std::string &label);
570 unsigned int universe_id,
574 unsigned int universe_id,
579 const std::string &label);
583 unsigned int universe_id,
588 unsigned int universe_id,
590 bool include_descriptions);
595 uint8_t current_curve,
596 uint8_t curve_count);
605 const std::string &resp_description);
612 unsigned int universe_id,
616 unsigned int universe_id,
624 unsigned int universe_id,
627 void GetDimmerMinimumLevelsHandler(
634 unsigned int universe_id,
638 unsigned int universe_id,
643 uint16_t maximum_level);
647 unsigned int universe_id,
652 unsigned int *universe_id);
663 std::string description,
668 std::string description,
672 std::string description,
679 const std::string &error);
688 const std::string &error);
690 void AddSection(std::vector<section_info> *sections,
691 const std::string §ion_id,
692 const std::string §ion_name,
693 const std::string &hint =
"");
695 static const uint32_t INVALID_PERSONALITY = 0xffff;
696 static const char BACKEND_DISCONNECTED_ERROR[];
698 static const char HINT_KEY[];
699 static const char ID_KEY[];
700 static const char SECTION_KEY[];
701 static const char UID_KEY[];
703 static const char ADDRESS_FIELD[];
704 static const char DIMMER_MINIMUM_INCREASING_FIELD[];
705 static const char DIMMER_MINIMUM_DECREASING_FIELD[];
706 static const char DISPLAY_INVERT_FIELD[];
707 static const char GENERIC_BOOL_FIELD[];
708 static const char GENERIC_STRING_FIELD[];
709 static const char GENERIC_UINT_FIELD[];
710 static const char IDENTIFY_DEVICE_FIELD[];
711 static const char LABEL_FIELD[];
712 static const char LANGUAGE_FIELD[];
713 static const char RECORD_SENSOR_FIELD[];
714 static const char SUB_DEVICE_FIELD[];
716 static const char BOOT_SOFTWARE_SECTION[];
717 static const char CLOCK_SECTION[];
718 static const char COMMS_STATUS_SECTION[];
719 static const char CURVE_SECTION[];
720 static const char DEVICE_HOURS_SECTION[];
721 static const char DEVICE_INFO_SECTION[];
722 static const char DEVICE_LABEL_SECTION[];
723 static const char DIMMER_INFO_SECTION[];
724 static const char DIMMER_MAXIMUM_SECTION[];
725 static const char DIMMER_MINIMUM_SECTION[];
726 static const char DISPLAY_INVERT_SECTION[];
727 static const char DISPLAY_LEVEL_SECTION[];
728 static const char DMX_ADDRESS_SECTION[];
729 static const char DNS_DOMAIN_NAME_SECTION[];
730 static const char DNS_HOSTNAME_SECTION[];
731 static const char FACTORY_DEFAULTS_SECTION[];
732 static const char IDENTIFY_DEVICE_SECTION[];
733 static const char LAMP_HOURS_SECTION[];
734 static const char LAMP_MODE_SECTION[];
735 static const char LAMP_STATE_SECTION[];
736 static const char LAMP_STRIKES_SECTION[];
737 static const char LANGUAGE_SECTION[];
738 static const char MANUFACTURER_LABEL_SECTION[];
739 static const char PAN_INVERT_SECTION[];
740 static const char PAN_TILT_SWAP_SECTION[];
741 static const char PERSONALITY_SECTION[];
742 static const char POWER_CYCLES_SECTION[];
743 static const char POWER_STATE_SECTION[];
744 static const char PRODUCT_DETAIL_SECTION[];
745 static const char PROXIED_DEVICES_SECTION[];
746 static const char RESET_DEVICE_SECTION[];
747 static const char SENSOR_SECTION[];
748 static const char TILT_INVERT_SECTION[];
750 static const char BOOT_SOFTWARE_SECTION_NAME[];
751 static const char CLOCK_SECTION_NAME[];
752 static const char COMMS_STATUS_SECTION_NAME[];
753 static const char CURVE_SECTION_NAME[];
754 static const char DEVICE_HOURS_SECTION_NAME[];
755 static const char DEVICE_INFO_SECTION_NAME[];
756 static const char DEVICE_LABEL_SECTION_NAME[];
757 static const char DIMMER_INFO_SECTION_NAME[];
758 static const char DIMMER_MAXIMUM_SECTION_NAME[];
759 static const char DIMMER_MINIMUM_SECTION_NAME[];
760 static const char DISPLAY_INVERT_SECTION_NAME[];
761 static const char DISPLAY_LEVEL_SECTION_NAME[];
762 static const char DMX_ADDRESS_SECTION_NAME[];
763 static const char DNS_DOMAIN_NAME_SECTION_NAME[];
764 static const char DNS_HOSTNAME_SECTION_NAME[];
765 static const char FACTORY_DEFAULTS_SECTION_NAME[];
766 static const char IDENTIFY_DEVICE_SECTION_NAME[];
767 static const char LAMP_HOURS_SECTION_NAME[];
768 static const char LAMP_MODE_SECTION_NAME[];
769 static const char LAMP_STATE_SECTION_NAME[];
770 static const char LAMP_STRIKES_SECTION_NAME[];
771 static const char LANGUAGE_SECTION_NAME[];
772 static const char MANUFACTURER_LABEL_SECTION_NAME[];
773 static const char PAN_INVERT_SECTION_NAME[];
774 static const char PAN_TILT_SWAP_SECTION_NAME[];
775 static const char PERSONALITY_SECTION_NAME[];
776 static const char POWER_CYCLES_SECTION_NAME[];
777 static const char POWER_STATE_SECTION_NAME[];
778 static const char PRODUCT_DETAIL_SECTION_NAME[];
779 static const char PROXIED_DEVICES_SECTION_NAME[];
780 static const char RESET_DEVICE_SECTION_NAME[];
781 static const char TILT_INVERT_SECTION_NAME[];
786 #endif // OLAD_RDMHTTPMODULE_H_ The base HTTP Server.
Definition: HTTPServer.h:156
void PruneUniverseList(const std::vector< client::OlaUniverse > &universes)
Definition: RDMHTTPModule.cpp:689
Represents a set of RDM UIDs.
Definition: UIDSet.h:48
int JsonSectionInfo(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Get the information required to render a section in the RDM controller panel.
Definition: RDMHTTPModule.cpp:492
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Creates dummy copy constructor and assignment operator declarations.
Definition: Macro.h:44
int JsonUIDPersonalities(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Returns the personalities on the device.
Definition: RDMHTTPModule.cpp:375
Definition: HTTPServer.h:65
int JsonSaveSectionInfo(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Definition: RDMHTTPModule.cpp:596
void SetPidStore(const ola::rdm::RootPidStore *pid_store)
Can be called while the server is running. Ownership is not transferred.
Definition: RDMHTTPModule.cpp:228
Holds information about RDM PIDs.
Provide a generic RDM API that can use different implementations.
A RDM unique identifier (UID).
int JsonUIDs(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Return the list of uids for this universe as json.
Definition: RDMHTTPModule.cpp:270
The callback based C++ client for OLA.
Definition: OlaClient.h:45
Definition: ClientRDMAPIShim.h:39
Definition: HTTPServer.h:109
Indicates the result of a OLA API call.
Definition: Result.h:52
int JsonUIDIdentifyDevice(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Returns the identify state for the device.
Definition: RDMHTTPModule.cpp:336
Represents the state of a response and/or any error codes.
Definition: RDMAPIImplInterface.h:51
Definition: JsonSections.h:203
int RunRDMDiscovery(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Run RDM discovery for a universe.
Definition: RDMHTTPModule.cpp:240
Represents a RDM UID.
Definition: UID.h:57
int JsonUIDInfo(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Return the device info for this uid.
Definition: RDMHTTPModule.cpp:297
int JsonSupportedSections(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Return a list of sections to display in the RDM control panel.
Definition: RDMHTTPModule.cpp:452
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
The root of the RDM parameter descriptor store.
Definition: PidStore.h:68
int JsonSupportedPIDs(const ola::http::HTTPRequest *request, ola::http::HTTPResponse *response)
Return a list of PIDs supported by this device.
Definition: RDMHTTPModule.cpp:410
Definition: RDMHTTPModule.h:45