Report unique hostname in wifi api
This commit is contained in:
parent
faa9b3324f
commit
1673dae523
|
@ -41,6 +41,7 @@ public:
|
||||||
State state() const { return state_; }
|
State state() const { return state_; }
|
||||||
const char *stateStr() const { return stateToString(state_); }
|
const char *stateStr() const { return stateToString(state_); }
|
||||||
|
|
||||||
|
const String & hostname() const { return hostname_; }
|
||||||
static const char *stateToString(State state);
|
static const char *stateToString(State state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -83,7 +83,6 @@ template <typename T>
|
||||||
bool SessionAPI<T>::handleMessage(websockets::WebsocketsClient &client, MessageCode code,
|
bool SessionAPI<T>::handleMessage(websockets::WebsocketsClient &client, MessageCode code,
|
||||||
const char *payload, size_t size)
|
const char *payload, size_t size)
|
||||||
{
|
{
|
||||||
Serial.println("Handling message in SessionAPI");
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case MessageCode::START_SESSION:
|
case MessageCode::START_SESSION:
|
||||||
|
|
|
@ -7,7 +7,8 @@ void WifiAPI::sendWifiState(websockets::WebsocketsClient &client)
|
||||||
{
|
{
|
||||||
StaticJsonDocument<128> data;
|
StaticJsonDocument<128> data;
|
||||||
data["state"] = wifiManager_.stateStr();
|
data["state"] = wifiManager_.stateStr();
|
||||||
sendToClient<64>(client, MessageCode::WIFI_STATE_RESPONSE, data);
|
data["hostname"] = wifiManager_.hostname();
|
||||||
|
sendToClient<192>(client, MessageCode::WIFI_STATE_RESPONSE, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WifiAPI::onClientConnect(websockets::WebsocketsClient &client)
|
void WifiAPI::onClientConnect(websockets::WebsocketsClient &client)
|
||||||
|
|
Loading…
Reference in New Issue