blob: 1373d3047f55c0bd963cc12952c81bd3c6190889 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#pragma once
#include "indicator.h"
#include <cstdint>
#include <string>
namespace de::uvok::badge
{
enum class BleActionType
{
None,
Template,
Indicator,
TextAsQrCode
};
struct BlePollResult
{
BleActionType action_type;
union {
uint8_t new_template;
DisplayIndicator new_indicator;
};
std::string new_text;
static BlePollResult MakeTemplate(uint8_t val)
{
BlePollResult p{};
p.action_type = BleActionType::Template;
p.new_template = val;
return p;
}
static BlePollResult MakeText(const std::string &val)
{
BlePollResult p{};
p.action_type = BleActionType::TextAsQrCode;
p.new_text = val;
return p;
}
static BlePollResult MakeEmpty()
{
BlePollResult p{};
return p;
}
static BlePollResult MakeIndicator(DisplayIndicator ind)
{
BlePollResult p{};
p.action_type = BleActionType::Indicator;
p.new_indicator = ind;
return p;
}
private:
BlePollResult() : action_type(BleActionType::None), new_indicator(DisplayIndicator::None)
{
}
};
void ble_init();
void ble_advertise();
bool ble_is_active();
BlePollResult ble_poll();
void ble_set_image(uint8_t image);
} // namespace de::uvok::badge
|