Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd84f68

Browse files
committedJun 11, 2021
Fix for timeout issue
1 parent 0dac524 commit cd84f68

27 files changed

+260
-210
lines changed
 

‎.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Package.resolved

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,44 @@
66
"repositoryURL": "https://github.com/grpc/grpc-swift",
77
"state": {
88
"branch": null,
9-
"revision": "9e464a75079928366aa7041769a271fac89271bf",
10-
"version": "1.0.0"
9+
"revision": "f258d1cd8e8fcc97ebfaaf397e569be3d3fa91d6",
10+
"version": "1.1.0"
1111
}
1212
},
1313
{
1414
"package": "MAVSDK-XCFramework",
15-
"repositoryURL": "https://github.com/mavlink/MAVSDK-XCFramework",
15+
"repositoryURL": "https://github.com/byuarus/MAVSDK-XCFramework",
1616
"state": {
1717
"branch": null,
18-
"revision": "8c5fb3a00cac10cb777c146f70cd827328c593fe",
19-
"version": "0.40.0"
18+
"revision": "4eb7ec8af0728534d30fc82e7c3ce4b4af541dc4",
19+
"version": "0.40.0-gac872140"
2020
}
2121
},
2222
{
2323
"package": "RxSwift",
2424
"repositoryURL": "https://github.com/ReactiveX/RxSwift.git",
2525
"state": {
2626
"branch": null,
27-
"revision": "002d325b0bdee94e7882e1114af5ff4fe1e96afa",
28-
"version": "5.1.1"
27+
"revision": "254617dd7fae0c45319ba5fbea435bf4d0e15b5d",
28+
"version": "5.1.2"
2929
}
3030
},
3131
{
3232
"package": "swift-log",
3333
"repositoryURL": "https://github.com/apple/swift-log.git",
3434
"state": {
3535
"branch": null,
36-
"revision": "173f567a2dfec11d74588eea82cecea555bdc0bc",
37-
"version": "1.4.0"
36+
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
37+
"version": "1.4.2"
3838
}
3939
},
4040
{
4141
"package": "swift-nio",
4242
"repositoryURL": "https://github.com/apple/swift-nio.git",
4343
"state": {
4444
"branch": null,
45-
"revision": "2f9ea477387806a79a8951524ef2d40de917a0e1",
46-
"version": "2.24.0"
45+
"revision": "d161bf658780b209c185994528e7e24376cf7283",
46+
"version": "2.29.0"
4747
}
4848
},
4949
{
@@ -60,35 +60,35 @@
6060
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
6161
"state": {
6262
"branch": null,
63-
"revision": "f4736a3b78a2bbe3feb7fc0f33f6683a8c27974c",
64-
"version": "1.16.3"
63+
"revision": "e3e9024a632b40695ad5d3a85f9776a9b27a4bc6",
64+
"version": "1.17.0"
6565
}
6666
},
6767
{
6868
"package": "swift-nio-ssl",
6969
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
7070
"state": {
7171
"branch": null,
72-
"revision": "eb102ad32add8638410e37a69bc815ea11379813",
73-
"version": "2.10.0"
72+
"revision": "6363cdf6d2fb863e82434f3c4618f4e896e37569",
73+
"version": "2.13.1"
7474
}
7575
},
7676
{
7777
"package": "swift-nio-transport-services",
7878
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
7979
"state": {
8080
"branch": null,
81-
"revision": "bb56586c4cab9a79dce6ec4738baddb5802c5de7",
82-
"version": "1.9.0"
81+
"revision": "657537c2cf1845f8d5201ecc4e48f21f21841128",
82+
"version": "1.10.0"
8383
}
8484
},
8585
{
8686
"package": "SwiftProtobuf",
8787
"repositoryURL": "https://github.com/apple/swift-protobuf.git",
8888
"state": {
8989
"branch": null,
90-
"revision": "426bef0ddfdc6449b7bd1418baafad6bbc56110b",
91-
"version": "1.13.0"
90+
"revision": "1f62db409f2c9b0223a3f68567b4a01333aae778",
91+
"version": "1.17.0"
9292
}
9393
}
9494
]

