btclock_v3/src/lib/block_notify.hpp

41 lines
980 B
C++
Raw Normal View History

2023-11-07 00:11:12 +00:00
#pragma once
#include <Arduino.h>
#include <ArduinoJson.h>
2023-11-30 21:38:01 +00:00
#include <HTTPClient.h>
#include <esp_timer.h>
#include <esp_websocket_client.h>
2023-11-30 21:56:50 +00:00
#include <cstring>
2023-11-30 21:38:01 +00:00
#include <string>
2023-11-07 00:11:12 +00:00
2023-11-30 21:56:50 +00:00
#include "lib/led_handler.hpp"
#include "lib/screen_handler.hpp"
#include "lib/timers.hpp"
2023-11-30 21:56:50 +00:00
#include "lib/shared.hpp"
2023-11-30 21:38:01 +00:00
// using namespace websockets;
2023-11-07 00:11:12 +00:00
void setupBlockNotify();
void onWebsocketBlockEvent(void *handler_args, esp_event_base_t base,
2023-11-30 21:38:01 +00:00
int32_t event_id, void *event_data);
void onWebsocketBlockMessage(esp_websocket_event_data_t *event_data);
2023-11-07 00:11:12 +00:00
void setBlockHeight(uint newBlockHeight);
uint getBlockHeight();
void setBlockMedianFee(uint blockMedianFee);
uint getBlockMedianFee();
2023-11-08 11:18:59 +00:00
bool isBlockNotifyConnected();
2024-01-31 22:45:26 +00:00
void stopBlockNotify();
void restartBlockNotify();
2024-07-11 20:08:42 +00:00
void processNewBlock(uint newBlockHeight);
void processNewBlockFee(uint newBlockFee);
2024-03-30 10:40:58 +00:00
bool getBlockNotifyInit();
uint getLastBlockUpdate();
int getBlockFetch();
void setLastBlockUpdate(uint lastUpdate);