diff --git a/mavsdk/ftp/ftp.py b/mavsdk/ftp/ftp.py index a5fa05ea..199b83fa 100644 --- a/mavsdk/ftp/ftp.py +++ b/mavsdk/ftp/ftp.py @@ -345,6 +345,8 @@ async def download(self, remote_file_path, local_dir): """ request = ftp_pb2.SubscribeDownloadRequest() + request.remote_file_path = remote_file_path + request.local_dir = local_dir download_stream = self._stub.SubscribeDownload(request) try: @@ -393,6 +395,8 @@ async def upload(self, local_file_path, remote_dir): """ request = ftp_pb2.SubscribeUploadRequest() + request.local_file_path = local_file_path + request.remote_dir = remote_dir upload_stream = self._stub.SubscribeUpload(request) try: diff --git a/mavsdk/log_files/log_files.py b/mavsdk/log_files/log_files.py index 51acea46..ec73c13b 100644 --- a/mavsdk/log_files/log_files.py +++ b/mavsdk/log_files/log_files.py @@ -392,6 +392,8 @@ async def download_log_file(self, id, path): """ request = logFiles_pb2.SubscribeDownloadLogFileRequest() + request.id = id + request.path = path download_log_file_stream = self._stub.SubscribeDownloadLogFile(request) try: diff --git a/mavsdk/system.py b/mavsdk/system.py index a2cac98c..34af16b3 100644 --- a/mavsdk/system.py +++ b/mavsdk/system.py @@ -130,7 +130,7 @@ def follow_me(self) -> follow_me.FollowMe: def ftp(self) -> ftp.Ftp: if "ftp" not in self._plugins: raise RuntimeError(self.error_uninitialized("Ftp")) - return self._plugins["Ftp"] + return self._plugins["ftp"] @property def geofence(self) -> geofence.Geofence: diff --git a/other/templates/py/stream.j2 b/other/templates/py/stream.j2 index 2c2a6186..db187a95 100644 --- a/other/templates/py/stream.j2 +++ b/other/templates/py/stream.j2 @@ -25,6 +25,22 @@ async def {{ name.lower_snake_case }}(self{% for param in params %}, {{ param.na """ request = {{ plugin_name.lower_camel_case }}_pb2.Subscribe{{ name.upper_camel_case }}Request() + {% for param in params %} + {%- if param.type_info.is_primitive -%} + request.{{ param.name.lower_snake_case }} = {{ param.name.lower_snake_case }} + {%- else -%} + {% if param.type_info.is_repeated %} + rpc_elems_list = [] + for elem in {{ param.name.lower_snake_case }}: + rpc_elem = {{ plugin_name.lower_snake_case }}_pb2.{{ param.type_info.inner_name }}() + elem.translate_to_rpc(rpc_elem) + rpc_elems_list.append(rpc_elem) + request.{{ param.name.lower_snake_case }}.extend(rpc_elems_list) + {% else %} + {{ param.name.lower_snake_case }}.translate_to_rpc(request.{{ param.name.lower_snake_case }}) + {% endif %} + {% endif %} + {% endfor -%} {{ name.lower_snake_case }}_stream = self._stub.Subscribe{{ name.upper_camel_case }}(request) try: