react-native-gizwits-sdk-v5 1.5.8-thirdbluetooth → 1.5.9-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.
|
@@ -28,4 +28,6 @@ RCT_EXTERN_METHOD(stopProvideWiFiCredentialsWithAirLink:(RCTResponseSenderBlock)
|
|
|
28
28
|
|
|
29
29
|
RCT_EXTERN_METHOD(startMusicalRhythm:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
30
30
|
RCT_EXTERN_METHOD(stopMusicalRhythm:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
31
|
+
RCT_EXTERN_METHOD(setDeviceMtu:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
32
|
+
RCT_EXTERN_METHOD(sendThirdDeviceDp:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
31
33
|
@end
|
|
@@ -565,14 +565,17 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
565
565
|
public func setDeviceMtu(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
|
|
566
566
|
if let params = RNGizParamsChecker.check(options: options, result: result, paramsType: SetDeviceMtuParams.self) {
|
|
567
567
|
// 先找到设备
|
|
568
|
-
|
|
569
|
-
Task {
|
|
570
|
-
var data = device.setDeviceMtu(params.mtu);
|
|
571
|
-
GizRNCallbackManager.callbackWithResult(callback: result, result:GizResult<Int?, GizAPIException?>(successMessage: "", data: nil))
|
|
572
|
-
}
|
|
573
|
-
} else {
|
|
574
|
-
// 提示设备不存在
|
|
568
|
+
guard let device = findDevice(id: params.id) else {
|
|
575
569
|
GizRNCallbackManager.callbackWithResult(callback: result, result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_OPENAPI_DEVICE_NOT_FOUND))
|
|
570
|
+
return
|
|
571
|
+
}
|
|
572
|
+
Task {
|
|
573
|
+
do {
|
|
574
|
+
var data = device.bleCapability.setDeviceMtu(mtu: params.mtu)
|
|
575
|
+
GizRNCallbackManager.callbackWithResult(callback: result, result: data)
|
|
576
|
+
} catch {
|
|
577
|
+
GizRNCallbackManager.callbackWithResult(callback: result, result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_SDK_PARAM_INVALID))
|
|
578
|
+
}
|
|
576
579
|
}
|
|
577
580
|
|
|
578
581
|
}
|
|
@@ -582,7 +585,7 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
582
585
|
public func sendThirdDeviceDp(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
|
|
583
586
|
if let params = RNGizParamsChecker.check(options: options, result: result, paramsType: SendThirdDeviceDpParams.self) {
|
|
584
587
|
// 先找到设备
|
|
585
|
-
guard let device = findDevice(id: params.id)
|
|
588
|
+
guard let device = findDevice(id: params.id) else {
|
|
586
589
|
GizRNCallbackManager.callbackWithResult(callback: result, result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_OPENAPI_DEVICE_NOT_FOUND))
|
|
587
590
|
return
|
|
588
591
|
}
|
|
@@ -595,7 +598,7 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
595
598
|
if regex.firstMatch(in: params.data, options: [], range: range) == nil {
|
|
596
599
|
GizRNCallbackManager.callbackWithResult(
|
|
597
600
|
callback: result,
|
|
598
|
-
result: GizResult<Int?,
|
|
601
|
+
result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_SDK_PARAM_INVALID)
|
|
599
602
|
)
|
|
600
603
|
return
|
|
601
604
|
}
|
|
@@ -603,7 +606,7 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
603
606
|
if params.data.count % 2 != 0 {
|
|
604
607
|
GizRNCallbackManager.callbackWithResult(
|
|
605
608
|
callback: result,
|
|
606
|
-
result: GizResult<Int?,
|
|
609
|
+
result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_SDK_PARAM_INVALID)
|
|
607
610
|
)
|
|
608
611
|
return
|
|
609
612
|
}
|
|
@@ -618,19 +621,19 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
618
621
|
} else {
|
|
619
622
|
GizRNCallbackManager.callbackWithResult(
|
|
620
623
|
callback: result,
|
|
621
|
-
result: GizResult<Int?,
|
|
624
|
+
result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_SDK_PARAM_INVALID)
|
|
622
625
|
)
|
|
623
626
|
return
|
|
624
627
|
}
|
|
625
628
|
index = nextIndex
|
|
626
629
|
}
|
|
627
630
|
|
|
628
|
-
let res = await
|
|
631
|
+
let res = await device.bleCapability.sendThirdDeviceDp(data: rawData, characteristicUuid: params.characteristicUuid)
|
|
629
632
|
GizRNCallbackManager.callbackWithResult(callback: result, result: res)
|
|
630
633
|
} catch {
|
|
631
634
|
GizRNCallbackManager.callbackWithResult(
|
|
632
635
|
callback: result,
|
|
633
|
-
result: GizResult<Int?,
|
|
636
|
+
result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_SDK_PARAM_INVALID)
|
|
634
637
|
)
|
|
635
638
|
}
|
|
636
639
|
}
|
package/package.json
CHANGED