Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Ftp plugin into Ftp and FtpServer #319

Merged
merged 4 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 1 addition & 29 deletions protos/ftp/ftp.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ option java_outer_classname = "FtpProto";
* Implements file transfer functionality using MAVLink FTP.
*/
service FtpService {
/*
* Resets FTP server in case there are stale open sessions.
*/
rpc Reset(ResetRequest) returns(ResetResponse) { option (mavsdk.options.async_type) = ASYNC; }
/*
* Downloads a file to local directory.
*/
Expand Down Expand Up @@ -53,28 +49,16 @@ service FtpService {
* Compares a local file to a remote file using a CRC32 checksum.
*/
rpc AreFilesIdentical(AreFilesIdenticalRequest) returns(AreFilesIdenticalResponse) {}
/*
* Set root directory for MAVLink FTP server.
*/
rpc SetRootDirectory(SetRootDirectoryRequest) returns(SetRootDirectoryResponse) { option (mavsdk.options.async_type) = SYNC; }
/*
* Set target component ID. By default it is the autopilot.
*/
rpc SetTargetCompid(SetTargetCompidRequest) returns(SetTargetCompidResponse) { option (mavsdk.options.async_type) = SYNC; }
/*
* Get our own component ID.
*/
rpc GetOurCompid(GetOurCompidRequest) returns(GetOurCompidResponse) { option (mavsdk.options.async_type) = SYNC; }
}

message ResetRequest {}
message ResetResponse {
FtpResult ftp_result = 1;
}

message SubscribeDownloadRequest {
string remote_file_path = 1; // The path of the remote file to download.
string local_dir = 2; // The local directory to download to.
bool use_burst = 3; // Use burst for faster downloading.
}
message DownloadResponse {
FtpResult ftp_result = 1;
Expand Down Expand Up @@ -136,25 +120,13 @@ message AreFilesIdenticalResponse {
bool are_identical = 2; // Whether the files are identical.
}

message SetRootDirectoryRequest {
string root_dir = 1; // The root directory to set.
}
message SetRootDirectoryResponse {
FtpResult ftp_result = 1;
}

message SetTargetCompidRequest {
uint32 compid = 1; // The component ID to set.
}
message SetTargetCompidResponse {
FtpResult ftp_result = 1;
}

message GetOurCompidRequest {}
message GetOurCompidResponse {
uint32 compid = 1; // Our component ID.
}

// Progress data type for file transfer.
message ProgressData {
uint32 bytes_transferred = 1; // The number of bytes already transferred.
Expand Down
43 changes: 43 additions & 0 deletions protos/ftp_server/ftp_server.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
syntax = "proto3";

package mavsdk.rpc.ftp_server;

import "mavsdk_options.proto";

option java_package = "io.mavsdk.ftp_server";
option java_outer_classname = "FtpServerProto";

// Provide files or directories to transfer.
service FtpServerService {
/*
* Set root directory.
*
* This is the directory that can then be accessed by a client.
* The directory needs to exist when this is called.
* The permissions are the same as the file permission for the user running the server.
* The root directory can't be changed while an FTP process is in progress.
*/
rpc SetRootDir(SetRootDirRequest) returns(SetRootDirResponse) { option (mavsdk.options.async_type) = SYNC; }
}

message SetRootDirRequest {
string path = 1; // Absolute path of folder
}

message SetRootDirResponse {
FtpServerResult ftp_server_result = 1;
}

// Result type.
message FtpServerResult {
// Possible results returned for FTP server requests.
enum Result {
RESULT_UNKNOWN = 0; // Unknown result
RESULT_SUCCESS = 1; // Request succeeded
RESULT_DOES_NOT_EXIST = 2; // Directory does not exist
RESULT_BUSY = 3; // Operations in progress
}

Result result = 1; // Result enum value
string result_str = 2; // Human-readable English string describing the result
}
Loading