mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-19 14:33:45 +02:00
Reformat project using clang-format
This commit is contained in:
@@ -30,140 +30,117 @@ std::unordered_map<std::string, CommandType> commandTypeMap = {
|
||||
{"get_who_am_i", CommandType::GET_WHO_AM_I},
|
||||
};
|
||||
|
||||
std::function<CommandResult()> CommandManager::createCommand(const CommandType type, const nlohmann::json &json) const
|
||||
std::function<CommandResult()> CommandManager::createCommand(const CommandType type, const nlohmann::json& json) const
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CommandType::PING:
|
||||
return {PingCommand};
|
||||
case CommandType::PAUSE:
|
||||
return [json]
|
||||
{ return PauseCommand(json); };
|
||||
case CommandType::UPDATE_OTA_CREDENTIALS:
|
||||
return [this, json]
|
||||
{ return updateOTACredentialsCommand(this->registry, json); };
|
||||
case CommandType::SET_WIFI:
|
||||
return [this, json]
|
||||
{ return setWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_WIFI:
|
||||
return [this, json]
|
||||
{ return updateWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_AP_WIFI:
|
||||
return [this, json]
|
||||
{ return updateAPWiFiCommand(this->registry, json); };
|
||||
case CommandType::DELETE_NETWORK:
|
||||
return [this, json]
|
||||
{ return deleteWiFiCommand(this->registry, json); };
|
||||
case CommandType::SET_MDNS:
|
||||
return [this, json]
|
||||
{ return setMDNSCommand(this->registry, json); };
|
||||
case CommandType::GET_MDNS_NAME:
|
||||
return [this]
|
||||
{ return getMDNSNameCommand(this->registry); };
|
||||
case CommandType::UPDATE_CAMERA:
|
||||
return [this, json]
|
||||
{ return updateCameraCommand(this->registry, json); };
|
||||
case CommandType::GET_CONFIG:
|
||||
return [this]
|
||||
{ return getConfigCommand(this->registry); };
|
||||
case CommandType::SAVE_CONFIG:
|
||||
return [this]
|
||||
{ return saveConfigCommand(this->registry); };
|
||||
case CommandType::RESET_CONFIG:
|
||||
return [this, json]
|
||||
{ return resetConfigCommand(this->registry, json); };
|
||||
case CommandType::RESTART_DEVICE:
|
||||
return restartDeviceCommand;
|
||||
case CommandType::SCAN_NETWORKS:
|
||||
return [this, json]
|
||||
{ return scanNetworksCommand(this->registry, json); };
|
||||
case CommandType::START_STREAMING:
|
||||
return startStreamingCommand;
|
||||
case CommandType::GET_WIFI_STATUS:
|
||||
return [this]
|
||||
{ return getWiFiStatusCommand(this->registry); };
|
||||
case CommandType::CONNECT_WIFI:
|
||||
return [this]
|
||||
{ return connectWiFiCommand(this->registry); };
|
||||
case CommandType::SWITCH_MODE:
|
||||
return [this, json]
|
||||
{ return switchModeCommand(this->registry, json); };
|
||||
case CommandType::GET_DEVICE_MODE:
|
||||
return [this]
|
||||
{ return getDeviceModeCommand(this->registry); };
|
||||
case CommandType::SET_LED_DUTY_CYCLE:
|
||||
return [this, json]
|
||||
{ return updateLEDDutyCycleCommand(this->registry, json); };
|
||||
case CommandType::GET_LED_DUTY_CYCLE:
|
||||
return [this]
|
||||
{ return getLEDDutyCycleCommand(this->registry); };
|
||||
case CommandType::GET_SERIAL:
|
||||
return [this]
|
||||
{ return getSerialNumberCommand(this->registry); };
|
||||
case CommandType::GET_LED_CURRENT:
|
||||
return [this]
|
||||
{ return getLEDCurrentCommand(this->registry); };
|
||||
case CommandType::GET_BATTERY_STATUS:
|
||||
return [this]
|
||||
{ return getBatteryStatusCommand(this->registry); };
|
||||
case CommandType::GET_WHO_AM_I:
|
||||
return [this]
|
||||
{ return getInfoCommand(this->registry); };
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case CommandType::PING:
|
||||
return {PingCommand};
|
||||
case CommandType::PAUSE:
|
||||
return [json] { return PauseCommand(json); };
|
||||
case CommandType::UPDATE_OTA_CREDENTIALS:
|
||||
return [this, json] { return updateOTACredentialsCommand(this->registry, json); };
|
||||
case CommandType::SET_WIFI:
|
||||
return [this, json] { return setWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_WIFI:
|
||||
return [this, json] { return updateWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_AP_WIFI:
|
||||
return [this, json] { return updateAPWiFiCommand(this->registry, json); };
|
||||
case CommandType::DELETE_NETWORK:
|
||||
return [this, json] { return deleteWiFiCommand(this->registry, json); };
|
||||
case CommandType::SET_MDNS:
|
||||
return [this, json] { return setMDNSCommand(this->registry, json); };
|
||||
case CommandType::GET_MDNS_NAME:
|
||||
return [this] { return getMDNSNameCommand(this->registry); };
|
||||
case CommandType::UPDATE_CAMERA:
|
||||
return [this, json] { return updateCameraCommand(this->registry, json); };
|
||||
case CommandType::GET_CONFIG:
|
||||
return [this] { return getConfigCommand(this->registry); };
|
||||
case CommandType::SAVE_CONFIG:
|
||||
return [this] { return saveConfigCommand(this->registry); };
|
||||
case CommandType::RESET_CONFIG:
|
||||
return [this, json] { return resetConfigCommand(this->registry, json); };
|
||||
case CommandType::RESTART_DEVICE:
|
||||
return restartDeviceCommand;
|
||||
case CommandType::SCAN_NETWORKS:
|
||||
return [this, json] { return scanNetworksCommand(this->registry, json); };
|
||||
case CommandType::START_STREAMING:
|
||||
return startStreamingCommand;
|
||||
case CommandType::GET_WIFI_STATUS:
|
||||
return [this] { return getWiFiStatusCommand(this->registry); };
|
||||
case CommandType::CONNECT_WIFI:
|
||||
return [this] { return connectWiFiCommand(this->registry); };
|
||||
case CommandType::SWITCH_MODE:
|
||||
return [this, json] { return switchModeCommand(this->registry, json); };
|
||||
case CommandType::GET_DEVICE_MODE:
|
||||
return [this] { return getDeviceModeCommand(this->registry); };
|
||||
case CommandType::SET_LED_DUTY_CYCLE:
|
||||
return [this, json] { return updateLEDDutyCycleCommand(this->registry, json); };
|
||||
case CommandType::GET_LED_DUTY_CYCLE:
|
||||
return [this] { return getLEDDutyCycleCommand(this->registry); };
|
||||
case CommandType::GET_SERIAL:
|
||||
return [this] { return getSerialNumberCommand(this->registry); };
|
||||
case CommandType::GET_LED_CURRENT:
|
||||
return [this] { return getLEDCurrentCommand(this->registry); };
|
||||
case CommandType::GET_BATTERY_STATUS:
|
||||
return [this] { return getBatteryStatusCommand(this->registry); };
|
||||
case CommandType::GET_WHO_AM_I:
|
||||
return [this] { return getInfoCommand(this->registry); };
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
CommandManagerResponse CommandManager::executeFromJson(const std::string_view json) const
|
||||
{
|
||||
if (!nlohmann::json::accept(json))
|
||||
{
|
||||
return CommandManagerResponse(nlohmann::json{{"error", "Initial JSON Parse - Invalid JSON"}});
|
||||
}
|
||||
|
||||
nlohmann::json parsedJson = nlohmann::json::parse(json);
|
||||
if (!parsedJson.contains("commands") || !parsedJson["commands"].is_array() || parsedJson["commands"].empty())
|
||||
{
|
||||
return CommandManagerResponse(CommandResult::getErrorResult("Commands missing"));
|
||||
}
|
||||
|
||||
nlohmann::json results = nlohmann::json::array();
|
||||
|
||||
for (auto &commandObject : parsedJson["commands"].items())
|
||||
{
|
||||
auto commandData = commandObject.value();
|
||||
if (!commandData.contains("command"))
|
||||
if (!nlohmann::json::accept(json))
|
||||
{
|
||||
return CommandManagerResponse({{"command", "Unknown command"}, {"error", "Missing command type"}});
|
||||
return CommandManagerResponse(nlohmann::json{{"error", "Initial JSON Parse - Invalid JSON"}});
|
||||
}
|
||||
|
||||
const auto commandName = commandData["command"].get<std::string>();
|
||||
if (!commandTypeMap.contains(commandName))
|
||||
nlohmann::json parsedJson = nlohmann::json::parse(json);
|
||||
if (!parsedJson.contains("commands") || !parsedJson["commands"].is_array() || parsedJson["commands"].empty())
|
||||
{
|
||||
return CommandManagerResponse({{"command", commandName}, {"error", "Unknown command"}});
|
||||
return CommandManagerResponse(CommandResult::getErrorResult("Commands missing"));
|
||||
}
|
||||
|
||||
const auto commandType = commandTypeMap.at(commandName);
|
||||
const auto commandPayload = commandData.contains("data") ? commandData["data"] : nlohmann::json::object();
|
||||
nlohmann::json results = nlohmann::json::array();
|
||||
|
||||
auto command = createCommand(commandType, commandPayload);
|
||||
results.push_back({
|
||||
{"command", commandName},
|
||||
{"result", command()},
|
||||
});
|
||||
}
|
||||
auto response = nlohmann::json{{"results", results}};
|
||||
return CommandManagerResponse(response);
|
||||
for (auto& commandObject : parsedJson["commands"].items())
|
||||
{
|
||||
auto commandData = commandObject.value();
|
||||
if (!commandData.contains("command"))
|
||||
{
|
||||
return CommandManagerResponse({{"command", "Unknown command"}, {"error", "Missing command type"}});
|
||||
}
|
||||
|
||||
const auto commandName = commandData["command"].get<std::string>();
|
||||
if (!commandTypeMap.contains(commandName))
|
||||
{
|
||||
return CommandManagerResponse({{"command", commandName}, {"error", "Unknown command"}});
|
||||
}
|
||||
|
||||
const auto commandType = commandTypeMap.at(commandName);
|
||||
const auto commandPayload = commandData.contains("data") ? commandData["data"] : nlohmann::json::object();
|
||||
|
||||
auto command = createCommand(commandType, commandPayload);
|
||||
results.push_back({
|
||||
{"command", commandName},
|
||||
{"result", command()},
|
||||
});
|
||||
}
|
||||
auto response = nlohmann::json{{"results", results}};
|
||||
return CommandManagerResponse(response);
|
||||
}
|
||||
|
||||
CommandManagerResponse CommandManager::executeFromType(const CommandType type, const std::string_view json) const
|
||||
{
|
||||
const auto command = createCommand(type, json);
|
||||
const auto command = createCommand(type, json);
|
||||
|
||||
if (command == nullptr)
|
||||
{
|
||||
return CommandManagerResponse({{"command", type}, {"error", "Unknown command"}});
|
||||
}
|
||||
if (command == nullptr)
|
||||
{
|
||||
return CommandManagerResponse({{"command", type}, {"error", "Unknown command"}});
|
||||
}
|
||||
|
||||
return CommandManagerResponse(nlohmann::json{{"result", command()}});
|
||||
return CommandManagerResponse(nlohmann::json{{"result", command()}});
|
||||
}
|
||||
@@ -1,66 +1,66 @@
|
||||
#ifndef COMMANDMANAGER_HPP
|
||||
#define COMMANDMANAGER_HPP
|
||||
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <CameraManager.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include "CommandResult.hpp"
|
||||
#include "CommandSchema.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include "commands/simple_commands.hpp"
|
||||
#include "commands/camera_commands.hpp"
|
||||
#include "commands/config_commands.hpp"
|
||||
#include "commands/mdns_commands.hpp"
|
||||
#include "commands/wifi_commands.hpp"
|
||||
#include "commands/device_commands.hpp"
|
||||
#include "commands/mdns_commands.hpp"
|
||||
#include "commands/scan_commands.hpp"
|
||||
#include <nlohmann-json.hpp>
|
||||
#include "commands/simple_commands.hpp"
|
||||
#include "commands/wifi_commands.hpp"
|
||||
|
||||
enum class CommandType
|
||||
{
|
||||
None,
|
||||
PING,
|
||||
PAUSE,
|
||||
SET_WIFI,
|
||||
UPDATE_OTA_CREDENTIALS,
|
||||
UPDATE_WIFI,
|
||||
DELETE_NETWORK,
|
||||
UPDATE_AP_WIFI,
|
||||
SET_MDNS,
|
||||
GET_MDNS_NAME,
|
||||
UPDATE_CAMERA,
|
||||
SAVE_CONFIG,
|
||||
GET_CONFIG,
|
||||
RESET_CONFIG,
|
||||
RESTART_DEVICE,
|
||||
SCAN_NETWORKS,
|
||||
START_STREAMING,
|
||||
GET_WIFI_STATUS,
|
||||
CONNECT_WIFI,
|
||||
SWITCH_MODE,
|
||||
GET_DEVICE_MODE,
|
||||
SET_LED_DUTY_CYCLE,
|
||||
GET_LED_DUTY_CYCLE,
|
||||
GET_SERIAL,
|
||||
GET_LED_CURRENT,
|
||||
GET_BATTERY_STATUS,
|
||||
GET_WHO_AM_I,
|
||||
None,
|
||||
PING,
|
||||
PAUSE,
|
||||
SET_WIFI,
|
||||
UPDATE_OTA_CREDENTIALS,
|
||||
UPDATE_WIFI,
|
||||
DELETE_NETWORK,
|
||||
UPDATE_AP_WIFI,
|
||||
SET_MDNS,
|
||||
GET_MDNS_NAME,
|
||||
UPDATE_CAMERA,
|
||||
SAVE_CONFIG,
|
||||
GET_CONFIG,
|
||||
RESET_CONFIG,
|
||||
RESTART_DEVICE,
|
||||
SCAN_NETWORKS,
|
||||
START_STREAMING,
|
||||
GET_WIFI_STATUS,
|
||||
CONNECT_WIFI,
|
||||
SWITCH_MODE,
|
||||
GET_DEVICE_MODE,
|
||||
SET_LED_DUTY_CYCLE,
|
||||
GET_LED_DUTY_CYCLE,
|
||||
GET_SERIAL,
|
||||
GET_LED_CURRENT,
|
||||
GET_BATTERY_STATUS,
|
||||
GET_WHO_AM_I,
|
||||
};
|
||||
|
||||
class CommandManager
|
||||
{
|
||||
std::shared_ptr<DependencyRegistry> registry;
|
||||
std::shared_ptr<DependencyRegistry> registry;
|
||||
|
||||
public:
|
||||
explicit CommandManager(const std::shared_ptr<DependencyRegistry> &DependencyRegistry) : registry(DependencyRegistry) {};
|
||||
std::function<CommandResult()> createCommand(const CommandType type, const nlohmann::json &json) const;
|
||||
public:
|
||||
explicit CommandManager(const std::shared_ptr<DependencyRegistry>& DependencyRegistry) : registry(DependencyRegistry) {};
|
||||
std::function<CommandResult()> createCommand(const CommandType type, const nlohmann::json& json) const;
|
||||
|
||||
CommandManagerResponse executeFromJson(std::string_view json) const;
|
||||
CommandManagerResponse executeFromType(CommandType type, std::string_view json) const;
|
||||
CommandManagerResponse executeFromJson(std::string_view json) const;
|
||||
CommandManagerResponse executeFromType(CommandType type, std::string_view json) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,24 +1,24 @@
|
||||
#include "CommandResult.hpp"
|
||||
|
||||
void to_json(nlohmann::json &j, const CommandResult &result)
|
||||
void to_json(nlohmann::json& j, const CommandResult& result)
|
||||
{
|
||||
j = nlohmann::json{{"status", result.isSuccess() ? "success" : "error"}, {"data", result.getData()}};
|
||||
j = nlohmann::json{{"status", result.isSuccess() ? "success" : "error"}, {"data", result.getData()}};
|
||||
}
|
||||
|
||||
// defined only for interface compatibility, should not be used directly
|
||||
void from_json(const nlohmann::json &j, CommandResult &result)
|
||||
void from_json(const nlohmann::json& j, CommandResult& result)
|
||||
{
|
||||
auto message = j.at("message");
|
||||
j.at("status") == "success" ? result = CommandResult::getSuccessResult(message) : result = CommandResult::getErrorResult(message);
|
||||
auto message = j.at("message");
|
||||
j.at("status") == "success" ? result = CommandResult::getSuccessResult(message) : result = CommandResult::getErrorResult(message);
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json &j, const CommandManagerResponse &result)
|
||||
void to_json(nlohmann::json& j, const CommandManagerResponse& result)
|
||||
{
|
||||
j = result.getData();
|
||||
j = result.getData();
|
||||
}
|
||||
|
||||
// defined only for interface compatibility, should not be used directly
|
||||
void from_json(const nlohmann::json &j, CommandManagerResponse &result)
|
||||
void from_json(const nlohmann::json& j, CommandManagerResponse& result)
|
||||
{
|
||||
result = CommandManagerResponse(j.at("result"));
|
||||
result = CommandManagerResponse(j.at("result"));
|
||||
}
|
||||
@@ -2,58 +2,67 @@
|
||||
#ifndef COMMAND_RESULT
|
||||
#define COMMAND_RESULT
|
||||
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <string>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
class CommandResult
|
||||
{
|
||||
public:
|
||||
enum class Status
|
||||
{
|
||||
SUCCESS,
|
||||
FAILURE,
|
||||
};
|
||||
public:
|
||||
enum class Status
|
||||
{
|
||||
SUCCESS,
|
||||
FAILURE,
|
||||
};
|
||||
|
||||
private:
|
||||
nlohmann::json data;
|
||||
Status status;
|
||||
private:
|
||||
nlohmann::json data;
|
||||
Status status;
|
||||
|
||||
public:
|
||||
CommandResult(nlohmann::json data, const Status status) : data(data), status(status) {}
|
||||
public:
|
||||
CommandResult(nlohmann::json data, const Status status) : data(data), status(status) {}
|
||||
|
||||
bool isSuccess() const { return status == Status::SUCCESS; }
|
||||
bool isSuccess() const
|
||||
{
|
||||
return status == Status::SUCCESS;
|
||||
}
|
||||
|
||||
static CommandResult getSuccessResult(nlohmann::json message)
|
||||
{
|
||||
return CommandResult(message, Status::SUCCESS);
|
||||
}
|
||||
static CommandResult getSuccessResult(nlohmann::json message)
|
||||
{
|
||||
return CommandResult(message, Status::SUCCESS);
|
||||
}
|
||||
|
||||
static CommandResult getErrorResult(nlohmann::json message)
|
||||
{
|
||||
return CommandResult(message, Status::FAILURE);
|
||||
}
|
||||
static CommandResult getErrorResult(nlohmann::json message)
|
||||
{
|
||||
return CommandResult(message, Status::FAILURE);
|
||||
}
|
||||
|
||||
nlohmann::json getData() const { return this->data; }
|
||||
nlohmann::json getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
};
|
||||
|
||||
void to_json(nlohmann::json &j, const CommandResult &result);
|
||||
void from_json(const nlohmann::json &j, CommandResult &result);
|
||||
void to_json(nlohmann::json& j, const CommandResult& result);
|
||||
void from_json(const nlohmann::json& j, CommandResult& result);
|
||||
|
||||
class CommandManagerResponse
|
||||
{
|
||||
private:
|
||||
nlohmann::json data;
|
||||
private:
|
||||
nlohmann::json data;
|
||||
|
||||
public:
|
||||
CommandManagerResponse(nlohmann::json data) : data(data) {}
|
||||
nlohmann::json getData() const { return this->data; }
|
||||
public:
|
||||
CommandManagerResponse(nlohmann::json data) : data(data) {}
|
||||
nlohmann::json getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
};
|
||||
|
||||
void to_json(nlohmann::json &j, const CommandManagerResponse &result);
|
||||
void from_json(const nlohmann::json &j, CommandManagerResponse &result);
|
||||
void to_json(nlohmann::json& j, const CommandManagerResponse& result);
|
||||
void from_json(const nlohmann::json& j, CommandManagerResponse& result);
|
||||
|
||||
#endif
|
||||
@@ -1,81 +1,82 @@
|
||||
#include "CommandSchema.hpp"
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateWifiPayload &payload)
|
||||
void to_json(nlohmann::json& j, const UpdateWifiPayload& payload)
|
||||
{
|
||||
j = nlohmann::json{{"name", payload.name}, {"ssid", payload.ssid}, {"password", payload.password}, {"channel", payload.channel}, {"power", payload.power}};
|
||||
j = nlohmann::json{{"name", payload.name}, {"ssid", payload.ssid}, {"password", payload.password}, {"channel", payload.channel}, {"power", payload.power}};
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, UpdateWifiPayload &payload)
|
||||
void from_json(const nlohmann::json& j, UpdateWifiPayload& payload)
|
||||
{
|
||||
payload.name = j.at("name").get<std::string>();
|
||||
if (j.contains("ssid"))
|
||||
{
|
||||
payload.ssid = j.at("ssid").get<std::string>();
|
||||
}
|
||||
payload.name = j.at("name").get<std::string>();
|
||||
if (j.contains("ssid"))
|
||||
{
|
||||
payload.ssid = j.at("ssid").get<std::string>();
|
||||
}
|
||||
|
||||
if (j.contains("password"))
|
||||
{
|
||||
payload.password = j.at("password").get<std::string>();
|
||||
}
|
||||
if (j.contains("password"))
|
||||
{
|
||||
payload.password = j.at("password").get<std::string>();
|
||||
}
|
||||
|
||||
if (j.contains("channel"))
|
||||
{
|
||||
payload.channel = j.at("channel").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("channel"))
|
||||
{
|
||||
payload.channel = j.at("channel").get<uint8_t>();
|
||||
}
|
||||
|
||||
if (j.contains("power"))
|
||||
{
|
||||
payload.power = j.at("power").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("power"))
|
||||
{
|
||||
payload.power = j.at("power").get<uint8_t>();
|
||||
}
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateAPWiFiPayload &payload)
|
||||
void to_json(nlohmann::json& j, const UpdateAPWiFiPayload& payload)
|
||||
{
|
||||
j = nlohmann::json{{"ssid", payload.ssid}, {"password", payload.password}, {"channel", payload.channel}};
|
||||
j = nlohmann::json{{"ssid", payload.ssid}, {"password", payload.password}, {"channel", payload.channel}};
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, UpdateAPWiFiPayload &payload)
|
||||
void from_json(const nlohmann::json& j, UpdateAPWiFiPayload& payload)
|
||||
{
|
||||
if (j.contains("ssid"))
|
||||
{
|
||||
payload.ssid = j.at("ssid").get<std::string>();
|
||||
}
|
||||
if (j.contains("ssid"))
|
||||
{
|
||||
payload.ssid = j.at("ssid").get<std::string>();
|
||||
}
|
||||
|
||||
if (j.contains("password"))
|
||||
{
|
||||
payload.password = j.at("password").get<std::string>();
|
||||
}
|
||||
if (j.contains("channel"))
|
||||
{
|
||||
payload.channel = j.at("channel").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("password"))
|
||||
{
|
||||
payload.password = j.at("password").get<std::string>();
|
||||
}
|
||||
if (j.contains("channel"))
|
||||
{
|
||||
payload.channel = j.at("channel").get<uint8_t>();
|
||||
}
|
||||
}
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateCameraConfigPayload &payload)
|
||||
void to_json(nlohmann::json& j, const UpdateCameraConfigPayload& payload)
|
||||
{
|
||||
j = nlohmann::json{{"vflip", payload.vflip}, {"href", payload.href}, {"framesize", payload.framesize}, {"quality", payload.quality}, {"brightness", payload.brightness}};
|
||||
j = nlohmann::json{
|
||||
{"vflip", payload.vflip}, {"href", payload.href}, {"framesize", payload.framesize}, {"quality", payload.quality}, {"brightness", payload.brightness}};
|
||||
}
|
||||
|
||||
void from_json(const nlohmann::json &j, UpdateCameraConfigPayload &payload)
|
||||
void from_json(const nlohmann::json& j, UpdateCameraConfigPayload& payload)
|
||||
{
|
||||
if (j.contains("vflip"))
|
||||
{
|
||||
payload.vflip = j.at("vflip").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("href"))
|
||||
{
|
||||
payload.href = j.at("href").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("framesize"))
|
||||
{
|
||||
payload.framesize = j.at("framesize").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("quality"))
|
||||
{
|
||||
payload.quality = j.at("quality").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("brightness"))
|
||||
{
|
||||
payload.brightness = j.at("brightness").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("vflip"))
|
||||
{
|
||||
payload.vflip = j.at("vflip").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("href"))
|
||||
{
|
||||
payload.href = j.at("href").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("framesize"))
|
||||
{
|
||||
payload.framesize = j.at("framesize").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("quality"))
|
||||
{
|
||||
payload.quality = j.at("quality").get<uint8_t>();
|
||||
}
|
||||
if (j.contains("brightness"))
|
||||
{
|
||||
payload.brightness = j.at("brightness").get<uint8_t>();
|
||||
}
|
||||
}
|
||||
@@ -8,59 +8,59 @@ struct BasePayload
|
||||
|
||||
struct WifiPayload : BasePayload
|
||||
{
|
||||
std::string name;
|
||||
std::string ssid;
|
||||
std::string password;
|
||||
uint8_t channel;
|
||||
uint8_t power;
|
||||
std::string name;
|
||||
std::string ssid;
|
||||
std::string password;
|
||||
uint8_t channel;
|
||||
uint8_t power;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(WifiPayload, name, ssid, password, channel, power)
|
||||
|
||||
struct UpdateWifiPayload : BasePayload
|
||||
{
|
||||
std::string name;
|
||||
std::optional<std::string> ssid;
|
||||
std::optional<std::string> password;
|
||||
std::optional<uint8_t> channel;
|
||||
std::optional<uint8_t> power;
|
||||
std::string name;
|
||||
std::optional<std::string> ssid;
|
||||
std::optional<std::string> password;
|
||||
std::optional<uint8_t> channel;
|
||||
std::optional<uint8_t> power;
|
||||
};
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateWifiPayload &payload);
|
||||
void from_json(const nlohmann::json &j, UpdateWifiPayload &payload);
|
||||
void to_json(nlohmann::json& j, const UpdateWifiPayload& payload);
|
||||
void from_json(const nlohmann::json& j, UpdateWifiPayload& payload);
|
||||
struct deleteNetworkPayload : BasePayload
|
||||
{
|
||||
std::string name;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(deleteNetworkPayload, name)
|
||||
|
||||
struct UpdateAPWiFiPayload : BasePayload
|
||||
{
|
||||
std::optional<std::string> ssid;
|
||||
std::optional<std::string> password;
|
||||
std::optional<uint8_t> channel;
|
||||
std::optional<std::string> ssid;
|
||||
std::optional<std::string> password;
|
||||
std::optional<uint8_t> channel;
|
||||
};
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateAPWiFiPayload &payload);
|
||||
void from_json(const nlohmann::json &j, UpdateAPWiFiPayload &payload);
|
||||
void to_json(nlohmann::json& j, const UpdateAPWiFiPayload& payload);
|
||||
void from_json(const nlohmann::json& j, UpdateAPWiFiPayload& payload);
|
||||
struct MDNSPayload : BasePayload
|
||||
{
|
||||
std::string hostname;
|
||||
std::string hostname;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MDNSPayload, hostname)
|
||||
|
||||
struct UpdateCameraConfigPayload : BasePayload
|
||||
{
|
||||
std::optional<uint8_t> vflip;
|
||||
std::optional<uint8_t> href;
|
||||
std::optional<uint8_t> framesize;
|
||||
std::optional<uint8_t> quality;
|
||||
std::optional<uint8_t> brightness;
|
||||
// TODO add more options here
|
||||
std::optional<uint8_t> vflip;
|
||||
std::optional<uint8_t> href;
|
||||
std::optional<uint8_t> framesize;
|
||||
std::optional<uint8_t> quality;
|
||||
std::optional<uint8_t> brightness;
|
||||
// TODO add more options here
|
||||
};
|
||||
|
||||
void to_json(nlohmann::json &j, const UpdateCameraConfigPayload &payload);
|
||||
void from_json(const nlohmann::json &j, UpdateCameraConfigPayload &payload);
|
||||
void to_json(nlohmann::json& j, const UpdateCameraConfigPayload& payload);
|
||||
void from_json(const nlohmann::json& j, UpdateCameraConfigPayload& payload);
|
||||
#endif
|
||||
@@ -6,35 +6,35 @@
|
||||
|
||||
enum class DependencyType
|
||||
{
|
||||
project_config,
|
||||
camera_manager,
|
||||
wifi_manager,
|
||||
led_manager,
|
||||
monitoring_manager
|
||||
project_config,
|
||||
camera_manager,
|
||||
wifi_manager,
|
||||
led_manager,
|
||||
monitoring_manager
|
||||
};
|
||||
|
||||
class DependencyRegistry
|
||||
{
|
||||
std::unordered_map<DependencyType, std::shared_ptr<void>> services;
|
||||
std::unordered_map<DependencyType, std::shared_ptr<void>> services;
|
||||
|
||||
public:
|
||||
template <typename ServiceType>
|
||||
void registerService(DependencyType dependencyType, std::shared_ptr<ServiceType> service)
|
||||
{
|
||||
this->services[dependencyType] = std::static_pointer_cast<void>(service);
|
||||
}
|
||||
|
||||
template <typename ServiceType>
|
||||
std::shared_ptr<ServiceType> resolve(DependencyType dependencyType)
|
||||
{
|
||||
auto serviceIT = this->services.find(dependencyType);
|
||||
if (serviceIT != this->services.end())
|
||||
public:
|
||||
template <typename ServiceType>
|
||||
void registerService(DependencyType dependencyType, std::shared_ptr<ServiceType> service)
|
||||
{
|
||||
return std::static_pointer_cast<ServiceType>(serviceIT->second);
|
||||
this->services[dependencyType] = std::static_pointer_cast<void>(service);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
template <typename ServiceType>
|
||||
std::shared_ptr<ServiceType> resolve(DependencyType dependencyType)
|
||||
{
|
||||
auto serviceIT = this->services.find(dependencyType);
|
||||
if (serviceIT != this->services.end())
|
||||
{
|
||||
return std::static_pointer_cast<ServiceType>(serviceIT->second);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,17 +1,15 @@
|
||||
#include "camera_commands.hpp"
|
||||
|
||||
CommandResult updateCameraCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult updateCameraCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
auto payload = json.get<UpdateCameraConfigPayload>();
|
||||
auto payload = json.get<UpdateCameraConfigPayload>();
|
||||
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto oldConfig = projectConfig->getCameraConfig();
|
||||
projectConfig->setCameraConfig(
|
||||
payload.vflip.has_value() ? payload.vflip.value() : oldConfig.vflip,
|
||||
payload.framesize.has_value() ? payload.framesize.value() : oldConfig.framesize,
|
||||
payload.href.has_value() ? payload.href.value() : oldConfig.href,
|
||||
payload.quality.has_value() ? payload.quality.value() : oldConfig.quality,
|
||||
payload.brightness.has_value() ? payload.brightness.value() : oldConfig.brightness);
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto oldConfig = projectConfig->getCameraConfig();
|
||||
projectConfig->setCameraConfig(
|
||||
payload.vflip.has_value() ? payload.vflip.value() : oldConfig.vflip, payload.framesize.has_value() ? payload.framesize.value() : oldConfig.framesize,
|
||||
payload.href.has_value() ? payload.href.value() : oldConfig.href, payload.quality.has_value() ? payload.quality.value() : oldConfig.quality,
|
||||
payload.brightness.has_value() ? payload.brightness.value() : oldConfig.brightness);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef CAMERA_COMMANDS_HPP
|
||||
#define CAMERA_COMMANDS_HPP
|
||||
#include <CameraManager.hpp>
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include "CommandResult.hpp"
|
||||
#include "CommandSchema.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include <CameraManager.hpp>
|
||||
#include <nlohmann-json.hpp>
|
||||
|
||||
CommandResult updateCameraCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult updateCameraCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2,45 +2,45 @@
|
||||
|
||||
CommandResult saveConfigCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
projectConfig->save();
|
||||
return CommandResult::getSuccessResult("Config saved");
|
||||
projectConfig->save();
|
||||
return CommandResult::getSuccessResult("Config saved");
|
||||
}
|
||||
|
||||
CommandResult getConfigCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
auto configRepresentation = projectConfig->getTrackerConfig().toRepresentation();
|
||||
return CommandResult::getSuccessResult(configRepresentation);
|
||||
auto configRepresentation = projectConfig->getTrackerConfig().toRepresentation();
|
||||
return CommandResult::getSuccessResult(configRepresentation);
|
||||
}
|
||||
|
||||
CommandResult resetConfigCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult resetConfigCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
std::array<std::string, 4> supported_sections = {
|
||||
"all",
|
||||
};
|
||||
std::array<std::string, 4> supported_sections = {
|
||||
"all",
|
||||
};
|
||||
|
||||
if (!json.contains("section"))
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload - missing section");
|
||||
}
|
||||
if (!json.contains("section"))
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload - missing section");
|
||||
}
|
||||
|
||||
auto section = json["section"].get<std::string>();
|
||||
auto section = json["section"].get<std::string>();
|
||||
|
||||
if (std::find(supported_sections.begin(), supported_sections.end(), section) == supported_sections.end())
|
||||
{
|
||||
return CommandResult::getErrorResult("Selected section is unsupported");
|
||||
}
|
||||
if (std::find(supported_sections.begin(), supported_sections.end(), section) == supported_sections.end())
|
||||
{
|
||||
return CommandResult::getErrorResult("Selected section is unsupported");
|
||||
}
|
||||
|
||||
// we cannot match on string, and making a map would be overkill right now, sooo
|
||||
// todo, add more granular control for other sections, like only reset camera, or only reset wifi
|
||||
if (section == "all")
|
||||
{
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->reset();
|
||||
}
|
||||
// we cannot match on string, and making a map would be overkill right now, sooo
|
||||
// todo, add more granular control for other sections, like only reset camera, or only reset wifi
|
||||
if (section == "all")
|
||||
{
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->reset();
|
||||
}
|
||||
|
||||
return CommandResult::getSuccessResult("Config reset");
|
||||
return CommandResult::getSuccessResult("Config reset");
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include "CommandResult.hpp"
|
||||
#include "CommandSchema.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include <nlohmann-json.hpp>
|
||||
|
||||
CommandResult saveConfigCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
CommandResult getConfigCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
CommandResult resetConfigCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult resetConfigCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "device_commands.hpp"
|
||||
#include <cstdio>
|
||||
#include "LEDManager.hpp"
|
||||
#include "MonitoringManager.hpp"
|
||||
#include "esp_mac.h"
|
||||
#include <cstdio>
|
||||
|
||||
CommandResult setDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult setDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
if (!json.contains("mode") || !json["mode"].is_number_integer())
|
||||
{
|
||||
@@ -23,9 +23,8 @@ CommandResult setDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry,
|
||||
return CommandResult::getSuccessResult("Device mode set");
|
||||
}
|
||||
|
||||
CommandResult updateOTACredentialsCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult updateOTACredentialsCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
|
||||
const auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
const auto oldDeviceConfig = projectConfig->getDeviceConfig();
|
||||
auto OTALogin = oldDeviceConfig.OTALogin;
|
||||
@@ -57,7 +56,7 @@ CommandResult updateOTACredentialsCommand(std::shared_ptr<DependencyRegistry> re
|
||||
return CommandResult::getSuccessResult("OTA Config set");
|
||||
}
|
||||
|
||||
CommandResult updateLEDDutyCycleCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult updateLEDDutyCycleCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
if (!json.contains("dutyCycle") || !json["dutyCycle"].is_number_integer())
|
||||
{
|
||||
@@ -105,10 +104,7 @@ CommandResult startStreamingCommand()
|
||||
// from *inside* the serial handler, we'd deadlock.
|
||||
// we can just pass nullptr to the vtaskdelete(),
|
||||
// but then we won't get any response, so we schedule a timer instead
|
||||
esp_timer_create_args_t args{
|
||||
.callback = activateStreaming,
|
||||
.arg = nullptr,
|
||||
.name = "activateStreaming"};
|
||||
esp_timer_create_args_t args{.callback = activateStreaming, .arg = nullptr, .name = "activateStreaming"};
|
||||
|
||||
esp_timer_handle_t activateStreamingTimer;
|
||||
esp_timer_create(&args, &activateStreamingTimer);
|
||||
@@ -117,9 +113,8 @@ CommandResult startStreamingCommand()
|
||||
return CommandResult::getSuccessResult("Streaming starting");
|
||||
}
|
||||
|
||||
CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
|
||||
if (!json.contains("mode") || !json["mode"].is_string())
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload - missing mode");
|
||||
@@ -159,7 +154,7 @@ CommandResult getDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
const auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
StreamingMode currentMode = projectConfig->getDeviceMode();
|
||||
|
||||
const char *modeStr = "unknown";
|
||||
const char* modeStr = "unknown";
|
||||
switch (currentMode)
|
||||
{
|
||||
case StreamingMode::UVC:
|
||||
@@ -188,13 +183,11 @@ CommandResult getSerialNumberCommand(std::shared_ptr<DependencyRegistry> /*regis
|
||||
|
||||
char serial_no_sep[13];
|
||||
// Serial without separators (12 hex chars)
|
||||
std::snprintf(serial_no_sep, sizeof(serial_no_sep), "%02X%02X%02X%02X%02X%02X",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
std::snprintf(serial_no_sep, sizeof(serial_no_sep), "%02X%02X%02X%02X%02X%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
char mac_colon[18];
|
||||
// MAC with colons
|
||||
std::snprintf(mac_colon, sizeof(mac_colon), "%02X:%02X:%02X:%02X:%02X:%02X",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
std::snprintf(mac_colon, sizeof(mac_colon), "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
const auto json = nlohmann::json{
|
||||
{"serial", serial_no_sep},
|
||||
@@ -246,8 +239,8 @@ CommandResult getBatteryStatusCommand(std::shared_ptr<DependencyRegistry> regist
|
||||
|
||||
CommandResult getInfoCommand(std::shared_ptr<DependencyRegistry> /*registry*/)
|
||||
{
|
||||
const char *who = CONFIG_GENERAL_BOARD;
|
||||
const char *ver = CONFIG_GENERAL_VERSION;
|
||||
const char* who = CONFIG_GENERAL_BOARD;
|
||||
const char* ver = CONFIG_GENERAL_VERSION;
|
||||
// Ensure non-null strings
|
||||
if (!who)
|
||||
who = "";
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
#include "CommandResult.hpp"
|
||||
#include "ProjectConfig.hpp"
|
||||
#include "OpenIrisTasks.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include "OpenIrisTasks.hpp"
|
||||
#include "ProjectConfig.hpp"
|
||||
#include "esp_timer.h"
|
||||
#include "main_globals.hpp"
|
||||
|
||||
#include <format>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <string>
|
||||
|
||||
CommandResult updateOTACredentialsCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult updateOTACredentialsCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult updateLEDDutyCycleCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult updateLEDDutyCycleCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
CommandResult getLEDDutyCycleCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
CommandResult restartDeviceCommand();
|
||||
|
||||
CommandResult startStreamingCommand();
|
||||
|
||||
CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult switchModeCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult getDeviceModeCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#include "mdns_commands.hpp"
|
||||
|
||||
CommandResult setMDNSCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult setMDNSCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
const auto payload = json.get<MDNSPayload>();
|
||||
if (payload.hostname.empty())
|
||||
return CommandResult::getErrorResult("Invalid payload - empty hostname");
|
||||
const auto payload = json.get<MDNSPayload>();
|
||||
if (payload.hostname.empty())
|
||||
return CommandResult::getErrorResult("Invalid payload - empty hostname");
|
||||
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->setMDNSConfig(payload.hostname);
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->setMDNSConfig(payload.hostname);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
|
||||
CommandResult getMDNSNameCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
const auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto mdnsConfig = projectConfig->getMDNSConfig();
|
||||
const auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto mdnsConfig = projectConfig->getMDNSConfig();
|
||||
|
||||
const auto json = nlohmann::json{{"hostname", mdnsConfig.hostname}};
|
||||
return CommandResult::getSuccessResult(json);
|
||||
const auto json = nlohmann::json{{"hostname", mdnsConfig.hostname}};
|
||||
return CommandResult::getSuccessResult(json);
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include "CommandResult.hpp"
|
||||
#include "CommandSchema.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include <nlohmann-json.hpp>
|
||||
|
||||
CommandResult setMDNSCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult setMDNSCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
CommandResult getMDNSNameCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "scan_commands.hpp"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
CommandResult scanNetworksCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult scanNetworksCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
@@ -24,16 +24,14 @@ CommandResult scanNetworksCommand(std::shared_ptr<DependencyRegistry> registry,
|
||||
nlohmann::json result;
|
||||
std::vector<nlohmann::json> networksJson;
|
||||
|
||||
for (const auto &network : networks)
|
||||
for (const auto& network : networks)
|
||||
{
|
||||
nlohmann::json networkItem;
|
||||
networkItem["ssid"] = network.ssid;
|
||||
networkItem["channel"] = network.channel;
|
||||
networkItem["rssi"] = network.rssi;
|
||||
char mac_str[18];
|
||||
sprintf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
network.mac[0], network.mac[1], network.mac[2],
|
||||
network.mac[3], network.mac[4], network.mac[5]);
|
||||
sprintf(mac_str, "%02x:%02x:%02x:%02x:%02x:%02x", network.mac[0], network.mac[1], network.mac[2], network.mac[3], network.mac[4], network.mac[5]);
|
||||
networkItem["mac_address"] = mac_str;
|
||||
networkItem["auth_mode"] = network.auth_mode;
|
||||
networksJson.push_back(networkItem);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef SCAN_COMMANDS_HPP
|
||||
#define SCAN_COMMANDS_HPP
|
||||
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <string>
|
||||
#include <wifiManager.hpp>
|
||||
#include "CommandResult.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include "esp_log.h"
|
||||
#include <wifiManager.hpp>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
|
||||
CommandResult scanNetworksCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult scanNetworksCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
#endif
|
||||
@@ -1,32 +1,32 @@
|
||||
#include "simple_commands.hpp"
|
||||
|
||||
static const char *TAG = "SimpleCommands";
|
||||
static const char* TAG = "SimpleCommands";
|
||||
|
||||
CommandResult PingCommand()
|
||||
{
|
||||
return CommandResult::getSuccessResult("pong");
|
||||
return CommandResult::getSuccessResult("pong");
|
||||
};
|
||||
|
||||
CommandResult PauseCommand(const nlohmann::json &json)
|
||||
CommandResult PauseCommand(const nlohmann::json& json)
|
||||
{
|
||||
auto pause = true;
|
||||
auto pause = true;
|
||||
|
||||
if (json.contains("pause") && json["pause"].is_boolean())
|
||||
{
|
||||
pause = json["pause"].get<bool>();
|
||||
}
|
||||
if (json.contains("pause") && json["pause"].is_boolean())
|
||||
{
|
||||
pause = json["pause"].get<bool>();
|
||||
}
|
||||
|
||||
ESP_LOGI(TAG, "Pause command received: %s", pause ? "true" : "false");
|
||||
ESP_LOGI(TAG, "Pause command received: %s", pause ? "true" : "false");
|
||||
|
||||
setStartupPaused(pause);
|
||||
if (pause)
|
||||
{
|
||||
ESP_LOGI(TAG, "Startup paused - device will remain in configuration mode");
|
||||
return CommandResult::getSuccessResult("Startup paused");
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Startup resumed");
|
||||
return CommandResult::getSuccessResult("Startup resumed");
|
||||
}
|
||||
setStartupPaused(pause);
|
||||
if (pause)
|
||||
{
|
||||
ESP_LOGI(TAG, "Startup paused - device will remain in configuration mode");
|
||||
return CommandResult::getSuccessResult("Startup paused");
|
||||
}
|
||||
else
|
||||
{
|
||||
ESP_LOGI(TAG, "Startup resumed");
|
||||
return CommandResult::getSuccessResult("Startup resumed");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef SIMPLE_COMMANDS
|
||||
#define SIMPLE_COMMANDS
|
||||
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <string>
|
||||
#include "CommandResult.hpp"
|
||||
#include "main_globals.hpp"
|
||||
#include "esp_log.h"
|
||||
#include <nlohmann-json.hpp>
|
||||
#include "main_globals.hpp"
|
||||
|
||||
CommandResult PingCommand();
|
||||
CommandResult PauseCommand(const nlohmann::json &json);
|
||||
CommandResult PauseCommand(const nlohmann::json& json);
|
||||
|
||||
#endif
|
||||
@@ -2,176 +2,165 @@
|
||||
#include "esp_netif.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
CommandResult setWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult setWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
auto payload = json.get<WifiPayload>();
|
||||
if (payload.name.empty())
|
||||
{
|
||||
payload.name = std::string("main");
|
||||
}
|
||||
auto payload = json.get<WifiPayload>();
|
||||
if (payload.name.empty())
|
||||
{
|
||||
payload.name = std::string("main");
|
||||
}
|
||||
|
||||
if (payload.ssid.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload: missing SSID");
|
||||
}
|
||||
if (payload.ssid.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload: missing SSID");
|
||||
}
|
||||
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->setWifiConfig(
|
||||
payload.name,
|
||||
payload.ssid,
|
||||
payload.password,
|
||||
payload.channel,
|
||||
payload.power);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
|
||||
CommandResult deleteWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
const auto payload = json.get<deleteNetworkPayload>();
|
||||
if (payload.name.empty())
|
||||
return CommandResult::getErrorResult("Invalid payload");
|
||||
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
projectConfig->deleteWifiConfig(payload.name);
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
|
||||
CommandResult updateWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
auto payload = json.get<UpdateWifiPayload>();
|
||||
if (payload.name.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload - missing network name");
|
||||
}
|
||||
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto storedNetworks = projectConfig->getWifiConfigs();
|
||||
if (const auto networkToUpdate = std::ranges::find_if(
|
||||
storedNetworks,
|
||||
[&](auto &network)
|
||||
{ return network.name == payload.name; });
|
||||
networkToUpdate != storedNetworks.end())
|
||||
{
|
||||
projectConfig->setWifiConfig(
|
||||
payload.name,
|
||||
payload.ssid.has_value() ? payload.ssid.value() : networkToUpdate->ssid,
|
||||
payload.password.has_value() ? payload.password.value() : networkToUpdate->password,
|
||||
payload.channel.has_value() ? payload.channel.value() : networkToUpdate->channel,
|
||||
payload.power.has_value() ? payload.power.value() : networkToUpdate->power);
|
||||
std::shared_ptr<ProjectConfig> projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
projectConfig->setWifiConfig(payload.name, payload.ssid, payload.password, payload.channel, payload.power);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
else
|
||||
return CommandResult::getErrorResult("Requested network does not exist");
|
||||
}
|
||||
|
||||
CommandResult updateAPWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json)
|
||||
CommandResult deleteWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
const auto payload = json.get<UpdateAPWiFiPayload>();
|
||||
const auto payload = json.get<deleteNetworkPayload>();
|
||||
if (payload.name.empty())
|
||||
return CommandResult::getErrorResult("Invalid payload");
|
||||
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
const auto previousAPConfig = projectConfig->getAPWifiConfig();
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
projectConfig->setAPWifiConfig(
|
||||
payload.ssid.has_value() ? payload.ssid.value() : previousAPConfig.ssid,
|
||||
payload.password.has_value() ? payload.password.value() : previousAPConfig.password,
|
||||
payload.channel.has_value() ? payload.channel.value() : previousAPConfig.channel);
|
||||
projectConfig->deleteWifiConfig(payload.name);
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
CommandResult updateWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
auto payload = json.get<UpdateWifiPayload>();
|
||||
if (payload.name.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("Invalid payload - missing network name");
|
||||
}
|
||||
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto storedNetworks = projectConfig->getWifiConfigs();
|
||||
if (const auto networkToUpdate = std::ranges::find_if(storedNetworks, [&](auto& network) { return network.name == payload.name; });
|
||||
networkToUpdate != storedNetworks.end())
|
||||
{
|
||||
projectConfig->setWifiConfig(payload.name, payload.ssid.has_value() ? payload.ssid.value() : networkToUpdate->ssid,
|
||||
payload.password.has_value() ? payload.password.value() : networkToUpdate->password,
|
||||
payload.channel.has_value() ? payload.channel.value() : networkToUpdate->channel,
|
||||
payload.power.has_value() ? payload.power.value() : networkToUpdate->power);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
else
|
||||
return CommandResult::getErrorResult("Requested network does not exist");
|
||||
}
|
||||
|
||||
CommandResult updateAPWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
const auto payload = json.get<UpdateAPWiFiPayload>();
|
||||
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
const auto previousAPConfig = projectConfig->getAPWifiConfig();
|
||||
|
||||
projectConfig->setAPWifiConfig(payload.ssid.has_value() ? payload.ssid.value() : previousAPConfig.ssid,
|
||||
payload.password.has_value() ? payload.password.value() : previousAPConfig.password,
|
||||
payload.channel.has_value() ? payload.channel.value() : previousAPConfig.channel);
|
||||
|
||||
return CommandResult::getSuccessResult("Config updated");
|
||||
}
|
||||
|
||||
CommandResult getWiFiStatusCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
auto wifiManager = registry->resolve<WiFiManager>(DependencyType::wifi_manager);
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto wifiManager = registry->resolve<WiFiManager>(DependencyType::wifi_manager);
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
auto wifiState = wifiManager->GetCurrentWiFiState();
|
||||
auto networks = projectConfig->getWifiConfigs();
|
||||
nlohmann::json result;
|
||||
auto wifiState = wifiManager->GetCurrentWiFiState();
|
||||
auto networks = projectConfig->getWifiConfigs();
|
||||
nlohmann::json result;
|
||||
|
||||
switch (wifiState)
|
||||
{
|
||||
case WiFiState_e::WiFiState_NotInitialized:
|
||||
result["status"] = "not_initialized";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Initialized:
|
||||
result["status"] = "initialized";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_ReadyToConnect:
|
||||
result["status"] = "ready";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Connecting:
|
||||
result["status"] = "connecting";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_WaitingForIp:
|
||||
result["status"] = "waiting_for_ip";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Connected:
|
||||
result["status"] = "connected";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Disconnected:
|
||||
result["status"] = "disconnected";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Error:
|
||||
result["status"] = "error";
|
||||
break;
|
||||
}
|
||||
|
||||
if (wifiState == WiFiState_e::WiFiState_Connected)
|
||||
{
|
||||
// Get IP address from ESP32
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_t *netif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF");
|
||||
if (netif && esp_netif_get_ip_info(netif, &ip_info) == ESP_OK)
|
||||
switch (wifiState)
|
||||
{
|
||||
char ip_str[16];
|
||||
sprintf(ip_str, IPSTR, IP2STR(&ip_info.ip));
|
||||
result["ip_address"] = ip_str;
|
||||
case WiFiState_e::WiFiState_NotInitialized:
|
||||
result["status"] = "not_initialized";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Initialized:
|
||||
result["status"] = "initialized";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_ReadyToConnect:
|
||||
result["status"] = "ready";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Connecting:
|
||||
result["status"] = "connecting";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_WaitingForIp:
|
||||
result["status"] = "waiting_for_ip";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Connected:
|
||||
result["status"] = "connected";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Disconnected:
|
||||
result["status"] = "disconnected";
|
||||
break;
|
||||
case WiFiState_e::WiFiState_Error:
|
||||
result["status"] = "error";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult::getSuccessResult(result);
|
||||
if (wifiState == WiFiState_e::WiFiState_Connected)
|
||||
{
|
||||
// Get IP address from ESP32
|
||||
esp_netif_ip_info_t ip_info;
|
||||
esp_netif_t* netif = esp_netif_get_handle_from_ifkey("WIFI_STA_DEF");
|
||||
if (netif && esp_netif_get_ip_info(netif, &ip_info) == ESP_OK)
|
||||
{
|
||||
char ip_str[16];
|
||||
sprintf(ip_str, IPSTR, IP2STR(&ip_info.ip));
|
||||
result["ip_address"] = ip_str;
|
||||
}
|
||||
}
|
||||
|
||||
return CommandResult::getSuccessResult(result);
|
||||
}
|
||||
|
||||
CommandResult connectWiFiCommand(std::shared_ptr<DependencyRegistry> registry)
|
||||
{
|
||||
#if !CONFIG_GENERAL_ENABLE_WIRELESS
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
return CommandResult::getErrorResult("Not supported by current firmware");
|
||||
#endif
|
||||
|
||||
auto wifiManager = registry->resolve<WiFiManager>(DependencyType::wifi_manager);
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
auto wifiManager = registry->resolve<WiFiManager>(DependencyType::wifi_manager);
|
||||
auto projectConfig = registry->resolve<ProjectConfig>(DependencyType::project_config);
|
||||
|
||||
auto networks = projectConfig->getWifiConfigs();
|
||||
if (networks.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("No WiFi networks configured");
|
||||
}
|
||||
auto networks = projectConfig->getWifiConfigs();
|
||||
if (networks.empty())
|
||||
{
|
||||
return CommandResult::getErrorResult("No WiFi networks configured");
|
||||
}
|
||||
|
||||
// Trigger WiFi connection attempt
|
||||
wifiManager->TryConnectToStoredNetworks();
|
||||
// Trigger WiFi connection attempt
|
||||
wifiManager->TryConnectToStoredNetworks();
|
||||
|
||||
return CommandResult::getSuccessResult("WiFi connection attempt started");
|
||||
return CommandResult::getSuccessResult("WiFi connection attempt started");
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#include <ProjectConfig.hpp>
|
||||
#include <wifiManager.hpp>
|
||||
#include <StateManager.hpp>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <nlohmann-json.hpp>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <wifiManager.hpp>
|
||||
#include "CommandResult.hpp"
|
||||
#include "CommandSchema.hpp"
|
||||
#include "DependencyRegistry.hpp"
|
||||
#include <nlohmann-json.hpp>
|
||||
|
||||
CommandResult setWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult setWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult deleteWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult deleteWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult updateWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult updateWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult updateAPWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json &json);
|
||||
CommandResult updateAPWiFiCommand(std::shared_ptr<DependencyRegistry> registry, const nlohmann::json& json);
|
||||
|
||||
CommandResult getWiFiStatusCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
CommandResult connectWiFiCommand(std::shared_ptr<DependencyRegistry> registry);
|
||||
|
||||
Reference in New Issue
Block a user