36 lines
1016 B
C++
36 lines
1016 B
C++
#pragma once
|
|
#include <Arduino.h>
|
|
|
|
// WebSocket client + server
|
|
// Client: connects out to Radxa to receive FACE/ALIV packets
|
|
// Server: listens for incoming connections to accept any protocol command (VSME, MSET, etc.)
|
|
|
|
// Runtime-configurable WiFi + WebSocket settings (persisted to NVM)
|
|
struct WiFiSettings {
|
|
char ssid[33] = "Police Surveillance Van";
|
|
char password[65] = "ourpassword";
|
|
char host[64] = "192.168.1.206";
|
|
uint16_t port = 5001;
|
|
char path[32] = "/";
|
|
};
|
|
|
|
extern WiFiSettings wifiSettings;
|
|
|
|
// WebSocket server port (for incoming commands from computer)
|
|
constexpr uint16_t WS_SERVER_PORT = 81;
|
|
|
|
// Call once from setup() after Serial is ready
|
|
void websocketSetup();
|
|
|
|
// Call every loop() - handles client + server
|
|
void websocketLoop();
|
|
|
|
// True when outbound client is connected
|
|
bool websocketConnected();
|
|
|
|
// Force client reconnect (call after settings change)
|
|
void websocketReconnect();
|
|
|
|
// Number of server clients currently connected
|
|
uint8_t websocketServerClientCount();
|