17 #ifndef HF_ITF_SIMPLE_LIGHT_SENSOR_H 18 #define HF_ITF_SIMPLE_LIGHT_SENSOR_H 28 namespace SimpleLightSensor
52 namespace SimpleLightSensor
62 typedef enum _Attributes
177 uint32_t
maximum = std::numeric_limits<uint32_t>::max(),
194 uint32_t
value()
const;
201 void value(uint32_t __value);
215 void minimum(uint32_t __value);
229 void maximum(uint32_t __value);
287 template<Attributes _Attribute>
351 std::ostream &
operator<<(std::ostream &stream,
std::ostream & operator<<(std::ostream &stream, const HF::Interfaces::SimpleLightSensor::Attributes attribute)
Convert the given attribute into a string and write it to the given stream.
uint32_t maximum() const
Get the Maximum for the Simple Light Sensor server.
static constexpr uint8_t ID
Attribute UID.
static constexpr bool WRITABLE
Attribute Read/Write.
static constexpr uint8_t ID
Attribute UID.
uint32_t value() const
Get the Value for the Simple Light Sensor server.
virtual void send(const Protocol::Address &addr, Protocol::Message &message)=0
Send message msg to the network address given by addr.
static constexpr bool WRITABLE
Attribute Read/Write.
Allows a unit to provide light readings.
static constexpr bool WRITABLE
Attribute Read/Write.
Helper class to handle the Tolerance attribute for the Simple Light Sensor interface.
uint32_t _tolerance
Tolerance.
static constexpr bool WRITABLE
Attribute Read/Write.
Return all mandatory attributes for the interface.
static constexpr uint8_t ID
Attribute UID.
Helper class template for parent class implementation of the interfaces.
uint16_t id
Identifier of the interface.
This file contains the definitions for the HAN-FUN protocol messages.
void read(Protocol::Address &addr)
Send a GET_ATTR_REQ to the given address to get the current lux readings.
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::SimpleLig...
This file contains the definitions common to all interfaces.
Helper class to handle the Minimum attribute for the Simple Light Sensor interface.
HF::Attributes::IAttribute * attribute(uint8_t uid)
Return a pointer to the interface attribute with the given uid.
virtual ~Server()
Destructor.
uint16_t role
Interface role : Server or Client.
HF::Interface const * owner() const
void read_all(Protocol::Address &addr)
Send a GET_ATTR_PACK_REQ to the given address to get the values for all the attributes in the server...
Simple Light Sensor Interface : Server side implementation.
static constexpr uint8_t ID
Attribute UID.
Simple Light Sensor Interface : Client side implementation.
This class represents a byte array.
uint32_t tolerance() const
Get the Tolerance for the Simple Light Sensor server.
Helper class to handle the Value attribute for the Simple Light Sensor interface. ...
Simple Light Sensor interface UID.
uint8_t member
Interface destination member.
uint16_t uid() const
This method returns the interface UID.
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.
uint32_t minimum() const
Get the Minimum for the Simple Light Sensor server.
Interface itf
Interface Address.
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.
Server(uint32_t minimum=std::numeric_limits< uint32_t >::min(), uint32_t maximum=std::numeric_limits< uint32_t >::max(), uint32_t tolerance=0)
Constructor.
Helper class template for implementing a given interface role.
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.
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, uint32_t data, bool writable=false)
Attribute template constructor.
Common interface for all Interfaces.
Simple Light Sensor Interface : Parent.
Helper class to handle the Maximum attribute for the Simple Light Sensor interface.
Common::Result handle_attribute(Protocol::Packet &packet, Common::ByteArray &payload, uint16_t offset)
Handle incoming messages from the network.
uint32_t _maximum
Maximum.
Result
Commands result codes.
uint32_t _minimum
Minimum.
Top-level namespace for the HAN-FUN library.