react-native-gizwits-sdk-v5 1.3.59 → 1.3.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -63,10 +63,10 @@ dependencies {
|
|
|
63
63
|
|
|
64
64
|
implementation "androidx.startup:startup-runtime:$startup_version"
|
|
65
65
|
|
|
66
|
-
implementation("io.github.gizwits:sdk:1.0.
|
|
67
|
-
implementation("io.github.gizwits:sdk-bluetooth:1.0.
|
|
68
|
-
implementation("io.github.gizwits:sdk-lan:1.0.
|
|
69
|
-
implementation("io.github.gizwits:sdk-mqtt:1.0.
|
|
66
|
+
implementation("io.github.gizwits:sdk:1.0.48")
|
|
67
|
+
implementation("io.github.gizwits:sdk-bluetooth:1.0.48")
|
|
68
|
+
implementation("io.github.gizwits:sdk-lan:1.0.48")
|
|
69
|
+
implementation("io.github.gizwits:sdk-mqtt:1.0.48")
|
|
70
70
|
|
|
71
71
|
// implementation files('libs/sdk-release.aar', 'libs/sdk-bluetooth-release.aar', 'libs/sdk-lan-release.aar', 'libs/sdk-mqtt-release.aar')
|
|
72
72
|
|
package/android/src/main/java/com/gizwits/reactnativegizwitssdkv5/RNGizDeviceManagerModule.kt
CHANGED
|
@@ -336,13 +336,16 @@ class RNGizDeviceManagerModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
fun handleStartUpgradeProgress(event: OTAProgressData, device: GizDevice) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
val jsonObject = JSONObject()
|
|
340
|
+
val dataObject = JSONObject()
|
|
341
|
+
dataObject.put("percentage", event.percentage)
|
|
342
|
+
dataObject.put("event", event.event.value)
|
|
343
|
+
jsonObject.put("data", dataObject)
|
|
344
|
+
jsonObject.put("device", device.toJsonObject())
|
|
345
|
+
sendEvent(
|
|
346
|
+
EventName.GizOTAProgressEvent.name,
|
|
347
|
+
GizRNCallbackManager.jsonObject2WriteableMap(jsonObject)
|
|
348
|
+
)
|
|
346
349
|
}
|
|
347
350
|
@ReactMethod
|
|
348
351
|
fun startUpgrade(options: ReadableMap, result: Callback) {
|
|
@@ -350,9 +353,11 @@ class RNGizDeviceManagerModule(reactContext: ReactApplicationContext) : ReactCon
|
|
|
350
353
|
if (config !=null && device !=null) {
|
|
351
354
|
CoroutineScope(Dispatchers.Main).launch {
|
|
352
355
|
val res = when(config.type) {
|
|
353
|
-
CapacityTypes.BLE ->
|
|
356
|
+
CapacityTypes.BLE -> {
|
|
357
|
+
device.bleCapacity.startUpgrade(config.firmwareType, processHandler = {
|
|
354
358
|
handleStartUpgradeProgress(it, device)
|
|
355
|
-
|
|
359
|
+
})
|
|
360
|
+
}
|
|
356
361
|
CapacityTypes.LAN -> device.lanCapacity.startUpgrade(config.firmwareType, processHandler = {
|
|
357
362
|
handleStartUpgradeProgress(it, device)
|
|
358
363
|
})
|