Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_PresencePredicate.h
Go to the documentation of this file.
1/*
2 * Author: Crownstone Team
3 * Copyright: Crownstone (https://crownstone.rocks)
4 * Date: Oct 23, 2019
5 * License: LGPLv3+, Apache License 2.0, and/or MIT (triple-licensed)
6 */
7
8#pragma once
9
10#include <logging/cs_Logger.h>
12
13#include <array>
14
16public:
17 typedef std::array<uint8_t, 9> SerializedDataType;
18
19 // user id restrictions?
20 enum class Condition : uint8_t {
21 VacuouslyTrue = 0,
26 };
27
28 // private: DEBUG
31
32public:
34
36
37 bool requiresPresence() const;
38 bool requiresAbsence() const;
39
41
42 // parameter bit i is 1 whenever there is presence detected in the
43 // room with index i.
45
46 void print() {
47 uint64_t locationBitmask = _presence.getBitmask();
48
49 [[maybe_unused]] uint32_t locationBitmasks[2] = {
50 static_cast<uint32_t>(locationBitmask >> 0), static_cast<uint32_t>(locationBitmask >> 32)};
51 LOGd("PresencePredicate(condition: %d presence: 0x%04x 0x%04x)",
52 static_cast<uint8_t>(_condition),
53 locationBitmasks[1],
54 locationBitmasks[0]);
55 }
56};
Definition: cs_PresencePredicate.h:15
Condition _condition
Definition: cs_PresencePredicate.h:29
void print()
Definition: cs_PresencePredicate.h:46
PresenceStateDescription _presence
Definition: cs_PresencePredicate.h:30
PresencePredicate(Condition c, PresenceStateDescription presence)
PresencePredicate(SerializedDataType arr)
bool requiresAbsence() const
bool isTrue(PresenceStateDescription presence)
Condition
Definition: cs_PresencePredicate.h:20
std::array< uint8_t, 9 > SerializedDataType
Definition: cs_PresencePredicate.h:17
bool requiresPresence() const
SerializedDataType serialize()
Class that holds the presence of a profile.
Definition: cs_PresenceDescription.h:23
uint64_t getBitmask()
Definition: cs_PresenceDescription.h:45
#define LOGd(fmt,...)
Definition: cs_Logger.h:90