Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dolphin.h « dolphin « applications - github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2abb166bfa671576eed563648590e148d518136a (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
#pragma once

#include <core/pubsub.h>
#include "gui/view.h"
#include "helpers/dolphin_deed.h"
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct Dolphin Dolphin;

typedef struct {
    uint32_t icounter;
    uint32_t butthurt;
    uint64_t timestamp;
    uint8_t level;
    bool level_up_is_pending;
} DolphinStats;

typedef enum {
    DolphinPubsubEventUpdate,
} DolphinPubsubEvent;

#define DOLPHIN_DEED(deed)                                        \
    do {                                                          \
        Dolphin* dolphin = (Dolphin*)furi_record_open("dolphin"); \
        dolphin_deed(dolphin, deed);                              \
        furi_record_close("dolphin");                             \
    } while(0)

/** Deed complete notification. Call it on deed completion.
 * See dolphin_deed.h for available deeds. In futures it will become part of assets.
 * Thread safe, async
 */
void dolphin_deed(Dolphin* dolphin, DolphinDeed deed);

/** Retrieve dolphin stats
 * Thread safe, blocking
 */
DolphinStats dolphin_stats(Dolphin* dolphin);

/** Flush dolphin queue and save state
 * Thread safe, blocking
 */
void dolphin_flush(Dolphin* dolphin);

void dolphin_upgrade_level(Dolphin* dolphin);

FuriPubSub* dolphin_get_pubsub(Dolphin* dolphin);

#ifdef __cplusplus
}
#endif