Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_TwilightBehaviour.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: Dec 6, 2019
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7
8/*
9 * Author: Crownstone Team
10 * Copyright: Crownstone (https://crownstone.rocks)
11 * Date: Dec 20, 2019
12 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
13 */
14
15#pragma once
16
19#include <stdint.h>
20#include <time/cs_DayOfWeek.h>
21#include <time/cs_TimeOfDay.h>
22#include <util/cs_WireFormat.h>
23
24#include <optional>
25
27public:
28 typedef std::array<uint8_t, WireFormat::size<Behaviour>()> SerializedDataType;
29
30 virtual ~TwilightBehaviour() = default;
32 uint8_t intensity, uint8_t profileid, DayOfWeekBitMask activedaysofweek, TimeOfDay from, TimeOfDay until);
33
36
37 virtual uint8_t* serialize(uint8_t* outbuff, size_t max_size) override;
38 virtual size_t serializedSize() const override;
39
40 virtual void print() override;
41
42 virtual Type getType() const override { return Type::Twilight; }
43
44 // Because of the definition of isValid(PresenceStateDescription) in this class
45 // the base class function with the same name is shadowed. This using statement
46 // reintroduces the function name in this class's scope.
48};
bool isValid()
Checks if the data has valid values.
Class to derrive behaviours from, centralizing common variables such as from and until times.
Definition: cs_Behaviour.h:20
Type
Definition: cs_Behaviour.h:22
TimeOfDay until() const
Returns until (excl.) which time on this behaviour applies.
TimeOfDay from() const
Returns from (incl.) which time on this behaviour applies.
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Sep 24,...
Definition: cs_TimeOfDay.h:19
Definition: cs_TwilightBehaviour.h:26
std::array< uint8_t, WireFormat::size< Behaviour >()> SerializedDataType
Definition: cs_TwilightBehaviour.h:28
virtual ~TwilightBehaviour()=default
TwilightBehaviour(uint8_t intensity, uint8_t profileid, DayOfWeekBitMask activedaysofweek, TimeOfDay from, TimeOfDay until)
SerializedDataType serialize()
virtual void print() override
virtual size_t serializedSize() const override
virtual Type getType() const override
Definition: cs_TwilightBehaviour.h:42
TwilightBehaviour(SerializedDataType arr)
virtual uint8_t * serialize(uint8_t *outbuff, size_t max_size) override
uint8_t DayOfWeekBitMask
Definition: cs_DayOfWeek.h:23