Skip to content

Commit

Permalink
Merge pull request #200 from mavlink/pr-proto-update
Browse files Browse the repository at this point in the history
Updated proto, mavsdk_server to v0.41.0
  • Loading branch information
julianoes authored Jul 22, 2021
2 parents 0dac524 + e919db5 commit 0c58e66
Show file tree
Hide file tree
Showing 38 changed files with 8,678 additions and 2,463 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
submodules: recursive
- name: install tools
run: pip3 install protoc-gen-mavsdk && brew install protobuf
run: pip3 install protoc-gen-mavsdk && brew install protobuf || brew link --overwrite protobuf
- name: generate from protos
run: bash Sources/Mavsdk/tools/generate_from_protos.bash
- name: check for diff
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/mavlink/MAVSDK-XCFramework",
"state": {
"branch": null,
"revision": "8c5fb3a00cac10cb777c146f70cd827328c593fe",
"version": "0.40.0"
"revision": "aa39ed49fd0832c4a8169cab6a037037ad9b5cf6",
"version": "0.41.0"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/grpc/grpc-swift", from: "1.0.0"),
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"),
.package(url: "https://github.com/mavlink/MAVSDK-XCFramework", .exact("0.40.0"))
.package(url: "https://github.com/mavlink/MAVSDK-XCFramework", .exact("0.41.0"))
],
targets: [
.target(name: "Mavsdk",
Expand Down
8 changes: 7 additions & 1 deletion Sources/Mavsdk/Generated/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,14 @@ public class Camera {
case busy
/// Camera denied the command.
case denied
/// An error has occured while executing the command.
/// An error has occurred while executing the command.
case error
/// Command timed out.
case timeout
/// Command has wrong argument(s).
case wrongArgument
/// No system connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_Camera_CameraResult.Result {
Expand All @@ -181,6 +183,8 @@ public class Camera {
return .timeout
case .wrongArgument:
return .wrongArgument
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand All @@ -204,6 +208,8 @@ public class Camera {
return .timeout
case .wrongArgument:
return .wrongArgument
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
92 changes: 18 additions & 74 deletions Sources/Mavsdk/Generated/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import GRPC
import NIO

/**
Access to the connection state and running plugins.
Access to the connection state and core configurations
*/
public class Core {
private let service: Mavsdk_Rpc_Core_CoreServiceClient
Expand Down Expand Up @@ -87,68 +87,6 @@ public class Core {
}
}

/**
Plugin info type.
*/
public struct PluginInfo: Equatable {
public let name: String
public let address: String
public let port: Int32



/**
Initializes a new `PluginInfo`.
- Parameters:
- name: Name of the plugin
- address: Address where the plugin is running
- port: Port where the plugin is running
*/
public init(name: String, address: String, port: Int32) {
self.name = name
self.address = address
self.port = port
}

internal var rpcPluginInfo: Mavsdk_Rpc_Core_PluginInfo {
var rpcPluginInfo = Mavsdk_Rpc_Core_PluginInfo()


rpcPluginInfo.name = name




rpcPluginInfo.address = address




rpcPluginInfo.port = port



return rpcPluginInfo
}

internal static func translateFromRpc(_ rpcPluginInfo: Mavsdk_Rpc_Core_PluginInfo) -> PluginInfo {
return PluginInfo(name: rpcPluginInfo.name, address: rpcPluginInfo.address, port: rpcPluginInfo.port)
}

public static func == (lhs: PluginInfo, rhs: PluginInfo) -> Bool {
return lhs.name == rhs.name
&& lhs.address == rhs.address
&& lhs.port == rhs.port
}
}



/**
Expand Down Expand Up @@ -187,27 +125,33 @@ public class Core {
}

/**
Get a list of currently running plugins.
Set timeout of MAVLink transfers.
The default timeout used is generally (0.5 seconds) seconds.
If MAVSDK is used on the same host this timeout can be reduced, while
if MAVSDK has to communicate over links with high latency it might
need to be increased to prevent timeouts.
- Parameter timeoutS: Timeout in seconds
*/
public func listRunningPlugins() -> Single<[PluginInfo]> {
return Single<[PluginInfo]>.create { single in
let request = Mavsdk_Rpc_Core_ListRunningPluginsRequest()
public func setMavlinkTimeout(timeoutS: Double) -> Completable {
return Completable.create { completable in
var request = Mavsdk_Rpc_Core_SetMavlinkTimeoutRequest()



request.timeoutS = timeoutS



do {
let response = self.service.listRunningPlugins(request)




let pluginInfo = try response.response.wait().pluginInfo.map{ PluginInfo.translateFromRpc($0) }
let _ = try self.service.setMavlinkTimeout(request)
completable(.completed)

single(.success(pluginInfo))
} catch {
single(.error(error))
completable(.error(error))
}

return Disposables.create()
Expand Down
2 changes: 1 addition & 1 deletion Sources/Mavsdk/Generated/FollowMe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public class FollowMe {
Possible results returned for followme operations
*/
public enum Result: Equatable {
/// Unkown result.
/// Unknown result.
case unknown
/// Request succeeded.
case success
Expand Down
6 changes: 6 additions & 0 deletions Sources/Mavsdk/Generated/Ftp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ public class Ftp {
case unsupported
/// General protocol error.
case protocolError
/// No system connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_Ftp_FtpResult.Result {
Expand Down Expand Up @@ -171,6 +173,8 @@ public class Ftp {
return .unsupported
case .protocolError:
return .protocolError
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down Expand Up @@ -202,6 +206,8 @@ public class Ftp {
return .unsupported
case .protocolError:
return .protocolError
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Mavsdk/Generated/Geofence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ public class Geofence {
case timeout
/// Invalid argument.
case invalidArgument
/// No system connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_Geofence_GeofenceResult.Result {
Expand All @@ -238,6 +240,8 @@ public class Geofence {
return .timeout
case .invalidArgument:
return .invalidArgument
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand All @@ -259,6 +263,8 @@ public class Geofence {
return .timeout
case .invalidArgument:
return .invalidArgument
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Mavsdk/Generated/Gimbal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ public class Gimbal {
case timeout
/// Functionality not supported.
case unsupported
/// No system connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_Gimbal_GimbalResult.Result {
Expand All @@ -245,6 +247,8 @@ public class Gimbal {
return .timeout
case .unsupported:
return .unsupported
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand All @@ -262,6 +266,8 @@ public class Gimbal {
return .timeout
case .unsupported:
return .unsupported
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Mavsdk/Generated/Info.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ public class Info {
case success
/// Information has not been received yet.
case informationNotReceivedYet
/// No system is connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_Info_InfoResult.Result {
Expand All @@ -401,6 +403,8 @@ public class Info {
return .success
case .informationNotReceivedYet:
return .informationNotReceivedYet
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand All @@ -414,6 +418,8 @@ public class Info {
return .success
case .informationNotReceivedYet:
return .informationNotReceivedYet
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
6 changes: 6 additions & 0 deletions Sources/Mavsdk/Generated/LogFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ public class LogFiles {
case invalidArgument
/// File open failed.
case fileOpenFailed
/// No system is connected.
case noSystem
case UNRECOGNIZED(Int)

internal var rpcResult: Mavsdk_Rpc_LogFiles_LogFilesResult.Result {
Expand All @@ -201,6 +203,8 @@ public class LogFiles {
return .invalidArgument
case .fileOpenFailed:
return .fileOpenFailed
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand All @@ -222,6 +226,8 @@ public class LogFiles {
return .invalidArgument
case .fileOpenFailed:
return .fileOpenFailed
case .noSystem:
return .noSystem
case .UNRECOGNIZED(let i):
return .UNRECOGNIZED(i)
}
Expand Down
Loading

0 comments on commit 0c58e66

Please sign in to comment.