82 lines
3.1 KiB
C++
82 lines
3.1 KiB
C++
/*
|
|
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:
|
|
Component(UUID::uuid = UUID::uuid(), std::string fctn = "OpenLCP DMP Component");
|
|
|
|
void addDmpSender(PDU::Handler<DMP::Pdu>);
|
|
void DmpReceiver(std::shared_ptr<ACN::PDU::Block<DMP::Pdu>>);
|
|
|
|
protected:
|
|
void sendDMP(PDU::Message<DMP::Pdu>) const;
|
|
|
|
virtual void rxDmpGetProperty(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSetProperty(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpGetPropertyReply(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpEvent(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSubscribe(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpUnsubscribe(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpGetPropertyFail(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSetPropertyFail(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSubscribeAccept(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSubscribeReject(PDU::Message<DMP::Pdu>);
|
|
virtual void rxDmpSyncEvent(PDU::Message<DMP::Pdu>);
|
|
|
|
/// \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<PDU::Handler<DMP::Pdu>> dmp_senders_;
|
|
};
|
|
|
|
} // ACN::DMP
|