public class DfuServiceListenerHelper extends Object
DfuProgressListener should be registered to listen for DFU status updates and errors,
while the DfuLogListener listener receives the log updates.
Listeners may be registered for a specified device (given with device address) or for any device.
Keep in mind, that while updating the SoftDevice using the buttonless update the device may
change its address in the bootloader mode.
Use registerProgressListener(Context, DfuProgressListener) or
registerLogListener(Context, DfuLogListener) to register your listeners.
Remember about unregistering them when your context is destroyed.
| Constructor and Description |
|---|
DfuServiceListenerHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
registerLogListener(Context context,
DfuLogListener listener)
Registers the
DfuLogListener. |
static void |
registerLogListener(Context context,
DfuLogListener listener,
String deviceAddress)
Registers the
DfuLogListener. |
static void |
registerProgressListener(Context context,
DfuProgressListener listener)
Registers the
DfuProgressListener. |
static void |
registerProgressListener(Context context,
DfuProgressListener listener,
String deviceAddress)
Registers the
DfuProgressListener. |
static void |
unregisterLogListener(Context context,
DfuLogListener listener)
Unregisters the previously registered log listener.
|
static void |
unregisterProgressListener(Context context,
DfuProgressListener listener)
Unregisters the previously registered progress listener.
|
public static void registerProgressListener(Context context, DfuProgressListener listener)
DfuProgressListener.
Registered listener will receive the progress events from the DFU service.context - the application context.listener - the listener to register.public static void registerProgressListener(Context context, DfuProgressListener listener, String deviceAddress)
DfuProgressListener. Registered listener will receive the progress
events from the DFU service.context - the application context.listener - the listener to register.deviceAddress - the address of the device to receive updates from (or null if any device).public static void unregisterProgressListener(Context context, DfuProgressListener listener)
context - the application context.listener - the listener to unregister.public static void registerLogListener(Context context, DfuLogListener listener)
DfuLogListener. Registered listener will receive the log events from the DFU service.context - the application context.listener - the listener to register.public static void registerLogListener(Context context, DfuLogListener listener, String deviceAddress)
DfuLogListener. Registered listener will receive the log events from
the DFU service.context - the application context.listener - the listener to register.deviceAddress - the address of the device to receive updates from (or null if any device).public static void unregisterLogListener(Context context, DfuLogListener listener)
context - the application context.listener - the listener to unregister.