mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-19 06:23:44 +02:00
Fix merge conflicts
This commit is contained in:
@@ -25,70 +25,51 @@ std::unordered_map<std::string, CommandType> commandTypeMap = {
|
||||
{"get_device_mode", CommandType::GET_DEVICE_MODE},
|
||||
};
|
||||
|
||||
std::function<CommandResult()> CommandManager::createCommand(const CommandType type, std::string_view json) const
|
||||
{
|
||||
std::function<CommandResult()> CommandManager::createCommand(const CommandType type, std::string_view json) const {
|
||||
switch (type)
|
||||
{
|
||||
case CommandType::PING:
|
||||
return {PingCommand};
|
||||
return { PingCommand };
|
||||
case CommandType::PAUSE:
|
||||
return [json]
|
||||
{ return PauseCommand(json); };
|
||||
return [json] { return PauseCommand(json); };
|
||||
case CommandType::SET_STREAMING_MODE:
|
||||
return [this, json]
|
||||
{ return setDeviceModeCommand(this->registry, json); };
|
||||
return [this, json] {return setDeviceModeCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_OTA_CREDENTIALS:
|
||||
return [this, json]
|
||||
{ return updateOTACredentialsCommand(this->registry, json); };
|
||||
return [this, json] { return updateOTACredentialsCommand(this->registry, json); };
|
||||
case CommandType::SET_WIFI:
|
||||
return [this, json]
|
||||
{ return setWiFiCommand(this->registry, json); };
|
||||
return [this, json] { return setWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_WIFI:
|
||||
return [this, json]
|
||||
{ return updateWiFiCommand(this->registry, json); };
|
||||
return [this, json] { return updateWiFiCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_AP_WIFI:
|
||||
return [this, json]
|
||||
{ return updateAPWiFiCommand(this->registry, json); };
|
||||
return [this, json] { return updateAPWiFiCommand(this->registry, json); };
|
||||
case CommandType::DELETE_NETWORK:
|
||||
return [this, json]
|
||||
{ return deleteWiFiCommand(this->registry, json); };
|
||||
return [this, json] { return deleteWiFiCommand(this->registry, json); };
|
||||
case CommandType::SET_MDNS:
|
||||
return [this, json]
|
||||
{ return setMDNSCommand(this->registry, json); };
|
||||
return [this, json] { return setMDNSCommand(this->registry, json); };
|
||||
case CommandType::UPDATE_CAMERA:
|
||||
return [this, json]
|
||||
{ return updateCameraCommand(this->registry, json); };
|
||||
return [this, json] { return updateCameraCommand(this->registry, json); };
|
||||
case CommandType::RESTART_CAMERA:
|
||||
return [this, json]
|
||||
{ return restartCameraCommand(this->registry, json); };
|
||||
return [this, json] { return restartCameraCommand(this->registry, json); };
|
||||
case CommandType::GET_CONFIG:
|
||||
return [this]
|
||||
{ return getConfigCommand(this->registry); };
|
||||
return [this] { return getConfigCommand(this->registry); };
|
||||
case CommandType::SAVE_CONFIG:
|
||||
return [this]
|
||||
{ return saveConfigCommand(this->registry); };
|
||||
return [this] { return saveConfigCommand(this->registry); };
|
||||
case CommandType::RESET_CONFIG:
|
||||
return [this, json]
|
||||
{ return resetConfigCommand(this->registry, json); };
|
||||
return [this, json] { return resetConfigCommand(this->registry, json); };
|
||||
case CommandType::RESTART_DEVICE:
|
||||
return restartDeviceCommand;
|
||||
case CommandType::SCAN_NETWORKS:
|
||||
return [this]
|
||||
{ return scanNetworksCommand(this->registry); };
|
||||
return [this] { return scanNetworksCommand(this->registry); };
|
||||
case CommandType::START_STREAMING:
|
||||
return startStreamingCommand;
|
||||
case CommandType::GET_WIFI_STATUS:
|
||||
return [this]
|
||||
{ return getWiFiStatusCommand(this->registry); };
|
||||
return [this] { return getWiFiStatusCommand(this->registry); };
|
||||
case CommandType::CONNECT_WIFI:
|
||||
return [this]
|
||||
{ return connectWiFiCommand(this->registry); };
|
||||
return [this] { return connectWiFiCommand(this->registry); };
|
||||
case CommandType::SWITCH_MODE:
|
||||
return [this, json]
|
||||
{ return switchModeCommand(this->registry, json); };
|
||||
return [this, json] { return switchModeCommand(this->registry, json); };
|
||||
case CommandType::GET_DEVICE_MODE:
|
||||
return [this]
|
||||
{ return getDeviceModeCommand(this->registry); };
|
||||
return [this] { return getDeviceModeCommand(this->registry); };
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -22,19 +22,18 @@ public:
|
||||
CommandResult(std::string message, const Status status)
|
||||
{
|
||||
this->status = status;
|
||||
|
||||
// Escape quotes and backslashes in the message for JSON
|
||||
std::string escapedMessage = message;
|
||||
size_t pos = 0;
|
||||
// First escape backslashes
|
||||
while ((pos = escapedMessage.find('\\', pos)) != std::string::npos)
|
||||
{
|
||||
while ((pos = escapedMessage.find('\\', pos)) != std::string::npos) {
|
||||
escapedMessage.replace(pos, 1, "\\\\");
|
||||
pos += 2;
|
||||
}
|
||||
// Then escape quotes
|
||||
pos = 0;
|
||||
while ((pos = escapedMessage.find('"', pos)) != std::string::npos)
|
||||
{
|
||||
while ((pos = escapedMessage.find('"', pos)) != std::string::npos) {
|
||||
escapedMessage.replace(pos, 1, "\\\"");
|
||||
pos += 2;
|
||||
}
|
||||
|
||||
@@ -105,8 +105,6 @@ bool SerialManager::should_send_heartbeat()
|
||||
void HandleSerialManagerTask(void *pvParameters)
|
||||
{
|
||||
auto const serialManager = static_cast<SerialManager *>(pvParameters);
|
||||
TickType_t lastHeartbeat = xTaskGetTickCount();
|
||||
const TickType_t heartbeatInterval = pdMS_TO_TICKS(2000); // 2 second heartbeat
|
||||
|
||||
while (true)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user