/* dmp/component.h Copyright (c) 2022 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 "../component.h" #include "dmp.h" namespace ACN::DMP { /** * @brief The ACN::DMP::Component class * * \cite DMP 8 DMP Components and their Functionalities: Devices and Controllers * * All E1.17 messages including DMP messages are sent between components. For more * on components see \cite ACN. * * Within a DMP component there can be two distinct functionalities, devices and * controllers. ... * * Regardless ..., all DMP components must support all DMP messages, returning the * appropriate error results if a message does not make sense for the component * functionality. An example of this is a Set Property message sent to a component * that has no properties. The component shall return an appropriate error result * indicating that the property being set is not one of its properties. */ class Component : public virtual ACN::Component { public: explicit Component(UUID::uuid = UUID::uuid(), std::string fctn = "OpenLCP DMP Component"); void addDmpSender(PDU::Handler); void DmpReceiver(std::shared_ptr>); protected: void sendDMP(PDU::Message) const; virtual void rxDmpGetProperty(PDU::Message); virtual void rxDmpSetProperty(PDU::Message); virtual void rxDmpGetPropertyReply(PDU::Message); virtual void rxDmpEvent(PDU::Message); virtual void rxDmpSubscribe(PDU::Message); virtual void rxDmpUnsubscribe(PDU::Message); virtual void rxDmpGetPropertyFail(PDU::Message); virtual void rxDmpSetPropertyFail(PDU::Message); virtual void rxDmpSubscribeAccept(PDU::Message); virtual void rxDmpSubscribeReject(PDU::Message); virtual void rxDmpSyncEvent(PDU::Message); /// \cite DMP 5.1.2 Relative Addresses /// /// Devices shall maintain a record of the last address used uint32_t last_address_used; private: std::vector> dmp_senders_; }; } // ACN::DMP