upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/market.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/market.h')
-rw-r--r--main/market.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/main/market.h b/main/market.h
new file mode 100644
index 0000000..6dbf43c
--- /dev/null
+++ b/main/market.h
@@ -0,0 +1,40 @@
1#ifndef MARKET_H
2#define MARKET_H
3
4#include "beacon_price.h"
5#include "esp_wifi.h"
6#include "esp_err.h"
7#include <stdint.h>
8#include <stdbool.h>
9
10#define MARKET_MAX_ENTRIES 10
11
12typedef struct {
13 uint8_t bssid[6];
14 char ssid[33];
15 int8_t rssi;
16 uint16_t price_per_step;
17 uint32_t step_size;
18 uint8_t metric;
19 uint8_t mint_hash[4];
20 uint8_t npub_hash[4];
21 char geohash[TOLLGATE_IE_GEOHASH_MAX + 1];
22 int64_t discovered_ms;
23 bool valid;
24} market_entry_t;
25
26typedef struct {
27 market_entry_t entries[MARKET_MAX_ENTRIES];
28 int count;
29 int64_t last_scan_ms;
30 bool scanning;
31 int consecutive_failures;
32} market_t;
33
34esp_err_t market_init(void);
35void market_tick(void);
36const market_t *market_get(void);
37int market_find_cheapest(void);
38void market_parse_vendor_ie(const uint8_t sa[6], const vendor_ie_data_t *ie, int rssi);
39
40#endif