first commit

This commit is contained in:
David R.
2025-09-05 18:58:05 +02:00
parent fc13e0779b
commit ed05c83ac6
3678 changed files with 832193 additions and 0 deletions
@@ -0,0 +1,34 @@
#ifndef _WEBSOCKET_PROTOCOL_H_
#define _WEBSOCKET_PROTOCOL_H_
#include "protocol.h"
#include <web_socket.h>
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>
#define WEBSOCKET_PROTOCOL_SERVER_HELLO_EVENT (1 << 0)
class WebsocketProtocol : public Protocol {
public:
WebsocketProtocol();
~WebsocketProtocol();
bool Start() override;
bool SendAudio(const AudioStreamPacket& packet) override;
bool OpenAudioChannel() override;
void CloseAudioChannel() override;
bool IsAudioChannelOpened() const override;
private:
EventGroupHandle_t event_group_handle_;
WebSocket* websocket_ = nullptr;
int version_ = 1;
void ParseServerHello(const cJSON* root);
bool SendText(const std::string& text) override;
std::string GetHelloMessage();
};
#endif