USB::DFU::Callbacks Class Referenceabstract

Applications must implement this class and pass an instance to Device::begin(). More...

#include <Device.h>

Public Types

using Alternate = DfuAlternateId
 

Public Member Functions

virtual uint32_t getTimeout (Alternate alt, dfu_state_t state)=0
 Invoked right before tud_dfu_download_cb() (state=DFU_DNBUSY) or tud_dfu_manifest_cb() (state=DFU_MANIFEST) More...
 
virtual void download (Alternate alt, uint32_t offset, const void *data, uint16_t length)=0
 Invoked when received DFU_DNLOAD (wLength>0) following by DFU_GETSTATUS (state=DFU_DNBUSY) requests. More...
 
virtual void manifest (Alternate alt)=0
 Invoked when download process is complete, received DFU_DNLOAD (wLength=0) following by DFU_GETSTATUS (state=Manifest) More...
 
virtual uint16_t upload (Alternate alt, uint32_t offset, void *data, uint16_t length)=0
 Invoked when received DFU_UPLOAD request Application must populate data with up to length bytes and return the number of written bytes. More...
 
virtual void abort (Alternate alt)=0
 Invoked when the Host has terminated a download or upload transfer. More...
 
virtual void detach ()=0
 Invoked when a DFU_DETACH request is received. More...
 

Detailed Description

Applications must implement this class and pass an instance to Device::begin().

Member Typedef Documentation

◆ Alternate

using USB::DFU::Callbacks::Alternate = DfuAlternateId

Member Function Documentation

◆ abort()

virtual void USB::DFU::Callbacks::abort ( Alternate  alt)
pure virtual

Invoked when the Host has terminated a download or upload transfer.

◆ detach()

virtual void USB::DFU::Callbacks::detach ( )
pure virtual

Invoked when a DFU_DETACH request is received.

◆ download()

virtual void USB::DFU::Callbacks::download ( Alternate  alt,
uint32_t  offset,
const void *  data,
uint16_t  length 
)
pure virtual

Invoked when received DFU_DNLOAD (wLength>0) following by DFU_GETSTATUS (state=DFU_DNBUSY) requests.

This callback could be returned before flashing op is complete (async). Once finished flashing, application must call complete()

◆ getTimeout()

virtual uint32_t USB::DFU::Callbacks::getTimeout ( Alternate  alt,
dfu_state_t  state 
)
pure virtual

Invoked right before tud_dfu_download_cb() (state=DFU_DNBUSY) or tud_dfu_manifest_cb() (state=DFU_MANIFEST)

Application return timeout in milliseconds (bwPollTimeout) for the next download/manifest operation. During this period, USB host won't try to communicate with us.

◆ manifest()

virtual void USB::DFU::Callbacks::manifest ( Alternate  alt)
pure virtual

Invoked when download process is complete, received DFU_DNLOAD (wLength=0) following by DFU_GETSTATUS (state=Manifest)

Application can do checksum, or actual flashing if buffered entire image previously. Once finished flashing, application must call Device::finishFlashing()

◆ upload()

virtual uint16_t USB::DFU::Callbacks::upload ( Alternate  alt,
uint32_t  offset,
void *  data,
uint16_t  length 
)
pure virtual

Invoked when received DFU_UPLOAD request Application must populate data with up to length bytes and return the number of written bytes.


The documentation for this class was generated from the following file: