react-native-gizwits-sdk-v5 1.5.2-thirdbluetooth → 1.5.3-thirdbluetooth
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/src/main/java/com/gizwits/reactnativegizwitssdkv5/RNGizDeviceManagerModule.kt
CHANGED
|
@@ -16,7 +16,6 @@ import com.gizwits.smart.sdk.common.GizWiFiActivatorEvent
|
|
|
16
16
|
import com.gizwits.smart.sdk.core.capacity.CapacityTypes
|
|
17
17
|
import com.gizwits.smart.sdk.exception.GizException
|
|
18
18
|
import com.gizwits.smart.sdk.extend.hexToByteArray
|
|
19
|
-
import android.util.Base64
|
|
20
19
|
import com.gizwits.smart.sdk.lan.lanCapability
|
|
21
20
|
import com.gizwits.smart.sdk.mqtt.mqttCapability
|
|
22
21
|
import com.gizwits.smart.sdk.light.MusicalRhythmParseMode
|
|
@@ -571,20 +570,26 @@ fun wiFiCredentialsWithAirLinkEventHandler(event: GizWiFiActivatorEvent) {
|
|
|
571
570
|
moduleScope.launch {
|
|
572
571
|
try {
|
|
573
572
|
// 第三方设备直接透传原始数据,使用特殊键 "rawData" 标识原始数据
|
|
574
|
-
//
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
573
|
+
// 只支持十六进制字符串格式(只包含 0-9A-Fa-f,且长度为偶数)
|
|
574
|
+
if (!config.data.matches(Regex("^[0-9A-Fa-f]+$"))) {
|
|
575
|
+
GizRNCallbackManager.callbackWithResult(
|
|
576
|
+
callback = result,
|
|
577
|
+
result = Result.failure<Unit>(IllegalArgumentException("Data must be a valid hexadecimal string (0-9A-Fa-f only)"))
|
|
578
|
+
)
|
|
579
|
+
return@launch
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
if (config.data.length % 2 != 0) {
|
|
583
|
+
GizRNCallbackManager.callbackWithResult(
|
|
584
|
+
callback = result,
|
|
585
|
+
result = Result.failure<Unit>(IllegalArgumentException("Hex string length must be even"))
|
|
586
|
+
)
|
|
587
|
+
return@launch
|
|
586
588
|
}
|
|
587
589
|
|
|
590
|
+
// 使用十六进制解码
|
|
591
|
+
val rawData: ByteArray = config.data.hexToByteArray()
|
|
592
|
+
|
|
588
593
|
// 使用特殊键 "rawData" 传递原始数据,sendThirdDeviceDp 会识别并直接透传
|
|
589
594
|
val res = device.sendThirdDeviceDp("rawData" to rawData, characteristicUuid = config.characteristicUuid)
|
|
590
595
|
GizRNCallbackManager.callbackWithResult(callback = result, result = res)
|
package/package.json
CHANGED