diff options
author | Albert Kharisov <albert@flipperdevices.com> | 2021-10-01 11:30:29 +0300 |
---|---|---|
committer | Albert Kharisov <albert@flipperdevices.com> | 2021-10-06 16:27:54 +0300 |
commit | f88c5a04ae11c94f24c5c2b368d8ebe1186243b0 (patch) | |
tree | b47ffa51f6d4df748f90122bdefe0312541a879d | |
parent | 3e8a9252e9538f3976c375e764ace32755a8ff05 (diff) |
Add Delete, Mkdir, rename path
-rw-r--r-- | flipper.proto | 42 | ||||
-rw-r--r-- | storage.options | 17 | ||||
-rw-r--r-- | storage.proto | 16 |
3 files changed, 51 insertions, 24 deletions
diff --git a/flipper.proto b/flipper.proto index c17b57e..0c6bb2f 100644 --- a/flipper.proto +++ b/flipper.proto @@ -6,13 +6,24 @@ package PB; enum CommandStatus { OK = 0; - ERROR = 1; - ERROR_NO_SPACE = 2; - ERROR_NO_FILE = 3; - ERROR_DECODE = 4; + ERROR = 1; /**< Unknown error */ + ERROR_DECODE = 2; /**< Command can't be decoded successfully - command_id in response may be wrong! */ + ERROR_NOT_IMPLEMENTED = 3; /**< Command succesfully decoded, but not implemented (deprecated or not yet implemented) */ + ERROR_BUSY = 4; /**< Somebody took global lock, so not all commands are available */ + ERROR_CONTINUOUS_COMMAND_INTERRUPTED = 14; /**< Not received not_last == 0 */ + ERROR_INVALID_PARAMETERS = 15; /**< not provided (or provided invalid) crucial parameters to perform rpc */ + ERROR_STORAGE_NOT_READY = 5; /**< FS not ready */ + ERROR_STORAGE_EXIST = 6; /**< File/Dir alrady exist */ + ERROR_STORAGE_NOT_EXIST = 7; /**< File/Dir does not exist */ + ERROR_STORAGE_INVALID_PARAMETER = 8; /**< Invalid API parameter */ + ERROR_STORAGE_DENIED = 9; /**< Access denied */ + ERROR_STORAGE_INVALID_NAME = 10; /**< Invalid name/path */ + ERROR_STORAGE_INTERNAL = 11; /**< Internal error */ + ERROR_STORAGE_NOT_IMPLEMENTED = 12; /**< Functon not implemented */ + ERROR_STORAGE_ALREADY_OPEN = 13; /**< File/Dir already opened */ } -message Dummy { +message Empty { } message Main { @@ -20,15 +31,18 @@ message Main { CommandStatus command_status = 2; bool not_last = 3; oneof content { - Dummy dummy = 12; - .PB_Status.PingRequest ping_request = 4; - .PB_Status.PingResponse ping_response = 5; - .PB_Storage.ListRequest storage_list_request = 6; - .PB_Storage.ListResponse storage_list_response = 7; - .PB_Storage.ReadRequest storage_read_request = 8; - .PB_Storage.ReadResponse storage_read_response = 9; - .PB_Storage.WriteRequest storage_write_request = 10; - .PB_Storage.DeleteRequest storage_delete_request = 11; + Empty empty = 4; + .PB_Status.PingRequest ping_request = 5; + .PB_Status.PingResponse ping_response = 6; + .PB_Storage.ListRequest storage_list_request = 7; + .PB_Storage.ListResponse storage_list_response = 8; + .PB_Storage.ReadRequest storage_read_request = 9; + .PB_Storage.ReadResponse storage_read_response = 10; + .PB_Storage.WriteRequest storage_write_request = 11; + .PB_Storage.DeleteRequest storage_delete_request = 12; + .PB_Storage.MkdirRequest storage_mkdir_request = 13; + .PB_Storage.Md5sumRequest storage_md5sum_request = 14; + .PB_Storage.Md5sumResponse storage_md5sum_response = 15; } } diff --git a/storage.options b/storage.options index c4d751e..1331008 100644 --- a/storage.options +++ b/storage.options @@ -1,15 +1,16 @@ -//PB_Storage.ListRequest.path callback_datatype:"void*" // string_t* -//PB_Storage.ListRequest.path callback_function:"DecodeStringt" -// [(nanopb).type = FT_POINTER, (nanopb).max_count = 10, (nanopb).fixed_count = true]; -//PB_Storage.ListRequest.path max_count:10 -//PB_Storage.ListRequest.path fixed_count:true - PB_Storage.Element.name type:FT_POINTER PB_Storage.Element.data type:FT_POINTER PB_Storage.ListRequest.path type:FT_POINTER -PB_Storage.ReadRequest.filepath type:FT_POINTER +PB_Storage.ReadRequest.path type:FT_POINTER PB_Storage.WriteRequest.path type:FT_POINTER -PB_Storage.DeleteRequest.filename type:FT_POINTER +PB_Storage.DeleteRequest.path type:FT_POINTER + +PB_Storage.MkdirRequest.path type:FT_POINTER +PB_Storage.Md5sumRequest.path type:FT_POINTER PB_Storage.ListResponse.storage_element max_count:8 +// not used by nanopb, better server should keep in mind this max size +PB_Storage.Element.data max_size:4096 +PB_Storage.Md5sumResponse.md5sum max_length:32 + diff --git a/storage.proto b/storage.proto index a97e038..9700c03 100644 --- a/storage.proto +++ b/storage.proto @@ -22,7 +22,7 @@ message ListResponse { } message ReadRequest { - string filepath = 1; + string path = 1; } message ReadResponse { @@ -35,6 +35,18 @@ message WriteRequest { } message DeleteRequest { - string filename = 1; + string path = 1; +} + +message MkdirRequest { + string path = 1; +} + +message Md5sumRequest { + string path = 1; +} + +message Md5sumResponse { + string md5sum = 1; } |