react-native-gizwits-sdk-v5 1.3.95 → 1.3.96
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/README.md +58 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Tabs, Tab, Callout } from 'nextra/components'
|
|
2
|
+
|
|
3
|
+
# API 文档
|
|
4
|
+
|
|
5
|
+
[API文档](https://sdkdoc.gizwits.com/rn/basic)
|
|
6
|
+
|
|
7
|
+
# 基本概念
|
|
8
|
+
|
|
9
|
+
## 设备对象
|
|
10
|
+
根据通讯方式来区分,模组有以下几种通讯方式
|
|
11
|
+
|
|
12
|
+
* 蓝牙
|
|
13
|
+
* 局域网
|
|
14
|
+
* mqtt
|
|
15
|
+
|
|
16
|
+
对应的,在SDK,设备就衍生出了三种能力
|
|
17
|
+
|
|
18
|
+
* bleCapability
|
|
19
|
+
* lanCapability
|
|
20
|
+
* mqttCapability
|
|
21
|
+
|
|
22
|
+
<img style={{maxWidth: '400px'}} src='https://goms-1251025085.cos.ap-guangzhou.myqcloud.com/gizwits_docs/tuozhan.png' alt=""/>
|
|
23
|
+
|
|
24
|
+
这三个能力都继承于 GizBaseCapability,都实现了控制、连接等功能。在开发的过程中您可以自由的选择连接某个通道,对某个通道下发指令。
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
// ble
|
|
28
|
+
await device.bleCapability.connect()
|
|
29
|
+
device.bleCapability.getDp()
|
|
30
|
+
|
|
31
|
+
// mqtt
|
|
32
|
+
await device.mqttCapability.connect()
|
|
33
|
+
device.mqttCapability.getDp()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 连接的云服务
|
|
37
|
+
初始化sdk的时候,您可以手动选择连接的云
|
|
38
|
+
* api.gizwits.com 大陆
|
|
39
|
+
* euapi.gizwits.com 欧洲地区
|
|
40
|
+
* usapi.gizwits.com 美东地区
|
|
41
|
+
```javascript
|
|
42
|
+
import RNGizSDKManagerModule from 'react-native-gizwits-sdk-v5';
|
|
43
|
+
let data = await RNGizSDKManagerModule.initSDK({
|
|
44
|
+
appID: 'xxx',
|
|
45
|
+
appSecret: 'xxx',
|
|
46
|
+
productInfos: [
|
|
47
|
+
{
|
|
48
|
+
productKey: 'xxx',
|
|
49
|
+
productSecret: 'xxx',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
serverInfo: {
|
|
53
|
+
openAPIInfo: "api.gizwits.com"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
如果不填写,将会按照客户端所在的地区自动选择
|