@@ -26,26 +26,35 @@ pnpm install @playerdata/react-native-mcu-manager
26
26
27
27
Run ` npx pod-install ` after installing the pnpm package.
28
28
29
-
30
29
### Configure for Android
31
30
32
31
## Usage
32
+
33
33
``` ts
34
- import McuManager , { ProgressEvent , UploadEvents } from ' @playerdata/react-native-mcu-manager' ;
34
+ import McuManager , {
35
+ UpgradeOptions ,
36
+ } from ' @playerdata/react-native-mcu-manager' ;
35
37
36
- const onUploadProgress = ( progress : ProgressEvent ) => {
37
- console . log ( " Upload progress: " , progress . bleId , progress . progress );
38
+ const upgradeOptions : UpgradeOptions = {
39
+ estimatedSwapTime: 30 ,
38
40
};
39
41
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 );
42
44
};
43
45
44
- UploadEvents .addListener (' uploadProgress' , onUploadProgress );
45
- UploadEvents .addListener (' uploadStateChanged' , onUploadStateChanged );
46
+ const onUploadStateChanged = (state : string ) => {
47
+ console .log (' Upload state change: ' , state );
48
+ };
46
49
47
50
// 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
+ );
49
58
```
50
59
51
60
# Contributing
0 commit comments