From eed83bb005b1f03df7f10c451a7cf2d872d42b0a Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Fri, 17 Dec 2021 19:05:29 +0100 Subject: [PATCH] Completed meta data --- src/raspberrypi/rascsi_interface.proto | 10 +- src/raspberrypi/rascsi_response.cpp | 164 ++++++++++++++++++++++++- 2 files changed, 168 insertions(+), 6 deletions(-) diff --git a/src/raspberrypi/rascsi_interface.proto b/src/raspberrypi/rascsi_interface.proto index 925e22e5..b5567686 100644 --- a/src/raspberrypi/rascsi_interface.proto +++ b/src/raspberrypi/rascsi_interface.proto @@ -64,10 +64,10 @@ enum PbOperation { // Make medium writable (not possible for read-only media) UNPROTECT = 9; - // Gets the server information (PbServerInfo) + // Gets rascsi server information (PbServerInfo) SERVER_INFO = 10; - // Get rascsi version information (PbVersionInfo) + // Get rascsi server version (PbVersionInfo) VERSION_INFO = 11; // Get information on attached devices (PbDevicesInfo) @@ -103,7 +103,7 @@ enum PbOperation { // "folder": The path of the default folder, relative to the user's home folder if relative. DEFAULT_FOLDER = 20; - // Set a new log level. + // Set the log level. // Parameters: // "level": The new log level LOG_LEVEL = 21; @@ -113,7 +113,7 @@ enum PbOperation { // "ids": A comma-separated list of IDs to reserve, or an empty string in order not to reserve any ID. RESERVE_IDS = 22; - // Shut down the rascsi process + // Shut down the rascsi process or shut down/reboot the Raspberry Pi // Parameters: // "mode": The shutdown mode, one of "rascsi", "system", "reboot" SHUT_DOWN = 23; @@ -155,7 +155,7 @@ enum PbOperation { // "file": The filename, relative to the default image folder. It must not contain a slash. UNPROTECT_IMAGE = 29; - // Get operation meta data + // Get operation meta data (PbOperationParameters) OPERATION_INFO = 30; } diff --git a/src/raspberrypi/rascsi_response.cpp b/src/raspberrypi/rascsi_response.cpp index 518ab4a9..a6e82840 100644 --- a/src/raspberrypi/rascsi_response.cpp +++ b/src/raspberrypi/rascsi_response.cpp @@ -351,7 +351,7 @@ PbOperationInfo *RascsiResponse::GetOperationInfo(PbResult& result) parameter->set_type("string"); parameter = parameters->add_parameters(); parameter->set_name("interfaces"); - (*parameter->mutable_description())["en"] = "Comma-separated list of network interfaces"; + (*parameter->mutable_description())["en"] = "A comma-separated list of network interfaces"; parameter->set_type("string"); parameters = operation_info->add_operations(); @@ -376,6 +376,8 @@ PbOperationInfo *RascsiResponse::GetOperationInfo(PbResult& result) parameter = parameters->add_parameters(); parameter->set_name("file"); (*parameter->mutable_description())["en"] = "Image file name"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); parameters = operation_info->add_operations(); parameters->set_name(PbOperation_Name(EJECT)); @@ -389,8 +391,168 @@ PbOperationInfo *RascsiResponse::GetOperationInfo(PbResult& result) parameters->set_name(PbOperation_Name(UNPROTECT)); (*parameters->mutable_description())["en"] = "Unprotect medium"; + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(SERVER_INFO)); + (*parameters->mutable_description())["en"] = "Get rascsi server information"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(VERSION_INFO)); + (*parameters->mutable_description())["en"] = "Get rascsi server version"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(DEVICES_INFO)); + (*parameters->mutable_description())["en"] = "Get information on attached devices"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(DEVICE_TYPES_INFO)); + (*parameters->mutable_description())["en"] = "Get device properties by device type"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(DEFAULT_IMAGE_FILES_INFO)); + (*parameters->mutable_description())["en"] = "Get information on available image files"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(IMAGE_FILE_INFO)); + (*parameters->mutable_description())["en"] = "Get information on an image file"; + parameter = parameters->add_parameters(); + parameter->set_name("file"); + (*parameter->mutable_description())["en"] = "Image file name"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(LOG_LEVEL_INFO)); + (*parameters->mutable_description())["en"] = "Get log level information"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(NETWORK_INTERFACES_INFO)); + (*parameters->mutable_description())["en"] = "Get the names of the available network interfaces"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(MAPPING_INFO)); + (*parameters->mutable_description())["en"] = "Get the mapping of extensions to device types"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(RESERVED_IDS_INFO)); + (*parameters->mutable_description())["en"] = "Get the list of reserved device IDs"; + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(DEFAULT_FOLDER)); + (*parameters->mutable_description())["en"] = "Set the default image file folder"; + parameter = parameters->add_parameters(); + parameter->set_name("folder"); + (*parameter->mutable_description())["en"] = "Default image file folder name"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(LOG_LEVEL)); + (*parameters->mutable_description())["en"] = "Set the log level"; + parameter = parameters->add_parameters(); + parameter->set_name("level"); + (*parameter->mutable_description())["en"] = "The log level"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(RESERVE_IDS)); + (*parameters->mutable_description())["en"] = "Set the list of reserved device IDs"; + parameter = parameters->add_parameters(); + parameter->set_name("ids"); + (*parameter->mutable_description())["en"] = "A comma-separated list of device IDs"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(SHUT_DOWN)); + (*parameters->mutable_description())["en"] = "Shut down or reboot"; + parameter = parameters->add_parameters(); + parameter->set_name("mode"); + (*parameter->mutable_description())["en"] = "The shutdown mode"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(CREATE_IMAGE)); + (*parameters->mutable_description())["en"] = "Create an image file"; + parameter = parameters->add_parameters(); + parameter->set_name("file"); + (*parameter->mutable_description())["en"] = "The filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameter = parameters->add_parameters(); + parameter->set_name("size"); + (*parameter->mutable_description())["en"] = "The file size in bytes"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameter = parameters->add_parameters(); + parameter->set_name("read_only"); + (*parameter->mutable_description())["en"] = "The read-only flag, true if missing"; + parameter->set_type("string"); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(DELETE_IMAGE)); + (*parameters->mutable_description())["en"] = "Delete an image file"; + parameter = parameters->add_parameters(); + parameter->set_name("file"); + (*parameter->mutable_description())["en"] = "The filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(RENAME_IMAGE)); + (*parameters->mutable_description())["en"] = "Rename an image file"; + parameter = parameters->add_parameters(); + parameter->set_name("from"); + (*parameter->mutable_description())["en"] = "The source filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameter = parameters->add_parameters(); + parameter->set_name("to"); + (*parameter->mutable_description())["en"] = "The destination filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(COPY_IMAGE)); + (*parameters->mutable_description())["en"] = "Copy an image file"; + parameter->set_name("from"); + (*parameter->mutable_description())["en"] = "The source filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameter = parameters->add_parameters(); + parameter->set_name("to"); + (*parameter->mutable_description())["en"] = "The destination filename"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameter = parameters->add_parameters(); + parameter->set_name("read_only"); + (*parameter->mutable_description())["en"] = "The read-only flag, true if missing"; + parameter->set_type("string"); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(PROTECT_IMAGE)); + (*parameters->mutable_description())["en"] = "Write-protect an image file"; + parameter = parameters->add_parameters(); + parameter->set_name("file"); + (*parameter->mutable_description())["en"] = "Image file name"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + + parameters = operation_info->add_operations(); + parameters->set_name(PbOperation_Name(UNPROTECT_IMAGE)); + (*parameters->mutable_description())["en"] = "Make an image file writable"; + parameter = parameters->add_parameters(); + parameter->set_name("file"); + (*parameter->mutable_description())["en"] = "Image file name"; + parameter->set_type("string"); + parameter->set_is_mandatory(true); + parameters = operation_info->add_operations(); parameters->set_name(PbOperation_Name(OPERATION_INFO)); + (*parameters->mutable_description())["en"] = "Get operation meta data"; + + assert(operation_info->operations_size() == 30); result.set_status(true);