37 lines
811 B
C++
37 lines
811 B
C++
/// © MiroZ 2024
|
|
|
|
#ifndef __MQTT_T__
|
|
#define __MQTT_T__
|
|
|
|
#include <stdint.h>
|
|
#include <WiFiClientSecure.h>
|
|
#include <PubSubClient.h>
|
|
#include <functional>
|
|
#include "AppIF.h"
|
|
|
|
#include "mqtt_client.h"
|
|
|
|
extern const uint8_t server_cert[] asm("_binary_newca_crt_start");
|
|
// extern const uint8_t client_cert[] asm("_binary_client1_authn_ID_pem_start");
|
|
// extern const uint8_t client_key[] asm("_binary_client1_authn_ID_key_start");
|
|
|
|
using namespace std::placeholders;
|
|
|
|
class MqttService
|
|
{
|
|
protected:
|
|
WiFiClientSecure *m_esp_client;
|
|
PubSubClient *m_mqtt_client;
|
|
void callback(char* topic, uint8_t * payload, uint32_t length);
|
|
|
|
TaskHandle_t m_task = nullptr;
|
|
void task();
|
|
AppIF & m_app_if;
|
|
|
|
public:
|
|
MqttService(AppIF & app_if);
|
|
void start();
|
|
|
|
};
|
|
|
|
#endif |