|
10 | 10 | from .constants import DEFAULT_WS_URL |
11 | 11 | from .control import set_control |
12 | 12 | from .event_queue import EventQueue |
13 | | -from .file_ops import upload, upload_file |
14 | | -from .pins import pin_listen, pin_read |
| 13 | +from .file_ops import download, download_file, upload, upload_file |
| 14 | +from .pins import gpio_list, pin_listen, pin_read |
15 | 15 | from .protocol_types import EventMessage, ResponseMessage |
16 | 16 | from .serial import monitor_lines, write_serial |
17 | 17 | from .simulation import pause, restart, resume, start |
@@ -88,6 +88,28 @@ async def upload_file( |
88 | 88 | """ |
89 | 89 | return await upload_file(self._transport, filename, local_path) |
90 | 90 |
|
| 91 | + async def download(self, name: str) -> ResponseMessage: |
| 92 | + """ |
| 93 | + Download a file from the simulator. |
| 94 | +
|
| 95 | + Args: |
| 96 | + name: The name of the file to download. |
| 97 | +
|
| 98 | + Returns: |
| 99 | + The response message from the server. |
| 100 | + """ |
| 101 | + return await download(self._transport, name) |
| 102 | + |
| 103 | + async def download_file(self, name: str, local_path: Optional[Path] = None) -> None: |
| 104 | + """ |
| 105 | + Download a file from the simulator and save it to a local path. |
| 106 | +
|
| 107 | + Args: |
| 108 | + name: The name of the file to download. |
| 109 | + local_path: The local path to save the downloaded file. If not provided, uses the name as the path. |
| 110 | + """ |
| 111 | + await download_file(self._transport, name, local_path) |
| 112 | + |
91 | 113 | async def start_simulation( |
92 | 114 | self, |
93 | 115 | firmware: str, |
@@ -214,6 +236,10 @@ async def listen_pin(self, part: str, pin: str, listen: bool = True) -> Response |
214 | 236 | """ |
215 | 237 | return await pin_listen(self._transport, part=part, pin=pin, listen=listen) |
216 | 238 |
|
| 239 | + async def gpio_list(self) -> ResponseMessage: |
| 240 | + """Get a list of all GPIO pins available in the simulation.""" |
| 241 | + return await gpio_list(self._transport) |
| 242 | + |
217 | 243 | async def set_control( |
218 | 244 | self, part: str, control: str, value: typing.Union[int, bool, float] |
219 | 245 | ) -> ResponseMessage: |
|
0 commit comments