Skip to content

Commit

Permalink
Merge pull request #143 from mavlink/138-fix-download-mission
Browse files Browse the repository at this point in the history
Fix mission download
  • Loading branch information
julianoes authored Dec 12, 2019
2 parents 91b563b + 6ac2093 commit a34601a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
8 changes: 6 additions & 2 deletions mavsdk/generated/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,9 @@ async def list_running_plugins(self):



return [PluginInfo].translate_from_rpc(response.plugin_info)

plugin_info = []
for plugin_info_rpc in response.plugin_info:
plugin_info.append(PluginInfo.translate_from_rpc(plugin_info_rpc))

return plugin_info

8 changes: 6 additions & 2 deletions mavsdk/generated/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,8 +631,12 @@ async def download_mission(self):
raise MissionError(result, "download_mission()")


return [MissionItem].translate_from_rpc(response.mission_items)

mission_items = []
for mission_items_rpc in response.mission_items:
mission_items.append(MissionItem.translate_from_rpc(mission_items_rpc))

return mission_items


async def cancel_mission_download(self):
"""
Expand Down
10 changes: 9 additions & 1 deletion other/templates/request.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,13 @@ async def {{ name.lower_snake_case }}(self{% for param in params %}, {{ param.na
{% if return_type.is_primitive -%}
return response.{{ return_name.lower_snake_case }}
{% else -%}
return {{ return_type.name }}.translate_from_rpc(response.{{ return_name.lower_snake_case }})
{% if return_type.is_repeated -%}
{{ return_name.lower_snake_case }} = []
for {{ return_name.lower_snake_case }}_rpc in response.{{ return_name.lower_snake_case }}:
{{ return_name.lower_snake_case }}.append({{ return_type.inner_name }}.translate_from_rpc({{ return_name.lower_snake_case }}_rpc))

return {{ return_name.lower_snake_case }}
{% else -%}
return {{ return_type.inner_name }}.translate_from_rpc(response.{{ return_name.lower_snake_case }})
{% endif -%}
{% endif %}

0 comments on commit a34601a

Please sign in to comment.