File Management¶
Refer to the smp File Management documentation for a complete description of each Request and Response.
FileDownload
¶
Bases: FileDownloadRequest
, _FileGroupBase
Download contents of an existing file from specified path.
Client applications must keep track of data they have already downloaded and where their position in the file is, and issue subsequent requests, with modified offset, to gather the entire file.
Request does not carry size of requested chunk, the size is specified by application itself. Note that file handles will remain open for consecutive requests (as long as an idle timeout has not been reached and another transport does not make use of uploading/downloading files using fs_mgmt), but files are not exclusively owned by SMP, for the time of download session, and may change between requests or even be removed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
off |
int
|
|
required |
name |
str
|
|
required |
Source code in smpclient/requests/file_management.py
FileUpload
¶
Bases: FileUploadRequest
, _FileGroupBase
Upload a file to a specified location.
Command will automatically overwrite existing file or create a new one if it does not exist at specified path. The protocol supports stateless upload where each requests carries different chunk of a file and it is client side responsibility to track progress of upload.
Note that file handles will remain open for consecutive requests (as long as an idle timeout has not been reached, but files are not exclusively owned by SMP, for the time of download session, and may change between requests or even be removed. Note that file handles will remain open for consecutive requests (as long as an idle timeout has not been reached and another transport does not make use of uploading/downloading files using fs_mgmt), but files are not exclusively owned by MCUmgr, for the time of download session, and may change between requests or even be removed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
off |
int
|
|
required |
name |
str
|
|
required |
len |
int | None
|
|
required |
Source code in smpclient/requests/file_management.py
FileStatus
¶
Bases: FileStatusRequest
, _FileGroupBase
Retrieve status of an existing file from specified path of a target device.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
|
required |
Source code in smpclient/requests/file_management.py
FileHashChecksum
¶
Bases: FileHashChecksumRequest
, _FileGroupBase
Generate a hash/checksum of an existing file at a specified path on a target device.
Note that kernel heap memory is required for buffers to be allocated for
this to function, and large stack memory buffers are required for generation
of the output hash/checksum. Requires CONFIG_MCUMGR_GRP_FS_CHECKSUM_HASH
to
be enabled for the base functionality, supported hash/checksum are opt-in
with CONFIG_MCUMGR_GRP_FS_CHECKSUM_IEEE_CRC32
or
CONFIG_MCUMGR_GRP_FS_HASH_SHA256
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
|
required |
type |
Optional[Literal[crc32]]
|
|
required |
off |
int | None
|
|
required |
len |
int | None
|
|
required |
Source code in smpclient/requests/file_management.py
SupportedFileHashChecksumTypes
¶
Bases: SupportedFileHashChecksumTypesRequest
, _FileGroupBase
List the hash and checksum types are available on a device.
Requires Kconfig CONFIG_MCUMGR_GRP_FS_CHECKSUM_HASH_SUPPORTED_CMD
to be enabled.
Source code in smpclient/requests/file_management.py
FileClose
¶
Bases: FileCloseRequest
, _FileGroupBase
Close all open file handles held by fs_mgmt upload/download requests.