‎Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let package = Package(
2323
dependencies: [
2424
.package(url: "https://github.com/grpc/grpc-swift", from: "1.0.0"),
2525
.package(url: "https://github.com/ReactiveX/RxSwift.git", from: "5.0.0"),
26-
.package(url: "https://github.com/mavlink/MAVSDK-XCFramework", .exact("0.40.0"))
26+
.package(url: "https://github.com/byuarus/MAVSDK-XCFramework", .exact("0.40.0-gac872140"))
2727
],
2828
targets: [
2929
.target(name: "Mavsdk",

‎Sources/Mavsdk/Generated/Camera.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ public class Camera {
161161
case timeout
162162
/// Command has wrong argument(s).
163163
case wrongArgument
164+
/// No system connected.
165+
case noSystem
164166
case UNRECOGNIZED(Int)
165167

166168
internal var rpcResult: Mavsdk_Rpc_Camera_CameraResult.Result {
@@ -181,6 +183,8 @@ public class Camera {
181183
return .timeout
182184
case .wrongArgument:
183185
return .wrongArgument
186+
case .noSystem:
187+
return .noSystem
184188
case .UNRECOGNIZED(let i):
185189
return .UNRECOGNIZED(i)
186190
}
@@ -204,6 +208,8 @@ public class Camera {
204208
return .timeout
205209
case .wrongArgument:
206210
return .wrongArgument
211+
case .noSystem:
212+
return .noSystem
207213
case .UNRECOGNIZED(let i):
208214
return .UNRECOGNIZED(i)
209215
}

‎Sources/Mavsdk/Generated/Core.swift

Lines changed: 18 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import GRPC
44
import NIO
55

66
/**
7-
Access to the connection state and running plugins.
7+
Access to the connection state and core configurations
88
*/
99
public class Core {
1010
private let service: Mavsdk_Rpc_Core_CoreServiceClient
@@ -87,68 +87,6 @@ public class Core {
8787
}
8888
}
8989

90-
/**
91-
Plugin info type.
92-
*/
93-
public struct PluginInfo: Equatable {
94-
public let name: String
95-
public let address: String
96-
public let port: Int32
97-
98-
99-
100-
/**
101-
Initializes a new `PluginInfo`.
102-
103-
104-
- Parameters:
105-
106-
- name: Name of the plugin
107-
108-
- address: Address where the plugin is running
109-
110-
- port: Port where the plugin is running
111-
112-
113-
*/
114-
public init(name: String, address: String, port: Int32) {
115-
self.name = name
116-
self.address = address
117-
self.port = port
118-
}
119-
120-
internal var rpcPluginInfo: Mavsdk_Rpc_Core_PluginInfo {
121-
var rpcPluginInfo = Mavsdk_Rpc_Core_PluginInfo()
122-
123-
124-
rpcPluginInfo.name = name
125-
126-
127-
128-
129-
rpcPluginInfo.address = address
130-
131-
132-
133-
134-
rpcPluginInfo.port = port
135-
136-
137-
138-
return rpcPluginInfo
139-
}
140-
141-
internal static func translateFromRpc(_ rpcPluginInfo: Mavsdk_Rpc_Core_PluginInfo) -> PluginInfo {
142-
return PluginInfo(name: rpcPluginInfo.name, address: rpcPluginInfo.address, port: rpcPluginInfo.port)
143-
}
144-
145-
public static func == (lhs: PluginInfo, rhs: PluginInfo) -> Bool {
146-
return lhs.name == rhs.name
147-
&& lhs.address == rhs.address
148-
&& lhs.port == rhs.port
149-
}
150-
}
151-
15290

15391

15492
/**
@@ -187,27 +125,33 @@ public class Core {
187125
}
188126

189127
/**
190-
Get a list of currently running plugins.
128+
Set timeout of MAVLink transfers.
129+
130+
The default timeout used is generally (0.5 seconds) seconds.
131+
If MAVSDK is used on the same host this timeout can be reduced, while
132+
if MAVSDK has to communicate over links with high latency it might
133+
need to be increased to prevent timeouts.
191134

135+
- Parameter timeoutS: Timeout in seconds
192136

193137
*/
194-
public func listRunningPlugins() -> Single<[PluginInfo]> {
195-
return Single<[PluginInfo]>.create { single in
196-
let request = Mavsdk_Rpc_Core_ListRunningPluginsRequest()
138+
public func setMavlinkTimeout(timeoutS: Double) -> Completable {
139+
return Completable.create { completable in
140+
var request = Mavsdk_Rpc_Core_SetMavlinkTimeoutRequest()
197141

198142

143+
144+
request.timeoutS = timeoutS
145+
146+
199147

200148
do {
201-
let response = self.service.listRunningPlugins(request)
202-
203149

204-
205-
206-
let pluginInfo = try response.response.wait().pluginInfo.map{ PluginInfo.translateFromRpc($0) }
150+
let _ = try self.service.setMavlinkTimeout(request)
151+
completable(.completed)
207152

208-
single(.success(pluginInfo))
209153
} catch {
210-
single(.error(error))
154+
completable(.error(error))
211155
}
212156

213157
return Disposables.create()

‎Sources/Mavsdk/Generated/Ftp.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ public class Ftp {
143143
case unsupported
144144
/// General protocol error.
145145
case protocolError
146+
/// No system connected.
147+
case noSystem
146148
case UNRECOGNIZED(Int)
147149

148150
internal var rpcResult: Mavsdk_Rpc_Ftp_FtpResult.Result {
@@ -171,6 +173,8 @@ public class Ftp {
171173
return .unsupported
172174
case .protocolError:
173175
return .protocolError
176+
case .noSystem:
177+
return .noSystem
174178
case .UNRECOGNIZED(let i):
175179
return .UNRECOGNIZED(i)
176180
}
@@ -202,6 +206,8 @@ public class Ftp {
202206
return .unsupported
203207
case .protocolError:
204208
return .protocolError
209+
case .noSystem:
210+
return .noSystem
205211
case .UNRECOGNIZED(let i):
206212
return .UNRECOGNIZED(i)
207213
}

‎Sources/Mavsdk/Generated/Geofence.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ public class Geofence {
220220
case timeout
221221
/// Invalid argument.
222222
case invalidArgument
223+
/// No system connected.
224+
case noSystem
223225
case UNRECOGNIZED(Int)
224226

225227
internal var rpcResult: Mavsdk_Rpc_Geofence_GeofenceResult.Result {
@@ -238,6 +240,8 @@ public class Geofence {
238240
return .timeout
239241
case .invalidArgument:
240242
return .invalidArgument
243+
case .noSystem:
244+
return .noSystem
241245
case .UNRECOGNIZED(let i):
242246
return .UNRECOGNIZED(i)
243247
}
@@ -259,6 +263,8 @@ public class Geofence {
259263
return .timeout
260264
case .invalidArgument:
261265
return .invalidArgument
266+
case .noSystem:
267+
return .noSystem
262268
case .UNRECOGNIZED(let i):
263269
return .UNRECOGNIZED(i)
264270
}

‎Sources/Mavsdk/Generated/Gimbal.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ public class Gimbal {
231231
case timeout
232232
/// Functionality not supported.
233233
case unsupported
234+
/// No system connected.
235+
case noSystem
234236
case UNRECOGNIZED(Int)
235237

236238
internal var rpcResult: Mavsdk_Rpc_Gimbal_GimbalResult.Result {
@@ -245,6 +247,8 @@ public class Gimbal {
245247
return .timeout
246248
case .unsupported:
247249
return .unsupported
250+
case .noSystem:
251+
return .noSystem
248252
case .UNRECOGNIZED(let i):
249253
return .UNRECOGNIZED(i)
250254
}
@@ -262,6 +266,8 @@ public class Gimbal {
262266
return .timeout
263267
case .unsupported:
264268
return .unsupported
269+
case .noSystem:
270+
return .noSystem
265271
case .UNRECOGNIZED(let i):
266272
return .UNRECOGNIZED(i)
267273
}

‎Sources/Mavsdk/Generated/Info.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,8 @@ public class Info {
391391
case success
392392
/// Information has not been received yet.
393393
case informationNotReceivedYet
394+
/// No system is connected.
395+
case noSystem
394396
case UNRECOGNIZED(Int)
395397

396398
internal var rpcResult: Mavsdk_Rpc_Info_InfoResult.Result {
@@ -401,6 +403,8 @@ public class Info {
401403
return .success
402404
case .informationNotReceivedYet:
403405
return .informationNotReceivedYet
406+
case .noSystem:
407+
return .noSystem
404408
case .UNRECOGNIZED(let i):
405409
return .UNRECOGNIZED(i)
406410
}
@@ -414,6 +418,8 @@ public class Info {
414418
return .success
415419
case .informationNotReceivedYet:
416420
return .informationNotReceivedYet
421+
case .noSystem:
422+
return .noSystem
417423
case .UNRECOGNIZED(let i):
418424
return .UNRECOGNIZED(i)
419425
}

0 commit comments

Comments
 (0)
Please sign in to comment.