References
- Reading and writing the current device firmware by DFU 1.1
- Switching from the runtime configuration to the DFU bootloader (DFU detach)
npm i @hakkei/webdfu
Full example in: webdfu/demo
Demo: https://dfu.hakkei.wiki
events
: An instance ofNanoEvents
that can be used to listen for different events, such asinit
,connect
, anddisconnect
.interfaces
: An array ofWebDFUSettings
objects representing the DFU interfaces present on the device.properties
: An object containing the properties of the DFU functional descriptor, if present.connected
: A boolean indicating whether the class is currently connected to a device.currentInterfaceSettings
: The settings of the currently selected DFU interface.
Creates a new instance of the WebDFU
class.
Returns the type of DFU interface, either WebDFUType.DFU
or WebDFUType.SDFUse
Initializes the class by finding the DFU interfaces present on the device.
Connects to the specified DFU interface on the device. Throws an error if the interface is not found or if there is an error connecting.
Closes the connection to the device and emits a disconnect
event.
Reads data from the device with a specified transfer size and maximum size. Returns a WebDFUProcessRead
object that can be used to listen for events such as end
and error
.
Writes data to the device with a specified transfer size and a boolean indicating whether the write should be manifestation tolerant. Returns a WebDFUProcessWrite
object that can be used to listen for events such as end
and error
.
Attempts to read the DFU functional descriptor from the device. Returns an object containing the properties of the descriptor, or null
if the descriptor is not present.
Searches for DFU interfaces on the device and returns an array of WebDFUSettings
objects.
Forces the interface names of the device if specified by the settings.
Reads the string descriptor with the specified index and language ID from the device. Returns the descriptor as an array of 16-bit words if langID is 0, otherwise returns the descriptor as a string.
Reads the device descriptor from the device. Returns a DataView object.
Reads the interface names from the device and returns an object that maps the interface index to the corresponding interface name.