17 #ifndef HF_ITF_ON_OFF_H 18 #define HF_ITF_ON_OFF_H 71 typedef enum _Attributes
virtual void toggle(Protocol::Address &source)
Callback that is called when a TOGGLE_CMD message is received.
HF::Attributes::UIDS attributes(uint8_t pack_id=HF::Attributes::Pack::MANDATORY) const
Return a vector containing the attribute UIDs, for the given pack ID.
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::OnOff::Se...
On-Off Interface : Client side implementation.
virtual ~Server()
Destructor.
static constexpr uint8_t ID
Attribute UID.
void toggle()
Send a OnOff::TOGGLE_CMD message to the broadcast address.
Return all mandatory attributes for the interface.
virtual void on(Protocol::Address &source)
Callback that is called when a ON_CMD message is received.
Helper class template for parent class implementation of the interfaces.
On-Off Interface : Parent.
static constexpr bool WRITABBLE
Attribute Read/Write.
This file contains the definitions for the HAN-FUN protocol messages.
This file contains the definitions common to all interfaces.
bool state()
Getter : get the current state of the interface :
On-Off Interface : Server side implementation.
Helper class to handle the State attribute for the On-Off interface.
void off()
Send a OnOff::OFF_CMD message to the broadcast address.
HF::Interface const * owner() const
This class represents a byte array.
std::ostream & operator<<(std::ostream &stream, const HF::Interfaces::OnOff::CMD command)
Convert the given command into a string and write it to the given stream.
uint16_t uid() const
This method returns the interface UID.
virtual void off(Protocol::Address &source)
Callback that is called when a OFF_CMD message is received.
HF::Attributes::IAttribute * create_attribute(HF::Interfaces::Alert::Server *server, uint8_t uid)
Create an attribute object that can hold the attribute with the given uid.
Interface/Service Attribute API.
Helper class template for implementing a given interface role.
bool _state
Current server state.
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.
void on()
Send a OnOff::ON_CMD message to the broadcast address.
Helper template class to declare an attribute with the given T type.
Attribute(const uint16_t interface, const uint8_t uid, const HF::Interface *__owner, bool data, bool writable=false)
Attribute template constructor.
Common interface for all Interfaces.
HF::Attributes::IAttribute * attribute(uint8_t uid)
Return a pointer to the interface attribute with the given uid.
Result
Commands result codes.
Common::Result handle_command(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Handle incoming messages from the network.
Top-level namespace for the HAN-FUN library.