34 lines
809 B
C
34 lines
809 B
C
#ifndef WS_H
|
|
#define WS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <esp_websocket_client.h>
|
|
|
|
#include "config.h"
|
|
|
|
#define WS_DEV_CODE_BOAT 3440
|
|
#define WS_DEV_CODE_CLIENT 4675
|
|
|
|
typedef struct {
|
|
esp_websocket_client_handle_t handle;
|
|
int connected;
|
|
unsigned char rxBuffer[WS_RX_BUFFER_LEN];
|
|
uint16_t rxBuffer_wp;
|
|
uint16_t rxBuffer_rp;
|
|
unsigned char txBuffer[WS_TX_BUFFER_LEN];
|
|
uint16_t txBuffer_wp;
|
|
uint16_t id;
|
|
uint16_t dev_code;
|
|
} ws_client_data_t;
|
|
typedef ws_client_data_t* ws_client_t;
|
|
|
|
ws_client_t ws_connect(char *url, uint16_t id, uint16_t dev_code);
|
|
int ws_getchar(ws_client_t client);
|
|
int ws_getstr(ws_client_t client, uint16_t max_len, char *str);
|
|
void ws_putchar(ws_client_t client, char c);
|
|
void ws_sendData(ws_client_t client);
|
|
void ws_sendString(ws_client_t client, const char *str);
|
|
|
|
#endif
|