You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -11,20 +11,31 @@ Install and link the NPM package per usual with
11
11
12
12
```bash
13
13
npm install --save react-native-nordic-dfu
14
+
```
15
+
16
+
or
17
+
18
+
```bash
19
+
yarn add react-native-nordic-dfu
20
+
```
21
+
22
+
For React Native below 60.0 version
23
+
24
+
```bash
14
25
react-native link react-native-nordic-dfu
15
26
```
16
27
17
28
### Minimum requirements
18
29
19
30
This project has been verified to work with the following dependencies, though other versions may work as well.
20
31
21
-
| Dependency | Version |
22
-
|-|-|
23
-
| React Native | 0.59.4 |
24
-
| XCode | 10.2 |
25
-
| Swift | 5.0 |
26
-
| CocoaPods | 1.6.1 |
27
-
| Gradle | 5.3.1 |
32
+
| Dependency | Version |
33
+
| ------------ | ------- |
34
+
| React Native | 0.59.4 |
35
+
| XCode | 10.2|
36
+
| Swift | 5.0|
37
+
| CocoaPods | 1.6.1|
38
+
| Gradle | 5.3.1|
28
39
29
40
### iOS
30
41
@@ -34,16 +45,23 @@ Previous versions supported manual linking, but this was prone to errors every t
34
45
35
46
#### CocoaPods
36
47
48
+
On your project directory;
49
+
50
+
```bash
51
+
cd ios && pod install
52
+
```
53
+
54
+
If your React Native version below 0.60 or any problem occures on pod command, you can try these steps;
55
+
37
56
Add the following to your `Podfile`
38
57
39
58
```ruby
40
59
target "YourApp"do
60
+
41
61
...
42
-
43
-
use_frameworks!
44
62
pod "react-native-nordic-dfu", path:"../node_modules/react-native-nordic-dfu"
45
-
46
63
...
64
+
47
65
end
48
66
```
49
67
@@ -55,6 +73,8 @@ pod install
55
73
56
74
Since there's native Swift dependencies you need to set which Swift version your project complies with. If you haven't already done this, open up your project with XCode and add a User-Defined setting under Build Settings: `SWIFT_VERSION = <your-swift-version>`.
57
75
76
+
If your React Native version is higher than 0.60, probably it's already there.
77
+
58
78
#### Bluetooth integration
59
79
60
80
This library needs access to an instance of `CBCentralManager`, which you most likely will have instantiated already if you're using Bluetooth for other purposes than DFU in your project.
@@ -63,7 +83,50 @@ To integrate with your existing Bluetooth setup, call `[RNNordicDfu setCentralMa
63
83
64
84
If you want control over the `CBCentralManager` instance after the DFU process is done you might need to provide the `onDFUComplete` and `onDFUError` callbacks to transfer back delegate control.
On iOS side this library requires to BleManager module which that [react-native-ble-manager](https://github.com/innoveit/react-native-ble-manager) provides.
125
+
126
+
It required because;
127
+
128
+
- You need `BleManager.h` module on AppDelegate file for integration.
129
+
- You should call `BleManager.start()` (for once) before the trigger a DFU process on iOS or you will get error like [this issue](https://github.com/Pilloxa/react-native-nordic-dfu/issues/82).
-`obj.deviceAddress`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The `identifier`\* of the device that should be updated
94
-
-`obj.deviceName`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the device in the update notification (optional, default `null`)
95
-
-`obj.filePath`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The file system path to the zip-file used for updating
96
-
-`obj.alternativeAdvertisingNameEnabled`**[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Send unique name to device before it is switched into bootloader mode (iOS only) - defaults to `true`
-`obj.deviceAddress`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The `identifier`\* of the device that should be updated
157
+
-`obj.deviceName`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the device in the update notification (optional, default `null`)
158
+
-`obj.filePath`**[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** The file system path to the zip-file used for updating
159
+
-`obj.alternativeAdvertisingNameEnabled`**[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Send unique name to device before it is switched into bootloader mode (iOS only) - defaults to `true`
97
160
98
161
\*`identifier` — MAC address (Android) / UUID (iOS)
If your user will select the firmware file from local storage you should keep on mind some issues;
203
+
204
+
You can use [react-native-document-picker](https://github.com/Elyx0/react-native-document-picker) library for file selecting process.
205
+
206
+
### On iOS
207
+
208
+
You should select file type as `public.archive` or you will get null type error as like [this issue](https://github.com/Pilloxa/react-native-nordic-dfu/issues/100)
209
+
210
+
```js
211
+
DocumentPicker.pick({ type:"public.archive" });
132
212
```
133
213
214
+
If your device getting disconnect after enable DFU, you should set `false` value to `alternativeAdvertisingNameEnabled` prop while starting DFU.
215
+
216
+
```js
217
+
NordicDFU.startDFU({
218
+
deviceAddress:"XXXXXXXX-XXXX-XXXX-XXXX-XX",
219
+
filePath:firmwareFile.uri,
220
+
alternativeAdvertisingNameEnabled:false,
221
+
});
222
+
```
223
+
224
+
### On Android
225
+
226
+
Some Android versions directly selecting file may can cause errors. If you get any file error you should copy it to your local storage. Like cache directory.
227
+
228
+
You can use [react-native-fs](https://github.com/itinance/react-native-fs) for copying file.
-[How to create init packet](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling"Init packet handling")
163
-
-[nRF51 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/nRF51-DK"nRF51 DK") (compatible with Arduino Uno Revision 3)
164
-
-[nRF52 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF52-DK"nRF52 DK") (compatible with Arduino Uno Revision 3)
-[How to create init packet](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling"Init packet handling")
270
+
-[nRF51 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/nRF51-DK"nRF51 DK") (compatible with Arduino Uno Revision 3)
271
+
-[nRF52 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF52-DK"nRF52 DK") (compatible with Arduino Uno Revision 3)
0 commit comments