mini_program_gizwits_sdk 3.7.0-kuka → 3.7.1-beta
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 +96 -25
- package/{index.ts → dist/index.d.ts} +3 -3
- package/dist/index.js +5 -5
- package/docs/ble-bssid.md +38 -0
- package/global.d.ts +3 -19
- package/package.json +6 -5
- package/yarn-error.log +34 -34
- package/src/GizLog.ts +0 -51
- package/src/aepApi/aepApiRequest.ts +0 -61
- package/src/crc/calculators/crc16modbus.ts +0 -36
- package/src/crc/calculators/crc32.ts +0 -47
- package/src/crc/crc16modbus.ts +0 -3
- package/src/crc/crc32.ts +0 -4
- package/src/crc/create_buffer.ts +0 -7
- package/src/crc/define_crc.ts +0 -9
- package/src/crc/index.ts +0 -10
- package/src/crc/package.json +0 -3
- package/src/crc/types.ts +0 -10
- package/src/errorCode.ts +0 -84
- package/src/global.d.ts +0 -53
- package/src/globalData.ts +0 -9
- package/src/handler/EventListener.ts +0 -44
- package/src/handler/ble.ts +0 -1485
- package/src/handler/lan.ts +0 -409
- package/src/handler/socket.ts +0 -625
- package/src/openApiRequest.ts +0 -62
- package/src/productConfigFileManage.ts +0 -58
- package/src/protocol/Bind.ts +0 -22
- package/src/protocol/DeviceInfo.ts +0 -36
- package/src/protocol/DiscoverUDP.ts +0 -80
- package/src/protocol/GetDeviceStatus.ts +0 -63
- package/src/protocol/Login.ts +0 -43
- package/src/protocol/Ntp.ts +0 -13
- package/src/protocol/OTA/AwaitNoti.ts +0 -14
- package/src/protocol/OTA/CheckCanOTA.ts +0 -23
- package/src/protocol/OTA/OTAPackPackage.ts +0 -36
- package/src/protocol/OTA/OtaComplete.ts +0 -17
- package/src/protocol/OTA/PreOTA.ts +0 -47
- package/src/protocol/OTA/ResetPosition.ts +0 -14
- package/src/protocol/OffLineData.ts +0 -81
- package/src/protocol/ProtocolBase.ts +0 -54
- package/src/protocol/Reset.ts +0 -15
- package/src/protocol/SetReset.ts +0 -11
- package/src/protocol/WifiConfig.ts +0 -42
- package/src/protocol/dataPoint.ts +0 -769
- package/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.ts +0 -39
- package/src/protocol/tool.ts +0 -147
- package/src/randomCode.ts +0 -36
- package/src/request.ts +0 -22
- package/src/sdk.ts +0 -1472
- package/src/sentry.ts +0 -55
- package/src/services/devices.ts +0 -309
- package/src/services/login.ts +0 -15
- package/src/services/ota.ts +0 -30
- package/src/services/tool.ts +0 -10
- package/src/services/uploadP0.ts +0 -56
- package/src/sleep.ts +0 -2
- package/src/types/index.ts +0 -48
- package/src/utils.ts +0 -419
- package/src/wechatApi.ts +0 -210
- package/src/wifiConfig/ConfigBase.ts +0 -185
- package/src/wifiConfig/ap.ts +0 -192
- package/src/wifiConfig/ble.ts +0 -436
- package/src/wifiConfig/ble_ailCloud.ts +0 -554
package/src/errorCode.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
interface IErrorCode {
|
|
2
|
-
[key: string]: IError;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
const errorCode: IErrorCode = {
|
|
6
|
-
GIZ_OPENAPI_DEVICE_NOT_BOUND: {
|
|
7
|
-
errorCode: 9017,
|
|
8
|
-
errorMessage: 'not bind',
|
|
9
|
-
},
|
|
10
|
-
GIZ_SDK_HTTP_REQUEST_FAILED: {
|
|
11
|
-
errorCode: 8099,
|
|
12
|
-
errorMessage: '网络请求失败',
|
|
13
|
-
},
|
|
14
|
-
GIZ_SDK_DEVICE_NO_RESPONSE: {
|
|
15
|
-
errorCode: 8030,
|
|
16
|
-
errorMessage: '设备未响应',
|
|
17
|
-
},
|
|
18
|
-
GIZ_SDK_SDK_NOT_INITIALIZED: {
|
|
19
|
-
errorCode: 8300,
|
|
20
|
-
errorMessage: 'not init',
|
|
21
|
-
},
|
|
22
|
-
CONFIG_TIME_OUT: {
|
|
23
|
-
errorCode: 8023,
|
|
24
|
-
errorMessage: 'Config Timeout',
|
|
25
|
-
},
|
|
26
|
-
WECHAT_ERROR: {
|
|
27
|
-
errorCode: 10000,
|
|
28
|
-
errorMessage: 'wechat error',
|
|
29
|
-
},
|
|
30
|
-
GIZ_SDK_ONBOARDING_STOPPED: {
|
|
31
|
-
errorCode: 8318,
|
|
32
|
-
errorMessage: '配网中断',
|
|
33
|
-
},
|
|
34
|
-
GIZ_SDK_DEVICE_CONFIG_IS_RUNNING: {
|
|
35
|
-
errorCode: 8022,
|
|
36
|
-
errorMessage: '配置正在进行中',
|
|
37
|
-
},
|
|
38
|
-
GIZ_OPENAPI_TOKEN_INVALID: {
|
|
39
|
-
errorCode: 9004,
|
|
40
|
-
errorMessage: 'token 失效',
|
|
41
|
-
},
|
|
42
|
-
GIZ_SDK_BIND_DEVICE_FAILED: {
|
|
43
|
-
errorCode: 8039,
|
|
44
|
-
errorMessage: '设备绑定失败',
|
|
45
|
-
},
|
|
46
|
-
GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON: {
|
|
47
|
-
errorCode: 8281,
|
|
48
|
-
errorMessage: '蓝牙未启用',
|
|
49
|
-
},
|
|
50
|
-
GIZ_SDK_OTHERWISE: {
|
|
51
|
-
errorCode: 8100,
|
|
52
|
-
errorMessage: '',
|
|
53
|
-
},
|
|
54
|
-
GIZ_SDK_DEVICE_NOT_SUBSCRIBED: {
|
|
55
|
-
errorCode: 8029,
|
|
56
|
-
errorMessage: '设备还未订阅',
|
|
57
|
-
},
|
|
58
|
-
GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY: {
|
|
59
|
-
errorCode: 8250,
|
|
60
|
-
errorMessage: '产品类型不在指定范围内',
|
|
61
|
-
},
|
|
62
|
-
GIZ_SDK_LOG_LEVEL_INVALID: {
|
|
63
|
-
errorCode: 8009,
|
|
64
|
-
errorMessage: '产品类型不在指定范围内',
|
|
65
|
-
},
|
|
66
|
-
GIZ_SDK_OTA_DEVICE_NOT_SUPPORT: {
|
|
67
|
-
errorCode: 8360,
|
|
68
|
-
errorMessage: '设备不支持手机OTA升级',
|
|
69
|
-
},
|
|
70
|
-
GIZ_SDK_OTA_DEVICE_BUSY_IN_UPGRADE: {
|
|
71
|
-
errorCode: 8354,
|
|
72
|
-
errorMessage: '设备忙,固件正在升级',
|
|
73
|
-
},
|
|
74
|
-
GIZ_SDK_OTA_FIRMWARE_DOWNLOAD_FAILED: {
|
|
75
|
-
errorCode: 8353,
|
|
76
|
-
errorMessage: '固件下载失败',
|
|
77
|
-
},
|
|
78
|
-
GIZ_SDK_OTA_FIRMWARE_TYPE_NOT_MATCH: {
|
|
79
|
-
errorCode: 8361,
|
|
80
|
-
errorMessage: '蓝牙OTA设备返回的固件类型与当前要升级的固件类型不匹配',
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default errorCode;
|
package/src/global.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
interface IError {
|
|
2
|
-
errorCode: number;
|
|
3
|
-
errorMessage?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
interface ICommonObj {
|
|
7
|
-
[key: string]: any
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface IDeviceStatusChangedProps {
|
|
11
|
-
did: string;
|
|
12
|
-
attrs: ICommonObj;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface IDeviceRawStatusChangedProps {
|
|
16
|
-
did: string;
|
|
17
|
-
raw: Uint8Array;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface IOnDeviceStatusChanged {
|
|
21
|
-
(data: IDeviceStatusChangedProps | IDeviceRawStatusChangedProps): void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface IOnSocketStatusChanged {
|
|
25
|
-
(dids: string[], enabled: boolean): void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface IEmptyFn {
|
|
29
|
-
(): void;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface IDevice {
|
|
33
|
-
mac: string;
|
|
34
|
-
productKey: string;
|
|
35
|
-
did: string;
|
|
36
|
-
bleWorkStatus?: number; // 0 默认状态 1 配网状态
|
|
37
|
-
name: string;
|
|
38
|
-
isBind: boolean;
|
|
39
|
-
rootDeviceId?: string;
|
|
40
|
-
bleDeviceID?: string;
|
|
41
|
-
remark?: string;
|
|
42
|
-
passcode?: string;
|
|
43
|
-
connectType: TConnectType;
|
|
44
|
-
isOnline: boolean; // 代表大循环在线
|
|
45
|
-
isLanOnline: boolean; // 代表小循环在线
|
|
46
|
-
isBleOnline: boolean; // 代表蓝牙在线
|
|
47
|
-
host?: string;
|
|
48
|
-
wss_port?: number;
|
|
49
|
-
ctime?: number;
|
|
50
|
-
RSSI?: number; // 蓝牙信号强度
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';
|
package/src/globalData.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export default class EventListener<T> {
|
|
2
|
-
public listenerMap: any = {};
|
|
3
|
-
public addEventListener = async <K extends keyof T>(
|
|
4
|
-
type: K,
|
|
5
|
-
func: T[K]
|
|
6
|
-
) => {
|
|
7
|
-
if (!this.listenerMap[type]) {
|
|
8
|
-
// 创建一个新的
|
|
9
|
-
this.listenerMap[type] = [];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (this.listenerMap[type].indexOf(func) === -1) {
|
|
13
|
-
this.listenerMap[type].push(func);
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
success: true,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 移除事件监听
|
|
22
|
-
* @param type 事件监听名称,详见下表
|
|
23
|
-
* @param func 事件监听回调
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
public removeEventListener = <K extends keyof T>(
|
|
27
|
-
type: K,
|
|
28
|
-
func: T[K]
|
|
29
|
-
) => {
|
|
30
|
-
if (this.listenerMap[type]) {
|
|
31
|
-
const index = this.listenerMap[type].indexOf(func);
|
|
32
|
-
if (index !== -1) {
|
|
33
|
-
// 删除数组中的这一行
|
|
34
|
-
this.listenerMap[type].splice(index, 1);
|
|
35
|
-
return {
|
|
36
|
-
success: true,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
success: false,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
}
|