Skip to content

Commit b8b9d17

Browse files
authored
Merge pull request #194 from mavlink/fix-enum-translation
Fix translate_to_rpc for enums
2 parents 7443a05 + c4d828a commit b8b9d17

File tree

19 files changed

+61
-59
lines changed

19 files changed

+61
-59
lines changed

mavsdk/generated/action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Result(Enum):
7878
NO_VTOL_TRANSITION_SUPPORT = 10
7979
PARAMETER_ERROR = 11
8080

81-
def translate_to_rpc(self, rpcResult):
81+
def translate_to_rpc(self):
8282
if self == ActionResult.Result.UNKNOWN:
8383
return action_pb2.ActionResult.RESULT_UNKNOWN
8484
if self == ActionResult.Result.SUCCESS:
@@ -182,7 +182,7 @@ def translate_to_rpc(self, rpcActionResult):
182182

183183

184184

185-
self.result.translate_to_rpc(rpcActionResult.result)
185+
rpcActionResult.result = self.result.translate_to_rpc()
186186

187187

188188

mavsdk/generated/calibration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Result(Enum):
7474
CANCELLED = 9
7575
FAILED_ARMED = 10
7676

77-
def translate_to_rpc(self, rpcResult):
77+
def translate_to_rpc(self):
7878
if self == CalibrationResult.Result.UNKNOWN:
7979
return calibration_pb2.CalibrationResult.RESULT_UNKNOWN
8080
if self == CalibrationResult.Result.SUCCESS:
@@ -174,7 +174,7 @@ def translate_to_rpc(self, rpcCalibrationResult):
174174

175175

176176

177-
self.result.translate_to_rpc(rpcCalibrationResult.result)
177+
rpcCalibrationResult.result = self.result.translate_to_rpc()
178178

179179

180180

mavsdk/generated/camera.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Mode(Enum):
2626
PHOTO = 1
2727
VIDEO = 2
2828

29-
def translate_to_rpc(self, rpcMode):
29+
def translate_to_rpc(self):
3030
if self == Mode.UNKNOWN:
3131
return camera_pb2.MODE_UNKNOWN
3232
if self == Mode.PHOTO:
@@ -106,7 +106,7 @@ class Result(Enum):
106106
TIMEOUT = 6
107107
WRONG_ARGUMENT = 7
108108

109-
def translate_to_rpc(self, rpcResult):
109+
def translate_to_rpc(self):
110110
if self == CameraResult.Result.UNKNOWN:
111111
return camera_pb2.CameraResult.RESULT_UNKNOWN
112112
if self == CameraResult.Result.SUCCESS:
@@ -194,7 +194,7 @@ def translate_to_rpc(self, rpcCameraResult):
194194

195195

196196

197-
self.result.translate_to_rpc(rpcCameraResult.result)
197+
rpcCameraResult.result = self.result.translate_to_rpc()
198198

199199

200200

@@ -846,7 +846,7 @@ class Status(Enum):
846846
NOT_RUNNING = 0
847847
IN_PROGRESS = 1
848848

849-
def translate_to_rpc(self, rpcStatus):
849+
def translate_to_rpc(self):
850850
if self == VideoStreamInfo.Status.NOT_RUNNING:
851851
return camera_pb2.VideoStreamInfo.STATUS_NOT_RUNNING
852852
if self == VideoStreamInfo.Status.IN_PROGRESS:
@@ -916,7 +916,7 @@ def translate_to_rpc(self, rpcVideoStreamInfo):
916916

917917

918918

919-
self.status.translate_to_rpc(rpcVideoStreamInfo.status)
919+
rpcVideoStreamInfo.status = self.status.translate_to_rpc()
920920

921921

922922

@@ -978,7 +978,7 @@ class StorageStatus(Enum):
978978
UNFORMATTED = 1
979979
FORMATTED = 2
980980

981-
def translate_to_rpc(self, rpcStorageStatus):
981+
def translate_to_rpc(self):
982982
if self == Status.StorageStatus.NOT_AVAILABLE:
983983
return camera_pb2.Status.STORAGE_STATUS_NOT_AVAILABLE
984984
if self == Status.StorageStatus.UNFORMATTED:
@@ -1130,7 +1130,7 @@ def translate_to_rpc(self, rpcStatus):
11301130

