代码拉取完成,页面将自动刷新
This library allows you to do a Device Firmware Update (DFU) of your nrf51 or nrf52 chip from Nordic Semiconductor. It works for Android and iOS fine.
This is the implementation of the reference "react-native-nordic-dfu"
For more info about the DFU process, see: Resources
Add you dfu zip file to example/assets/file.zip
Run example project
Scan device
Start dfu
You can pass a absolute file path or asset file to FlutterNordicDfu
/// You can define your ProgressListenerListener
await FlutterNordicDfu.startDfu(
'EB:75:AD:E3:CA:CF', '/file/to/zip/path/file.zip',
progressListener: ProgressListenerListener(),
);
class ProgressListenerListener extends DfuProgressListenerAdapter {
@override
void onProgressChanged(String deviceAddress, int percent, double speed,
double avgSpeed, int currentPart, int partsTotal) {
super.onProgressChanged(
deviceAddress, percent, speed, avgSpeed, currentPart, partsTotal);
print('deviceAddress: $deviceAddress, percent: $percent');
}
}
/// Or you can use DefaultDfuProgressListenerAdapter
await FlutterNordicDfu.startDfu(
'EB:75:AD:E3:CA:CF',
'assets/file.zip',
fileInAsset: true,
progressListener:
DefaultDfuProgressListenerAdapter(onProgressChangedHandle: (
deviceAddress,
percent,
speed,
avgSpeed,
currentPart,
partsTotal,
) {
print('deviceAddress: $deviceAddress, percent: $percent');
}),
);
/// just set [fileInAsset] true
await FlutterNordicDfu.startDfu(
'EB:75:AD:E3:CA:CF', 'assets/file.zip',
progressListener: ProgressListenerListener(),
fileInAsset: true,
);
class ProgressListenerListener extends DfuProgressListenerAdapter {
@override
void onProgressChanged(String deviceAddress, int percent, double speed,
double avgSpeed, int currentPart, int partsTotal) {
super.onProgressChanged(
deviceAddress, percent, speed, avgSpeed, currentPart, partsTotal);
print('deviceAddress: $deviceAddress, percent: $percent');
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。