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

Event Scheduler specific part for the HF::Scheduling::Entry. More...

#include <event_scheduling.h>

+ Collaboration diagram for HF::Core::Scheduling::Event::Interval:

Public Member Functions

 Interval (uint32_t _start, uint32_t _end, uint32_t _repeat)
 Constructor. More...
 
uint32_t first () 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
 Check if entry is active. More...
 
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

uint32_t start
 Start Date. More...
 
uint32_t end
 End Date. More...
 
uint32_t repeat
 Repeat interval (in seconds). More...
 

Static Public Attributes

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

Detailed Description

Event Scheduler specific part for the HF::Scheduling::Entry.

Definition at line 70 of file event_scheduling.h.

Constructor & Destructor Documentation

◆ Interval()

HF::Core::Scheduling::Event::Interval::Interval ( uint32_t  _start,
uint32_t  _end,
uint32_t  _repeat 
)
inline

Constructor.

Parameters
[in]_starttimestamp for the start of the event in seconds.
[in]_endtimestamp for the end of the event in seconds..
[in]_repeatrepetition interval in seconds.

Definition at line 83 of file event_scheduling.h.

83  :
84  start(_start), end(_end), repeat(_repeat)
85  {}
uint32_t repeat
Repeat interval (in seconds).

Member Function Documentation

◆ active()

bool HF::Core::Scheduling::Event::Interval::active ( uint32_t  _time) const
inline

Check if entry is active.

Parameters
[in]_timecurrent time.
Return values
trueif the entry is active.
falseotherwise.

Definition at line 117 of file event_scheduling.h.

References end, and start.

118  {
119  return (start <= _time && _time <= end);
120  }

◆ first()

uint32_t HF::Core::Scheduling::Event::Interval::first ( ) const
inline

Get the initial value for the next_run entry attribute.

Returns
the timestamp for the first run.

Definition at line 94 of file event_scheduling.h.

References start.

95  {
96  return start;
97  }

◆ pack()

uint16_t HF::Core::Scheduling::Event::Interval::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::Event::Interval::size ( ) const
inline

Number bytes needed to serialize the message.

Returns
number of bytes the message requires to be serialized.

Definition at line 128 of file event_scheduling.h.

References min_size.

129  {
130  return min_size;
131  }
static constexpr uint16_t min_size
Minimum pack/unpack required data size.

◆ step()

uint32_t HF::Core::Scheduling::Event::Interval::step ( ) const
inline

Get the step between executions.

Returns
the step time.

Definition at line 104 of file event_scheduling.h.

References repeat.

105  {
106  return repeat;
107  }
uint32_t repeat
Repeat interval (in seconds).

◆ unpack()

uint16_t HF::Core::Scheduling::Event::Interval::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

◆ end

uint32_t HF::Core::Scheduling::Event::Interval::end

End Date.

Definition at line 73 of file event_scheduling.h.

Referenced by active().

◆ repeat

uint32_t HF::Core::Scheduling::Event::Interval::repeat

Repeat interval (in seconds).

Definition at line 74 of file event_scheduling.h.

Referenced by step().

◆ start

uint32_t HF::Core::Scheduling::Event::Interval::start

Start Date.

Definition at line 72 of file event_scheduling.h.

Referenced by active(), and first().


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