11311131

11321132

1133-
self.storage_status.translate_to_rpc(rpcStatus.storage_status)
1133+
rpcStatus.storage_status = self.storage_status.translate_to_rpc()
11341134

11351135

11361136

mavsdk/generated/follow_me.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class FollowDirection(Enum):
5656
FRONT_RIGHT = 3
5757
FRONT_LEFT = 4
5858

59-
def translate_to_rpc(self, rpcFollowDirection):
59+
def translate_to_rpc(self):
6060
if self == Config.FollowDirection.NONE:
6161
return follow_me_pb2.Config.FOLLOW_DIRECTION_NONE
6262
if self == Config.FollowDirection.BEHIND:
@@ -158,7 +158,7 @@ def translate_to_rpc(self, rpcConfig):
158158

159159

160160

161-
self.follow_direction.translate_to_rpc(rpcConfig.follow_direction)
161+
rpcConfig.follow_direction = self.follow_direction.translate_to_rpc()
162162

163163

164164

@@ -370,7 +370,7 @@ class Result(Enum):
370370
NOT_ACTIVE = 7
371371
SET_CONFIG_FAILED = 8
372372

373-
def translate_to_rpc(self, rpcResult):
373+
def translate_to_rpc(self):
374374
if self == FollowMeResult.Result.UNKNOWN:
375375
return follow_me_pb2.FollowMeResult.RESULT_UNKNOWN
376376
if self == FollowMeResult.Result.SUCCESS:
@@ -462,7 +462,7 @@ def translate_to_rpc(self, rpcFollowMeResult):
462462

463463

464464

465-
self.result.translate_to_rpc(rpcFollowMeResult.result)
465+
rpcFollowMeResult.result = self.result.translate_to_rpc()
466466

467467

468468

mavsdk/generated/ftp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class Result(Enum):
152152
UNSUPPORTED = 10
153153
PROTOCOL_ERROR = 11
154154

155-
def translate_to_rpc(self, rpcResult):
155+
def translate_to_rpc(self):
156156
if self == FtpResult.Result.UNKNOWN:
157157
return ftp_pb2.FtpResult.RESULT_UNKNOWN
158158
if self == FtpResult.Result.SUCCESS:
@@ -256,7 +256,7 @@ def translate_to_rpc(self, rpcFtpResult):
256256

257257

258258

259-
self.result.translate_to_rpc(rpcFtpResult.result)
259+
rpcFtpResult.result = self.result.translate_to_rpc()
260260

261261

262262

mavsdk/generated/geofence.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class Type(Enum):
112112
INCLUSION = 0
113113
EXCLUSION = 1
114114

115-
def translate_to_rpc(self, rpcType):
115+
def translate_to_rpc(self):
116116
if self == Polygon.Type.INCLUSION:
117117
return geofence_pb2.Polygon.TYPE_INCLUSION
118118
if self == Polygon.Type.EXCLUSION:
@@ -187,7 +187,7 @@ def translate_to_rpc(self, rpcPolygon):
187187

188188

189189

190-
self.type.translate_to_rpc(rpcPolygon.type)
190+
rpcPolygon.type = self.type.translate_to_rpc()
191191

192192

193193

@@ -247,7 +247,7 @@ class Result(Enum):
247247
TIMEOUT = 5
248248
INVALID_ARGUMENT = 6
249249

250-
def translate_to_rpc(self, rpcResult):
250+
def translate_to_rpc(self):
251251
if self == GeofenceResult.Result.UNKNOWN:
252252
return geofence_pb2.GeofenceResult.RESULT_UNKNOWN
253253
if self == GeofenceResult.Result.SUCCESS:
@@ -331,7 +331,7 @@ def translate_to_rpc(self, rpcGeofenceResult):
331331

332332

333333

334-
self.result.translate_to_rpc(rpcGeofenceResult.result)
334+
rpcGeofenceResult.result = self.result.translate_to_rpc()
335335

336336

337337

mavsdk/generated/gimbal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GimbalMode(Enum):
2222
YAW_FOLLOW = 0
2323
YAW_LOCK = 1
2424

