react-native-gizwits-sdk-v5 1.3.35 → 1.3.36
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.
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@interface RCT_EXTERN_MODULE(RNGizDeviceManagerModule, NSObject)
|
|
11
11
|
|
|
12
12
|
RCT_EXTERN_METHOD(connect:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
13
|
+
RCT_EXTERN_METHOD(disConnect:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
13
14
|
RCT_EXTERN_METHOD(sendDp:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
14
15
|
RCT_EXTERN_METHOD(getDp:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
15
16
|
RCT_EXTERN_METHOD(getDeviceInfo:(NSDictionary *)options result:(RCTResponseSenderBlock)result)
|
|
@@ -347,6 +347,35 @@ class RNGizDeviceManagerModule: RCTEventEmitter {
|
|
|
347
347
|
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
+
@objc
|
|
351
|
+
public func disConnect(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
|
|
352
|
+
if let params = RNGizParamsChecker.check(options: options, result: result, paramsType: ConnectParams.self) {
|
|
353
|
+
// 先找到设备
|
|
354
|
+
if let device = findDevice(id: params.id) {
|
|
355
|
+
Task {
|
|
356
|
+
var data: GizResult<Int?, GizConnectException?>
|
|
357
|
+
switch(params.type) {
|
|
358
|
+
case .GizBleCapability:
|
|
359
|
+
data = await device.bleCapability.disConnect()
|
|
360
|
+
break
|
|
361
|
+
case .GizLanCapability:
|
|
362
|
+
data = await device.lanCapability.disConnect()
|
|
363
|
+
break
|
|
364
|
+
case .GizMQTTCapability:
|
|
365
|
+
data = await device.mqttCapability.disConnect()
|
|
366
|
+
break
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
GizRNCallbackManager.callbackWithResult(callback: result, result:data)
|
|
370
|
+
|
|
371
|
+
}
|
|
372
|
+
} else {
|
|
373
|
+
// 提示设备不存在
|
|
374
|
+
GizRNCallbackManager.callbackWithResult(callback: result, result: GizResult<Int?, GizAPIException?>(error: GizAPIException.GIZ_OPENAPI_DEVICE_NOT_FOUND))
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
}
|
|
378
|
+
}
|
|
350
379
|
|
|
351
380
|
@objc
|
|
352
381
|
public func provideWiFiCredentials(_ options: NSDictionary, result: @escaping RCTResponseSenderBlock) {
|