JvmFirmwareFileHandler

Constructors

Link copied to clipboard
constructor(client: HttpClient)

Functions

Link copied to clipboard
open suspend override fun checkUrlExists(url: String): Boolean

Return true if url is reachable (HTTP HEAD check).

Link copied to clipboard
open override fun cleanupAllTemporaryFiles()

Remove all temporary firmware files created during previous update sessions.

Link copied to clipboard
open suspend override fun copyToUri(source: FirmwareArtifact, destinationUri: CommonUri): Long

Copy source to the platform URI destinationUri, returning the number of bytes written.

Link copied to clipboard
open suspend override fun deleteFile(file: FirmwareArtifact)

Delete a single firmware file from local storage.

Link copied to clipboard
open suspend override fun downloadFile(url: String, fileName: String, onProgress: (Float) -> Unit): FirmwareArtifact?

Download a file from url, saving it as fileName in a temporary directory.

Link copied to clipboard
open suspend override fun extractFirmware(uri: CommonUri, hardware: DeviceHardware, fileExtension: String, preferredFilename: String? = null): FirmwareArtifact?

Extract a matching firmware binary from a platform URI (e.g. content:// or file://) zip archive.

Link copied to clipboard
open suspend override fun extractFirmwareFromZip(zipFile: FirmwareArtifact, hardware: DeviceHardware, fileExtension: String, preferredFilename: String? = null): FirmwareArtifact?

Extract a matching firmware binary from a previously-downloaded zip FirmwareArtifact.

Link copied to clipboard
open suspend override fun extractZipEntries(artifact: FirmwareArtifact): Map<String, ByteArray>

Extract all entries from a zip artifact into a Map<entryName, bytes>. Used by the DFU handler to parse Nordic DFU packages.

Link copied to clipboard
open suspend override fun fetchText(url: String): String?

Fetch the UTF-8 text body of url, returning null on any HTTP or network error.

Link copied to clipboard
open suspend override fun getFileSize(file: FirmwareArtifact): Long

Return the size in bytes of the given firmware file.

Link copied to clipboard
open suspend override fun importFromUri(uri: CommonUri): FirmwareArtifact?

Copy a platform URI into a temporary FirmwareArtifact so it can be read with readBytes. Returns null when the URI cannot be resolved.

Link copied to clipboard
open suspend override fun readBytes(artifact: FirmwareArtifact): ByteArray

Read the raw bytes of a FirmwareArtifact.