25-
def translate_to_rpc(self, rpcGimbalMode):
25+
def translate_to_rpc(self):
2626
if self == GimbalMode.YAW_FOLLOW:
2727
return gimbal_pb2.GIMBAL_MODE_YAW_FOLLOW
2828
if self == GimbalMode.YAW_LOCK:
@@ -82,7 +82,7 @@ class Result(Enum):
8282
ERROR = 2
8383
TIMEOUT = 3
8484

85-
def translate_to_rpc(self, rpcResult):
85+
def translate_to_rpc(self):
8686
if self == GimbalResult.Result.UNKNOWN:
8787
return gimbal_pb2.GimbalResult.RESULT_UNKNOWN
8888
if self == GimbalResult.Result.SUCCESS:
@@ -154,7 +154,7 @@ def translate_to_rpc(self, rpcGimbalResult):
154154

155155

156156

157-
self.result.translate_to_rpc(rpcGimbalResult.result)
157+
rpcGimbalResult.result = self.result.translate_to_rpc()
158158

159159

160160

mavsdk/generated/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class Result(Enum):
498498
SUCCESS = 1
499499
INFORMATION_NOT_RECEIVED_YET = 2
500500

501-
def translate_to_rpc(self, rpcResult):
501+
def translate_to_rpc(self):
502502
if self == InfoResult.Result.UNKNOWN:
503503
return info_pb2.InfoResult.RESULT_UNKNOWN
504504
if self == InfoResult.Result.SUCCESS:
@@ -566,7 +566,7 @@ def translate_to_rpc(self, rpcInfoResult):
566566

567567

568568

569-
self.result.translate_to_rpc(rpcInfoResult.result)
569+
rpcInfoResult.result = self.result.translate_to_rpc()
570570

571571

572572

mavsdk/generated/log_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class Result(Enum):
206206
INVALID_ARGUMENT = 5
207207
FILE_OPEN_FAILED = 6
208208

209-
def translate_to_rpc(self, rpcResult):
209+
def translate_to_rpc(self):
210210
if self == LogFilesResult.Result.UNKNOWN:
211211
return log_files_pb2.LogFilesResult.RESULT_UNKNOWN
212212
if self == LogFilesResult.Result.SUCCESS:
@@ -290,7 +290,7 @@ def translate_to_rpc(self, rpcLogFilesResult):
290290

291291

292292

293-
self.result.translate_to_rpc(rpcLogFilesResult.result)
293+
rpcLogFilesResult.result = self.result.translate_to_rpc()
294294

295295

296296

mavsdk/generated/mission.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class CameraAction(Enum):
8383
START_VIDEO = 4
8484
STOP_VIDEO = 5
8585

86-
def translate_to_rpc(self, rpcCameraAction):
86+
def translate_to_rpc(self):
8787
if self == MissionItem.CameraAction.NONE:
8888
return mission_pb2.MissionItem.CAMERA_ACTION_NONE
8989
if self == MissionItem.CameraAction.TAKE_PHOTO:
@@ -261,7 +261,7 @@ def translate_to_rpc(self, rpcMissionItem):
261261

262262

263263

264-
self.camera_action.translate_to_rpc(rpcMissionItem.camera_action)
264+
rpcMissionItem.camera_action = self.camera_action.translate_to_rpc()
265265

266266

267267

@@ -494,7 +494,7 @@ class Result(Enum):
494494
UNSUPPORTED_MISSION_CMD = 11
495495
TRANSFER_CANCELLED = 12
496496

497-
def translate_to_rpc(self, rpcResult):
497+
def translate_to_rpc(self):
498498
if self == MissionResult.Result.UNKNOWN:
499499
return mission_pb2.MissionResult.RESULT_UNKNOWN
500500
if self == MissionResult.Result.SUCCESS:
@@ -602,7 +602,7 @@ def translate_to_rpc(self, rpcMissionResult):
602602

603603

604604

605-
self.result.translate_to_rpc(rpcMissionResult.result)
605+
rpcMissionResult.result = self.result.translate_to_rpc()
606606

607607

608608

0 commit comments

Comments
 (0)