@@ -26,26 +26,35 @@ pnpm install @playerdata/react-native-mcu-manager
2626
2727Run ` npx pod-install ` after installing the pnpm package.
2828
29-
3029### Configure for Android
3130
3231## Usage
32+
3333``` ts
34- import McuManager , { ProgressEvent , UploadEvents } from ' @playerdata/react-native-mcu-manager' ;
34+ import McuManager , {
35+ UpgradeOptions ,
36+ } from ' @playerdata/react-native-mcu-manager' ;
3537
36- const onUploadProgress = ( progress : ProgressEvent ) => {
37- console . log ( " Upload progress: " , progress . bleId , progress . progress );
38+ const upgradeOptions : UpgradeOptions = {
39+ estimatedSwapTime: 30 ,
3840};
3941
40- const onUploadStateChanged = (progress : ProgressEvent ) => {
41- console .log (" Upload state change: " , progress . bleId , progress . state );
42+ const onUploadProgress = (progress : number ) => {
43+ console .log (' Upload progress: ' , progress );
4244};
4345
44- UploadEvents .addListener (' uploadProgress' , onUploadProgress );
45- UploadEvents .addListener (' uploadStateChanged' , onUploadStateChanged );
46+ const onUploadStateChanged = (state : string ) => {
47+ console .log (' Upload state change: ' , state );
48+ };
4649
4750// bluetoothId is a MAC address on Android, and a UUID on iOS
48- McuManager .updateDevice (bluetoothId , fileUri )
51+ McuManager .updateDevice (
52+ bluetoothId ,
53+ fileUri ,
54+ upgradeOptions ,
55+ onUploadProgress ,
56+ onUploadStateChanged
57+ );
4958```
5059
5160# Contributing
0 commit comments