bolar_1 date 2026-7-1 d:/proc
This commit is contained in:
34
components/esp-ml307/src/esp/esp_ssl.h
Normal file
34
components/esp-ml307/src/esp/esp_ssl.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef _ESP_SSL_H_
|
||||
#define _ESP_SSL_H_
|
||||
|
||||
#include "tcp.h"
|
||||
#include <esp_tls.h>
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/event_groups.h>
|
||||
#include <freertos/semphr.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
#define ESP_SSL_EVENT_RECEIVE_TASK_EXIT 1
|
||||
|
||||
class EspSsl : public Tcp {
|
||||
public:
|
||||
EspSsl();
|
||||
~EspSsl();
|
||||
|
||||
bool Connect(const std::string& host, int port) override;
|
||||
void Disconnect() override;
|
||||
int Send(const std::string& data) override;
|
||||
|
||||
private:
|
||||
esp_tls_t* tls_client_ = nullptr;
|
||||
EventGroupHandle_t event_group_ = nullptr;
|
||||
TaskHandle_t receive_task_handle_ = nullptr;
|
||||
// Serializes Send() and Disconnect(): prevents esp_tls_conn_destroy()
|
||||
// from freeing the mbedtls session while esp_tls_conn_write() is using it.
|
||||
SemaphoreHandle_t send_mutex_ = nullptr;
|
||||
|
||||
void ReceiveTask();
|
||||
};
|
||||
|
||||
#endif // _ESP_SSL_H_
|
||||
Reference in New Issue
Block a user