blob: cb2eb5bc52e9d976373a528a34fa13acbac77611 (
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
|
#ifndef BEACON_PRICE_H
#define BEACON_PRICE_H
#include "esp_err.h"
#include <stdint.h>
#include <stdbool.h>
#define TOLLGATE_OUI_0 0xC0
#define TOLLGATE_OUI_1 0xFF
#define TOLLGATE_OUI_2 0xEE
#define TOLLGATE_IE_TYPE 0x01
#define TOLLGATE_IE_VERSION 1
#define TOLLGATE_IE_GEOHASH_MAX 9
typedef struct __attribute__((packed)) {
uint8_t version;
uint8_t metric;
uint16_t price_per_step;
uint32_t step_size;
uint8_t mint_hash[4];
uint8_t geohash_len;
char geohash[TOLLGATE_IE_GEOHASH_MAX];
uint8_t npub_hash[4];
} tollgate_price_payload_t;
#define TOLLGATE_IE_PAYLOAD_SIZE sizeof(tollgate_price_payload_t)
#define TOLLGATE_IE_TOTAL_SIZE (6 + TOLLGATE_IE_PAYLOAD_SIZE)
typedef struct __attribute__((packed)) {
uint8_t element_id;
uint8_t length;
uint8_t vendor_oui[3];
uint8_t vendor_oui_type;
tollgate_price_payload_t payload;
} tollgate_price_ie_t;
esp_err_t beacon_price_start(void);
esp_err_t beacon_price_stop(void);
void beacon_price_build_ie(tollgate_price_ie_t *ie);
void beacon_price_hash_mint(const char *mint_url, uint8_t hash_out[4]);
void beacon_price_hash_npub(const char *npub_hex, uint8_t hash_out[4]);
#endif
|