Upgrade Playlist Features
This commit is contained in:
@@ -1,34 +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(std::unique_ptr<AudioStreamPacket> packet) override;
|
||||
bool OpenAudioChannel() override;
|
||||
void CloseAudioChannel() override;
|
||||
bool IsAudioChannelOpened() const override;
|
||||
|
||||
private:
|
||||
EventGroupHandle_t event_group_handle_;
|
||||
std::unique_ptr<WebSocket> websocket_;
|
||||
int version_ = 1;
|
||||
|
||||
void ParseServerHello(const cJSON* root);
|
||||
bool SendText(const std::string& text) override;
|
||||
std::string GetHelloMessage();
|
||||
};
|
||||
|
||||
#endif
|
||||
#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(std::unique_ptr<AudioStreamPacket> packet) override;
|
||||
bool OpenAudioChannel() override;
|
||||
void CloseAudioChannel() override;
|
||||
bool IsAudioChannelOpened() const override;
|
||||
|
||||
private:
|
||||
EventGroupHandle_t event_group_handle_;
|
||||
std::unique_ptr<WebSocket> websocket_;
|
||||
int version_ = 1;
|
||||
|
||||
void ParseServerHello(const cJSON* root);
|
||||
bool SendText(const std::string& text) override;
|
||||
std::string GetHelloMessage();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user