/* device.h Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #include "../dmx/device.h" #include "basicdevice.h" #include "subdevice.h" #include "uid.h" #include #include #include #include namespace RDM { /** * @brief The RDM::Device class */ class Device : public RDM::BasicDevice , public DMX::Device { public: explicit Device(UID id = UID()); virtual ~Device(); const UID uid; //!< This devices UID std::shared_ptr subDevice(uint16_t number); virtual uint16_t subDeviceCount() const; void addProductDetail(uint16_t id); protected: friend class Responder; virtual void dispatch(MsgPair msg) override; void addSubDevice(uint16_t number, std::shared_ptr dev); void deleteSubDevice(uint16_t number); void enqueueMessage(MsgPtr message, bool urgent = false); virtual void actionSetClearStatusId(MsgPair msg); virtual void actionGetSubdeviceThreshold(MsgPair msg); virtual void actionSetSubdeviceThreshold(MsgPair msg); virtual void actionGetDeviceInfo(MsgPair msg) override; virtual void actionGetProductDetailIdList(MsgPair msg); virtual void actionGetDevModelDescription(MsgPair msg); virtual void actionGetManufacturerLabel(MsgPair msg); virtual void actionGetLanguage(MsgPair msg); virtual void actionSetLanguage(MsgPair msg); virtual void actionGetDmxPersonality(MsgPair msg); virtual void actionSetDmxPersonality(MsgPair msg); virtual void actionGetDmxPersonalityDesc(MsgPair msg); virtual void actionGetDmxStartAddress(MsgPair msg); virtual void actionSetDmxStartAddress(MsgPair msg); virtual void actionSensorDispatch(MsgPair msg); private: std::list product_detail_list_; //!< product detail list std::unordered_map> sub_devices_; //!< sub devices std::deque queued_messages_; //!< outbound message queue UID controller_uid_; //!< controller UID }; } // namespace RDM