13 #include <NamedValue.hpp>
25 template <
class V>
class Event {
86 virtual const std::string
getName()
const = 0;
142 virtual const std::string
getMessage()
const = 0;
237 template <
typename T> V&
set(
const std::string &attributeName, T& value) {
238 V *this_ptr(dynamic_cast<V*>(
this));
239 if (this_ptr !=
nullptr) {
240 this_ptr->template set<T>(attributeName, value);
254 template <
typename T> T
get(
const std::string &attributeName) {
255 V *this_ptr(dynamic_cast<V*>(
this));
256 if (this_ptr !=
nullptr) {
257 return this_ptr->template get<T>(attributeName);
277 virtual V&
update(
void) = 0;
284 virtual void finish(
void) = 0;
virtual void onError(const ErrorEvent< VirtualDevice > &event) const =0
Notify that an error occured when attempting to deliver messages to the server.
virtual const DeviceModel & getDeviceModel()=0
Get the device model of this device object.
An event passed to the.
Definition: AbstractVirtualDevice.hpp:136
virtual V & update(void)=0
Set a mark for beginning an update transaction.
virtual void setOnChange(const ChangeCallback *callback)=0
Set a callback that is invoked when the value of any attribute in the device model is changed from th...
virtual V * getVirtualDevice()=0
Get the virtual device that is the source of the event.
virtual ~AbstractVirtualDevice()
Destructor.
Definition: AbstractVirtualDevice.hpp:208
A callback interface for receiving an event when the value of an attribute has changed.
Definition: AbstractVirtualDevice.hpp:118
An event passed to a callback.
Definition: AbstractVirtualDevice.hpp:25
virtual const std::string getMessage() const =0
Get the error message.
A callback interface for errors in delivery of messages.
Definition: AbstractVirtualDevice.hpp:152
virtual const std::string & getEndpointId() const =0
Get the endpoint id of the device.
virtual NamedValue * getNamedValue() const =0
Get the name-value pair from the event.
An event passed to the onChange callback.
Definition: AbstractVirtualDevice.hpp:64
V & set(const std::string &attributeName, T &value)
Set the value of an attribute.
Definition: AbstractVirtualDevice.hpp:237
virtual ~ActionEvent()
Destructor.
Definition: AbstractVirtualDevice.hpp:90
Definition: NamedValue.hpp:24
virtual void onChange(const ChangeEvent< VirtualDevice > &event) const =0
Callback for receiving an event when the value of an attribute has changed.
Detailed information on a device model.
Definition: DeviceModel.hpp:19
Definition: VirtualDevice.hpp:38
virtual ~ChangeEvent()
Destructor.
Definition: AbstractVirtualDevice.hpp:69
An event passed to the onChange callback.
Definition: AbstractVirtualDevice.hpp:80
A callback interface for receiving notification of an Action.
Definition: AbstractVirtualDevice.hpp:99
virtual ~ActionCallback()
Desctructor.
Definition: AbstractVirtualDevice.hpp:109
virtual ~Event()
Destructor.
Definition: AbstractVirtualDevice.hpp:30
virtual const std::string getName() const =0
Get the name of the action.
virtual void finish(void)=0
Causes the values set in an update transaction to be sent to the server and clears the update-transac...
virtual void onAction(ActionEvent< VirtualDevice > &arguments) const =0
Callback for receiving an action from the server for a VirtualDevice.
AbstractVirtualDevice is a representation of a device model implemented by an endpoint.
Definition: AbstractVirtualDevice.hpp:202
virtual void setOnError(const ErrorCallback *callback)=0
Set a callback that is invoked if an error occurs when setting the value of any attribute in the devi...