14 uint8_t address[BLE_GAP_ADDR_LEN];
18#define T2T_LIST_COUNT 3
19#define T2T_SCORE_INC (2000 / TICK_INTERVAL_MS)
20#define T2T_SCORE_THRESHOLD (3000 / TICK_INTERVAL_MS)
21#define T2T_SCORE_MAX (5000 / TICK_INTERVAL_MS)
22#define T2T_TIMEOUT_MS 1500
Event listener.
Definition: cs_EventListener.h:17
Class that toggles the switch when a device, like a phone, is held close to the Crownstone.
Definition: cs_TapToToggle.h:38
void tick()
Decrease score of each MAC address.
uint8_t scoreThreshold
Threshold above which the toggle is triggered.
Definition: cs_TapToToggle.h:77
void init(int8_t rssiThreshold)
int8_t defaultRssiThreshold
Default RSSI threshold for this board.
Definition: cs_TapToToggle.h:67
uint16_t timeoutCounter
Used to count down the timeout.
Definition: cs_TapToToggle.h:57
int8_t rssiThreshold
RSSI threshold, above which score will be added.
Definition: cs_TapToToggle.h:62
uint8_t scoreMax
Score can't be higher than this value.
Definition: cs_TapToToggle.h:82
void handleBackgroundAdvertisement(adv_background_parsed_t *adv)
Handle background advertisement.
void handleEvent(event_t &event)
Handle events.
uint8_t scoreIncrement
Score is increased with this value when rssi is above rssi threshold.
Definition: cs_TapToToggle.h:72
TYPIFY(CONFIG_TAP_TO_TOGGLE_ENABLED) enabled
Whether tap to toggle is enabled on this crownstone.
static TapToToggle & getInstance()
Definition: cs_TapToToggle.h:40
uint8_t timeoutTicks
Minimal time in ticks between 2 tap to toggle events.
Definition: cs_TapToToggle.h:87
t2t_entry_t list[T2T_LIST_COUNT]
Definition: cs_TapToToggle.h:53
Author: Crownstone Team Copyright: Crownstone (https://crownstone.rocks) Date: Oct 9,...
Definition: cs_Event.h:26
const bool g_CONFIG_TAP_TO_TOGGLE_ENABLED_DEFAULT
#define TICK_INTERVAL_MS
Interval in milliseconds at which tick events are dispatched.
Definition: cs_Config.h:277
#define T2T_LIST_COUNT
Definition: cs_TapToToggle.h:18
#define T2T_SCORE_MAX
Definition: cs_TapToToggle.h:21
#define T2T_TIMEOUT_MS
Definition: cs_TapToToggle.h:22
#define T2T_SCORE_INC
Definition: cs_TapToToggle.h:19
#define T2T_SCORE_THRESHOLD
Definition: cs_TapToToggle.h:20
@ CONFIG_TAP_TO_TOGGLE_ENABLED
Parsed background advertisement.
Definition: cs_PacketsInternal.h:241
Definition: cs_TapToToggle.h:13
uint16_t score
Definition: cs_TapToToggle.h:15