17 #ifndef HF_CORE_TIME_H 18 #define HF_CORE_TIME_H 62 typedef enum _Attributes
70 static constexpr uint16_t YEARS_BASE = 2000;
73 static constexpr uint8_t YEARS_MIN = 0;
76 static constexpr uint8_t YEARS_MAX = 136;
79 static constexpr uint8_t MONTHS_MIN = 1;
82 static constexpr uint8_t MONTHS_MAX = 12;
85 static constexpr uint8_t DAYS_MIN = 1;
88 static constexpr uint8_t DAYS_MAX = 31;
91 static constexpr uint8_t HOURS_MIN = 0;
94 static constexpr uint8_t HOURS_MAX = 23;
97 static constexpr uint8_t MINUTES_MIN = 0;
100 static constexpr uint8_t MINUTES_MAX = 59;
103 static constexpr uint8_t SECONDS_MIN = 0;
106 static constexpr uint8_t SECONDS_MAX = 59;
118 uint32_t
convert(
const Date &date);
139 static constexpr uint32_t
INVALID = 0xFFFFFFFF;
140 static constexpr uint32_t
MIN = 0x00000000;
159 Date
convert(
const Value &value);
174 Date(uint8_t _year = 0, uint8_t _month = 0, uint8_t _day = 0,
175 uint8_t _hour = 0, uint8_t _minute = 0, uint8_t _second = 0):
245 virtual uint32_t
time()
const;
252 void time(uint32_t __value);
312 return !(lhs == rhs);
348 std::ostream &
operator<<(std::ostream &stream,
359 std::ostream &
operator<<(std::ostream &stream,
static constexpr uint32_t INVALID
Invalid value for time.
uint8_t second
Seconds : 0 - 59.
static constexpr uint8_t ID
Attribute UID.
This represent the special unit with ID/UID = 0.
HF::Attributes::IAttribute * create_attribute(uint8_t uid)
Create an attribute object that can hold the attribute with the given uid. (HF::Interfaces::Time::Ser...
Base(Unit0 &unit)
Constructor.
Helper class to parse the time value into a human readable string.
Return all mandatory attributes for the interface.
#define HF_ASSERT(_expr, _block)
Helper macro to check for correct assumptions.
This file contains the forward declarations of the core services and interfaces implementing classes...
HF::Attributes::IAttribute * attribute(uint8_t uid)
Return a pointer to the interface attribute with the given uid.
This file contains the definitions for the HAN-FUN protocol messages.
uint32_t convert(const Date &date)
Convert the date given by date to the corresponding time value.
static constexpr bool WRITABLE
Attribute Read/Write.
static constexpr uint32_t MAX
Maximum value for time.
uint32_t _time
Time value.
uint16_t uid() const
This method returns the interface UID.
void tick(uint32_t count=1)
Increment time by the amount given by count seconds.
HF::Interface const * owner() const
Unit0 & unit() const
The device this unit is associated with.
std::ostream & operator<<(std::ostream &stream, const HF::Core::Time::Attributes attribute)
Convert the given attribute into a string and write it to the given stream.
Time Service : Client side implementation.
uint8_t year
Year : 20(00) - 2(255)
virtual uint32_t time() const
Get the Time for the Time server.
static constexpr uint32_t MIN
Minimum value for time.
Time Service : Server side implementation.
Interface/Service Attribute API.
Class template for all interfaces role implementations.
Time
This represents the type of time that is associated with a time measurement.
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.
Server(Unit0 &unit)
Constructor.
uint8_t month
Month: 1 - 12.
Class template for all core services implementations.
uint8_t minute
Minutes : 0 - 59.
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.
virtual ~Server()
Destructor.
uint8_t hour
Hours : 0 - 23.
Helper class to handle the Time attribute for the Time service.
HF::Attributes::IAttribute * create_attribute(HF::Core::AttributeReporting::IServer *server, uint8_t uid)
Create an attribute object that can hold the attribute with the given uid.
Top-level namespace for the HAN-FUN library.