HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Core::Scheduling::Weekly::Day Struct Reference

Specific part for the Weekly Scheduler of the HF::Scheduling::Entry. More...

#include <weekly_scheduling.h>

+ Collaboration diagram for HF::Core::Scheduling::Weekly::Day:

Public Member Functions

uint32_t first (uint32_t timestamp=0) const
 Get the initial value for the next_run entry attribute. More...
 
uint32_t step () const
 Get the step between executions. More...
 
bool active (uint32_t _time) const
 
uint16_t size () const
 Number bytes needed to serialize the message. More...
 
uint16_t pack (Common::ByteArray &array, uint16_t offset=0) const
 Write the object on to a ByteArray so it can be sent over the network. More...
 
uint16_t unpack (const Common::ByteArray &array, uint16_t offset=0)
 Read a message from a ByteArray. More...
 

Data Fields

uint8_t day
 Day of Week. More...
 
uint8_t hour
 Hour of Day. More...
 
uint8_t minute
 Minute of Hour. More...
 

Static Public Attributes

static constexpr uint16_t min_size
 Minimum pack/unpack required data size.
 

Detailed Description

Specific part for the Weekly Scheduler of the HF::Scheduling::Entry.

Definition at line 83 of file weekly_scheduling.h.

Member Function Documentation

◆ active()

bool HF::Core::Scheduling::Weekly::Day::active ( uint32_t  _time) const
inline
Parameters
_time
Returns

Definition at line 164 of file weekly_scheduling.h.

References UNUSED.

165  {
166  UNUSED(_time);
167  return true;
168  }
#define UNUSED(x)
Helper macro to remove warning about unused function/method argument.

◆ first()

uint32_t HF::Core::Scheduling::Weekly::Day::first ( uint32_t  timestamp = 0) const
inline

Get the initial value for the next_run entry attribute.

Parameters
[in]timestampthe current system time.
Returns
the timestamp for the first run.

Definition at line 130 of file weekly_scheduling.h.

References day, hour, and minute.

131  {
132  uint32_t result = timestamp;
133 
134  Day current(convert(timestamp));
135 
136  result += (this->hour - current.hour) * 60 * 60;
137  result += (this->minute - current.minute) * 60;
138 
139  result += (this->day - current.day) * 24 * 60 * 60;
140 
141  if (timestamp > result)
142  {
143  result += WEEK;
144  }
145 
146  return result;
147  }
uint8_t minute
Minute of Hour.

◆ pack()

uint16_t HF::Core::Scheduling::Weekly::Day::pack ( Common::ByteArray array,
uint16_t  offset = 0 
) const

Write the object on to a ByteArray so it can be sent over the network.

The buffer passed in MUST have enough size to hold the serialized object, e.g.,

Serializable obj;
ByteArray payload(obj.size());
obj.pack(payload);
Parameters
[in,out]arrayByteArray reference to write the object to.
[in]offsetoffset to start writing to.
Returns
the number of bytes written.

◆ size()

uint16_t HF::Core::Scheduling::Weekly::Day::size ( ) const
inline

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.

Definition at line 176 of file weekly_scheduling.h.

References min_size.

177  {
178  return min_size;
179  }
static constexpr uint16_t min_size
Minimum pack/unpack required data size.

◆ step()

uint32_t HF::Core::Scheduling::Weekly::Day::step ( void  ) const
inline

Get the step between executions.

Returns
the step time.

Definition at line 154 of file weekly_scheduling.h.

155  {
156  return WEEK;
157  }

◆ unpack()

uint16_t HF::Core::Scheduling::Weekly::Day::unpack ( const Common::ByteArray array,
uint16_t  offset = 0 
)

Read a message from a ByteArray.

Parameters
[in]arrayByteArray reference to read the message from.
[in]offsetoffset to start reading from.
Returns
the number of bytes read.

Field Documentation

◆ day

uint8_t HF::Core::Scheduling::Weekly::Day::day

Day of Week.

Definition at line 85 of file weekly_scheduling.h.

Referenced by first().

◆ hour

uint8_t HF::Core::Scheduling::Weekly::Day::hour

Hour of Day.

Definition at line 86 of file weekly_scheduling.h.

Referenced by first().

◆ minute

uint8_t HF::Core::Scheduling::Weekly::Day::minute

Minute of Hour.

Definition at line 87 of file weekly_scheduling.h.

Referenced by first().


The documentation for this struct was generated from the following file: