Skip to content

Commit

Permalink
Convert clas sinto namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Jan 23, 2025
1 parent a801975 commit 8ec6d23
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 227 deletions.
31 changes: 16 additions & 15 deletions cpp/command/command_dispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
#include "base/property_handler.h"
#include "shared/s2p_exceptions.h"

using namespace s2p_util;
using namespace command_response;
using namespace protobuf_util;
using namespace s2p_util;

bool CommandDispatcher::DispatchCommand(const CommandContext &context, PbResult &result)
{
Expand Down Expand Up @@ -56,28 +57,28 @@ bool CommandDispatcher::DispatchCommand(const CommandContext &context, PbResult
}

case DEVICES_INFO:
CommandResponse::GetDevicesInfo(controller_factory.GetAllDevices(), result, command);
GetDevicesInfo(controller_factory.GetAllDevices(), result, command);
return context.WriteSuccessResult(result);

case DEVICE_TYPES_INFO:
CommandResponse::GetDeviceTypesInfo(*result.mutable_device_types_info());
GetDeviceTypesInfo(*result.mutable_device_types_info());
return context.WriteSuccessResult(result);

case SERVER_INFO:
CommandResponse::GetServerInfo(*result.mutable_server_info(), command, controller_factory.GetAllDevices(),
GetServerInfo(*result.mutable_server_info(), command, controller_factory.GetAllDevices(),
executor.GetReservedIds(), s2p_logger);
return context.WriteSuccessResult(result);

case VERSION_INFO:
CommandResponse::GetVersionInfo(*result.mutable_version_info());
GetVersionInfo(*result.mutable_version_info());
return context.WriteSuccessResult(result);

case LOG_LEVEL_INFO:
CommandResponse::GetLogLevelInfo(*result.mutable_log_level_info());
GetLogLevelInfo(*result.mutable_log_level_info());
return context.WriteSuccessResult(result);

case DEFAULT_IMAGE_FILES_INFO:
CommandResponse::GetImageFilesInfo(*result.mutable_image_files_info(), GetParam(command, "folder_pattern"),
GetImageFilesInfo(*result.mutable_image_files_info(), GetParam(command, "folder_pattern"),
GetParam(command, "file_pattern"), s2p_logger);
return context.WriteSuccessResult(result);

Expand All @@ -86,7 +87,7 @@ bool CommandDispatcher::DispatchCommand(const CommandContext &context, PbResult
return context.ReturnLocalizedError(LocalizationKey::ERROR_MISSING_FILENAME);
}
else {
if (const auto &image_file = make_unique<PbImageFile>(); CommandResponse::GetImageFile(*image_file.get(),
if (const auto &image_file = make_unique<PbImageFile>(); GetImageFile(*image_file.get(),
filename)) {
result.set_allocated_image_file_info(image_file.get());
result.set_status(true);
Expand All @@ -99,27 +100,27 @@ bool CommandDispatcher::DispatchCommand(const CommandContext &context, PbResult
break;

case NETWORK_INTERFACES_INFO:
CommandResponse::GetNetworkInterfacesInfo(*result.mutable_network_interfaces_info());
GetNetworkInterfacesInfo(*result.mutable_network_interfaces_info());
return context.WriteSuccessResult(result);

case MAPPING_INFO:
CommandResponse::GetMappingInfo(*result.mutable_mapping_info());
GetMappingInfo(*result.mutable_mapping_info());
return context.WriteSuccessResult(result);

case STATISTICS_INFO:
CommandResponse::GetStatisticsInfo(*result.mutable_statistics_info(), controller_factory.GetAllDevices());
GetStatisticsInfo(*result.mutable_statistics_info(), controller_factory.GetAllDevices());
return context.WriteSuccessResult(result);

case PROPERTIES_INFO:
CommandResponse::GetPropertiesInfo(*result.mutable_properties_info());
GetPropertiesInfo(*result.mutable_properties_info());
return context.WriteSuccessResult(result);

case OPERATION_INFO:
CommandResponse::GetOperationInfo(*result.mutable_operation_info());
GetOperationInfo(*result.mutable_operation_info());
return context.WriteSuccessResult(result);

case RESERVED_IDS_INFO:
CommandResponse::GetReservedIds(*result.mutable_reserved_ids_info(), executor.GetReservedIds());
GetReservedIds(*result.mutable_reserved_ids_info(), executor.GetReservedIds());
return context.WriteSuccessResult(result);

case SHUT_DOWN:
Expand Down Expand Up @@ -170,7 +171,7 @@ bool CommandDispatcher::HandleDeviceListChange(const CommandContext &context) co
// A command with an empty device list is required here in order to return data for all devices
PbCommand command;
PbResult result;
CommandResponse::GetDevicesInfo(controller_factory.GetAllDevices(), result, command);
GetDevicesInfo(controller_factory.GetAllDevices(), result, command);
return context.WriteResult(result);
}

Expand Down
Loading

0 comments on commit 8ec6d23

Please sign in to comment.