BSB Developer Docs
Loading...
Searching...
No Matches
account_model.h
1
5#pragma once
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#include <furi.h>
12#include <time.h>
13
14#define ACCOUNT_MODEL_LINK_PIN_LEN 4
15
16typedef struct AccountModel AccountModel;
17
18typedef enum {
19 AccountModelStateNotConnected, // Not connected to MQTT broker
20 AccountModelStateConnectedNotLinked, // Connected to MQTT broker, not linked
21 AccountModelStateConnectedLinked, // Connected to MQTT broker, linked
22} AccountModelState;
23
24typedef enum {
25 AccountModelEventStateChange,
26 AccountModelEventPinGot,
27 AccountModelEventPinTimeout,
28 AccountModelEventLinkDone,
29 AccountModelEventUnlinked,
30} AccountModelEvent;
31
32typedef void (*AccountModelEventCallback)(
33 AccountModelEvent event,
34 const char* pin,
35 time_t pin_valid_untill,
36 void* context);
37
38AccountModel* account_model_alloc(void);
39
40void account_model_free(AccountModel* model);
41
42AccountModelState account_model_get_state(AccountModel* model);
43
44bool account_model_is_linked(AccountModel* model);
45
46void account_model_get_email(AccountModel* model, FuriString* email);
47
48void account_model_set_event_callback(
49 AccountModel* model,
50 AccountModelEventCallback callback,
51 void* context);
52
53void account_model_unlink(AccountModel* model);
54
55void account_model_request_link_pin(AccountModel* model);
56
57#ifdef __cplusplus
58}
59#endif
Definition account_model.c:6
TIME (Simple Network Time Protocol) service API.