adafruit_ble_file_transfer

Simple BLE Service for reading and writing files over BLE

  • Author(s): Scott Shawcroft

class adafruit_ble_file_transfer.FileTransferClient(service: Service)

Helper class to communicating with a File Transfer server

delete(path: str) None

Deletes the file or directory at the given path.

listdir(path: str) List[tuple]

Returns a list of tuples, one tuple for each file or directory in the given path

mkdir(path: str, modification_time: int | None = None) int

Makes the directory and any missing parents. Returns the truncated time

move(old_path: str, new_path: str) None

Moves the file or directory from old_path to new_path.

read(path: str, *, offset: int = 0) bytearray

Returns the contents of the file at the given path starting at the given offset

write(path: str, contents: bytearray, *, offset: int = 0, modification_time: int | None = None) int

Writes the given contents to the given path starting at the given offset. Returns the trunctated modification time.

If the file is shorter than the offset, zeros will be added in the gap.

class adafruit_ble_file_transfer.FileTransferService(*, service: Service | None = None, secondary: bool = False, **initial_values)

Simple (not necessarily fast) BLE file transfer service. It implements basic CRUD operations.

The server dictates data transfer chunk sizes so it can minimize buffer sizes on its end.

class adafruit_ble_file_transfer.FileTransferUUID(uuid16: int)

UUIDs with the CircuitPython base UUID.

exception adafruit_ble_file_transfer.ProtocolError

Error thrown when expected bytes don’t match