diff options
Diffstat (limited to 'main/market.h')
| -rw-r--r-- | main/market.h | 40 |
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 | |||
| 12 | typedef 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 | |||
| 26 | typedef 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 | |||
| 34 | esp_err_t market_init(void); | ||
| 35 | void market_tick(void); | ||
| 36 | const market_t *market_get(void); | ||
| 37 | int market_find_cheapest(void); | ||
| 38 | void market_parse_vendor_ie(const uint8_t sa[6], const vendor_ie_data_t *ie, int rssi); | ||
| 39 | |||
| 40 | #endif | ||