mini_program_gizwits_sdk 3.6.4 → 3.6.5
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/dist/index.js +3 -3
- package/package.json +1 -1
- package/yarn-error.log +6901 -0
- package/dist/src/GizLog.d.ts +0 -18
- package/dist/src/crc/calculators/crc16modbus.d.ts +0 -2
- package/dist/src/crc/calculators/crc32.d.ts +0 -2
- package/dist/src/crc/crc16modbus.d.ts +0 -7
- package/dist/src/crc/crc32.d.ts +0 -7
- package/dist/src/crc/create_buffer.d.ts +0 -3
- package/dist/src/crc/define_crc.d.ts +0 -7
- package/dist/src/crc/index.d.ts +0 -19
- package/dist/src/crc/types.d.ts +0 -11
- package/dist/src/errorCode.d.ts +0 -3
- package/dist/src/globalData.d.ts +0 -2
- package/dist/src/handler/EventListener.d.ts +0 -9
- package/dist/src/handler/ble.d.ts +0 -105
- package/dist/src/handler/lan.d.ts +0 -78
- package/dist/src/handler/socket.d.ts +0 -151
- package/dist/src/openApiRequest.d.ts +0 -3
- package/dist/src/productConfigFileManage.d.ts +0 -11
- package/dist/src/protocol/Bind.d.ts +0 -7
- package/dist/src/protocol/DeviceInfo.d.ts +0 -11
- package/dist/src/protocol/DiscoverUDP.d.ts +0 -17
- package/dist/src/protocol/GetDeviceStatus.d.ts +0 -5
- package/dist/src/protocol/Login.d.ts +0 -12
- package/dist/src/protocol/Ntp.d.ts +0 -5
- package/dist/src/protocol/OTA/AwaitNoti.d.ts +0 -7
- package/dist/src/protocol/OTA/CheckCanOTA.d.ts +0 -10
- package/dist/src/protocol/OTA/OTAPackPackage.d.ts +0 -8
- package/dist/src/protocol/OTA/OtaComplete.d.ts +0 -8
- package/dist/src/protocol/OTA/PreOTA.d.ts +0 -11
- package/dist/src/protocol/OTA/ResetPosition.d.ts +0 -6
- package/dist/src/protocol/OffLineData.d.ts +0 -23
- package/dist/src/protocol/ProtocolBase.d.ts +0 -11
- package/dist/src/protocol/Reset.d.ts +0 -8
- package/dist/src/protocol/SetReset.d.ts +0 -7
- package/dist/src/protocol/WifiConfig.d.ts +0 -6
- package/dist/src/protocol/dataPoint.d.ts +0 -34
- package/dist/src/protocol/tool.d.ts +0 -14
- package/dist/src/randomCode.d.ts +0 -3
- package/dist/src/request.d.ts +0 -1
- package/dist/src/sdk.d.ts +0 -136
- package/dist/src/sentry.d.ts +0 -2
- package/dist/src/services/devices.d.ts +0 -47
- package/dist/src/services/login.d.ts +0 -4
- package/dist/src/services/monitor.d.ts +0 -12
- package/dist/src/services/ota.d.ts +0 -7
- package/dist/src/services/tool.d.ts +0 -4
- package/dist/src/services/uploadP0.d.ts +0 -14
- package/dist/src/sleep.d.ts +0 -2
- package/dist/src/types/index.d.ts +0 -361
- package/dist/src/utils.d.ts +0 -46
- package/dist/src/wechatApi.d.ts +0 -19
- package/dist/src/wifiConfig/ConfigBase.d.ts +0 -27
- package/dist/src/wifiConfig/ap.d.ts +0 -11
- package/dist/src/wifiConfig/ble.d.ts +0 -41
- package/dist/src/wifiConfig/nfc/disposeData.d.ts +0 -2
- package/dist/src/wifiConfig/nfc/formatData.d.ts +0 -3
- package/dist/src/wifiConfig/nfc/formatSSID.d.ts +0 -6
- package/dist/src/wifiConfig/nfc/index.d.ts +0 -22
- package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +0 -6
- package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +0 -5
- package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +0 -1
- package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +0 -2
- package/dist/src/wifiConfig/nfc/types.d.ts +0 -15
- package/index.ts +0 -8
- package/src/GizLog.ts +0 -51
- 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 -83
- package/src/globalData.ts +0 -9
- package/src/handler/EventListener.ts +0 -44
- package/src/handler/ble.ts +0 -1369
- package/src/handler/lan.ts +0 -389
- package/src/handler/socket.ts +0 -686
- package/src/openApiRequest.ts +0 -50
- package/src/productConfigFileManage.ts +0 -72
- package/src/protocol/Bind.ts +0 -22
- package/src/protocol/DeviceInfo.ts +0 -37
- package/src/protocol/DiscoverUDP.ts +0 -80
- package/src/protocol/GetDeviceStatus.ts +0 -61
- 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 -37
- package/src/protocol/OTA/OtaComplete.ts +0 -17
- package/src/protocol/OTA/PreOTA.ts +0 -48
- 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 -16
- package/src/protocol/SetReset.ts +0 -13
- package/src/protocol/WifiConfig.ts +0 -42
- package/src/protocol/dataPoint.ts +0 -687
- package/src/protocol/tool.ts +0 -140
- package/src/randomCode.ts +0 -25
- package/src/request.ts +0 -22
- package/src/sdk.ts +0 -1536
- package/src/sentry.ts +0 -55
- package/src/services/devices.ts +0 -313
- package/src/services/login.ts +0 -11
- package/src/services/monitor.ts +0 -117
- package/src/services/ota.ts +0 -17
- package/src/services/tool.ts +0 -10
- package/src/services/uploadP0.ts +0 -57
- package/src/sleep.ts +0 -2
- package/src/types/index.ts +0 -456
- package/src/utils.ts +0 -449
- package/src/wechatApi.ts +0 -211
- package/src/wifiConfig/ConfigBase.ts +0 -235
- package/src/wifiConfig/ap.ts +0 -185
- package/src/wifiConfig/ble.ts +0 -460
- package/src/wifiConfig/nfc/disposeData.ts +0 -63
- package/src/wifiConfig/nfc/formatData.ts +0 -46
- package/src/wifiConfig/nfc/formatSSID.ts +0 -59
- package/src/wifiConfig/nfc/index.ts +0 -134
- package/src/wifiConfig/nfc/isIncludedCH.ts +0 -8
- package/src/wifiConfig/nfc/nfcAConnect.ts +0 -30
- package/src/wifiConfig/nfc/nfcATransceive.ts +0 -29
- package/src/wifiConfig/nfc/ssIDToASC.ts +0 -12
- package/src/wifiConfig/nfc/stringToGbk.ts +0 -51
- package/src/wifiConfig/nfc/transceive.wx.ts +0 -124
- package/src/wifiConfig/nfc/types.ts +0 -18
- package/src/wifiConfig/timeZoneName.json +0 -1
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
interface IRawData {
|
|
2
|
-
header: string;
|
|
3
|
-
len: string;
|
|
4
|
-
flag: string;
|
|
5
|
-
cmd: string;
|
|
6
|
-
sn: string;
|
|
7
|
-
action: string;
|
|
8
|
-
payload: string;
|
|
9
|
-
}
|
|
10
|
-
type messageType = 'APP2DEV' | 'DEV2APP' | 'UNKNOW';
|
|
11
|
-
export declare function getVariableLength(data: number[]): number[];
|
|
12
|
-
declare const unpack: (data: number[], pk: string) => Promise<{
|
|
13
|
-
kvData: {};
|
|
14
|
-
rawData: IRawData;
|
|
15
|
-
message: string;
|
|
16
|
-
messageType: messageType;
|
|
17
|
-
}>;
|
|
18
|
-
declare const pack: (data: object, pk: string) => Promise<{
|
|
19
|
-
data: number[];
|
|
20
|
-
raw: {
|
|
21
|
-
header: number[];
|
|
22
|
-
flag: number[];
|
|
23
|
-
len: number[];
|
|
24
|
-
headerCmd: number[];
|
|
25
|
-
sn: number[];
|
|
26
|
-
cmd: number[];
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
29
|
-
declare const padBoradcastData: (data: number[]) => string;
|
|
30
|
-
type TargetType = 'int' | 'string';
|
|
31
|
-
declare const formatEnum: (attrs: any, pk: string, targetType: TargetType) => Promise<any>;
|
|
32
|
-
type BTargetType = 'string' | 'object';
|
|
33
|
-
declare const formatBinary: (attrs: any, pk: string, targetType: BTargetType) => Promise<any>;
|
|
34
|
-
export { pack, unpack, padBoradcastData, formatEnum, formatBinary };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const checkHeader: (data: any) => number | false;
|
|
2
|
-
export declare const completeBlock: (cmd: string) => number[];
|
|
3
|
-
declare const getProtocolLen: (data: any) => number;
|
|
4
|
-
declare function arrayToString(arr: number[]): string;
|
|
5
|
-
export declare function arrayToASCII(arr: number[]): string;
|
|
6
|
-
declare const fillString: (string: string, num: number, foot?: boolean) => string;
|
|
7
|
-
declare const bytesToInt: (data: number[]) => number;
|
|
8
|
-
declare const bytesToHexString: (data: number[]) => string;
|
|
9
|
-
declare const string2Bytes: (str: string) => number[];
|
|
10
|
-
declare const hexStrint2byte: (str: string) => number[];
|
|
11
|
-
declare const formatCode: (str: any) => number[];
|
|
12
|
-
declare const formatCodesFromStr: (str: string) => number[][];
|
|
13
|
-
declare const arrayToUint8: (config: number[]) => Uint8Array;
|
|
14
|
-
export { checkHeader, getProtocolLen, arrayToString, fillString, string2Bytes, hexStrint2byte, formatCodesFromStr, formatCode, arrayToUint8, bytesToInt, bytesToHexString };
|
package/dist/src/randomCode.d.ts
DELETED
package/dist/src/request.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function request<T>(url: string, options: any): Promise<T>;
|
package/dist/src/sdk.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { TLogType } from './GizLog';
|
|
2
|
-
import { ISafeRegisterReturn, IUnbindReturn } from './services/devices';
|
|
3
|
-
import { IDevice, TConnectType, IOpenApiDevice, GizwitsSdkOption, SyncCallBack, ISDKResult, IResult, IOTAType, IBindRemoteDeviceParams, TListenerType, ISetDeviceOnboardingDeployProps, IDataPointConfig, OTAEventCallback, OTAProgressEventCallback, ILoginRes, IDeviceSafetyRegisterParams } from './types';
|
|
4
|
-
declare class GizwitsMiniSDK {
|
|
5
|
-
private listenerMap;
|
|
6
|
-
private keepScanTimer;
|
|
7
|
-
private _deviceList;
|
|
8
|
-
private get deviceList();
|
|
9
|
-
private set deviceList(value);
|
|
10
|
-
private _bleDevices;
|
|
11
|
-
get bleDevices(): IDevice[];
|
|
12
|
-
set bleDevices(data: IDevice[]);
|
|
13
|
-
private _lanDevices;
|
|
14
|
-
private get lanDevices();
|
|
15
|
-
private set lanDevices(value);
|
|
16
|
-
private get allDevices();
|
|
17
|
-
private get bleScanDevice();
|
|
18
|
-
private productInfo;
|
|
19
|
-
private currentWifiConfigHandle;
|
|
20
|
-
private _bleHandle;
|
|
21
|
-
private _lanHandle;
|
|
22
|
-
private _gizSocket;
|
|
23
|
-
private offlineThreshold?;
|
|
24
|
-
private syncDataCallBack?;
|
|
25
|
-
private syncDataLengthCallback?;
|
|
26
|
-
private syncTotalNum;
|
|
27
|
-
private syncCurrnetNum;
|
|
28
|
-
private syncDataTimoutTimer;
|
|
29
|
-
private SYNC_TIMEOUT;
|
|
30
|
-
private syncDevice?;
|
|
31
|
-
constructor(props: GizwitsSdkOption);
|
|
32
|
-
private get bleHandle();
|
|
33
|
-
private get lanHandle();
|
|
34
|
-
private get socketHandle();
|
|
35
|
-
private init;
|
|
36
|
-
reInit(props: GizwitsSdkOption): void;
|
|
37
|
-
get specialProductKeys(): string[];
|
|
38
|
-
get specialProductKeySecrets(): string[];
|
|
39
|
-
private handleBleError;
|
|
40
|
-
private handleBleDevices;
|
|
41
|
-
handleLanDevices: (devices: IDevice[]) => void;
|
|
42
|
-
private handleLanDeviceData;
|
|
43
|
-
private handleBleDeviceData;
|
|
44
|
-
private handleSocketDeviceData;
|
|
45
|
-
private handleSocketStatus;
|
|
46
|
-
private notiDeviceList;
|
|
47
|
-
private initLan;
|
|
48
|
-
startAutoScan: (services?: string[]) => void;
|
|
49
|
-
stopAutoScan: () => void;
|
|
50
|
-
setDeviceMeta: <K extends keyof IDevice>(curDev: IDevice, key: K, value: IDevice[K], force?: boolean) => void;
|
|
51
|
-
setDevicesMeta: <K extends keyof IDevice>(devices: IDevice[], key: K, value: IDevice[K], force?: boolean) => void;
|
|
52
|
-
static getVersion: () => {
|
|
53
|
-
success: boolean;
|
|
54
|
-
data: string;
|
|
55
|
-
};
|
|
56
|
-
initBle: () => Promise<ISDKResult<null>>;
|
|
57
|
-
scanBleDevice: (delay: number, services?: string[]) => Promise<ISDKResult<IDevice[]>>;
|
|
58
|
-
write: (device: IDevice, attrs: object) => Promise<any>;
|
|
59
|
-
writeRaw: (device: IDevice, data: number[]) => Promise<any>;
|
|
60
|
-
setDeviceTimeStamp: (device: IDevice) => Promise<any>;
|
|
61
|
-
syncDeviceData: (device: IDevice, callback?: SyncCallBack) => Promise<any>;
|
|
62
|
-
queryNeedSyncDataLength: (device: IDevice) => Promise<ISDKResult<number>>;
|
|
63
|
-
cancelSyncDeviceData: () => Promise<void>;
|
|
64
|
-
private cleanSyncDeviceData;
|
|
65
|
-
getProductConfig: (pk: string) => Promise<ISDKResult<IDataPointConfig>>;
|
|
66
|
-
stopScanBleDevice: () => void;
|
|
67
|
-
login: (openID: string) => Promise<ISDKResult<ILoginRes>>;
|
|
68
|
-
getDeviceStatus: (device: IDevice, attrNames?: string[]) => Promise<any>;
|
|
69
|
-
subscribe: (device: IDevice, connectType?: TConnectType, _autoGetDeviceStatus?: boolean) => Promise<IResult<any> | {
|
|
70
|
-
success: boolean;
|
|
71
|
-
errorCode: import("./types").IError;
|
|
72
|
-
} | {
|
|
73
|
-
success: boolean;
|
|
74
|
-
errorCode?: undefined;
|
|
75
|
-
} | {
|
|
76
|
-
success: boolean;
|
|
77
|
-
message: string;
|
|
78
|
-
}>;
|
|
79
|
-
batchSubscribe: (devices: IDevice[], connectType?: TConnectType) => Promise<{
|
|
80
|
-
success: boolean;
|
|
81
|
-
errorCode: import("./types").IError;
|
|
82
|
-
} | {
|
|
83
|
-
success: boolean;
|
|
84
|
-
errorCode?: undefined;
|
|
85
|
-
} | {
|
|
86
|
-
success: boolean;
|
|
87
|
-
message: string;
|
|
88
|
-
}>;
|
|
89
|
-
batchWanUnSubscribe: (devices: IDevice[]) => Promise<{
|
|
90
|
-
success: boolean;
|
|
91
|
-
}>;
|
|
92
|
-
unSubscribe: (device: IDevice) => Promise<{
|
|
93
|
-
success: boolean;
|
|
94
|
-
}>;
|
|
95
|
-
bindRemoteDevice: ({ mac, productKey, alias, beOwner, }: IBindRemoteDeviceParams) => Promise<ISDKResult<IOpenApiDevice>>;
|
|
96
|
-
checkUpdate: ({ device, type }: {
|
|
97
|
-
device: IDevice;
|
|
98
|
-
type: IOTAType;
|
|
99
|
-
}) => Promise<import("./types").IServiceResult<import("./types").OTARes>>;
|
|
100
|
-
getDeviceInfo: ({ device }: {
|
|
101
|
-
device: IDevice;
|
|
102
|
-
}) => Promise<IResult<import("./protocol/DeviceInfo").default>>;
|
|
103
|
-
startUpgrade: ({ device, type, onProgress, onEvent }: {
|
|
104
|
-
device: IDevice;
|
|
105
|
-
type: IOTAType;
|
|
106
|
-
onProgress: OTAProgressEventCallback;
|
|
107
|
-
onEvent: OTAEventCallback;
|
|
108
|
-
}) => Promise<import("./types").IServiceResult<import("./types").OTARes>>;
|
|
109
|
-
unbindDevice: ({ devices, }: {
|
|
110
|
-
devices: IDevice[];
|
|
111
|
-
}) => Promise<ISDKResult<IUnbindReturn>>;
|
|
112
|
-
deviceSafetyRegister: ({ mac, productKey, }: IDeviceSafetyRegisterParams) => Promise<ISDKResult<ISafeRegisterReturn>>;
|
|
113
|
-
deviceSafetyUnbind: ({ mac, productKey, }: IDeviceSafetyRegisterParams) => Promise<ISDKResult<ISafeRegisterReturn>>;
|
|
114
|
-
setDeviceOnboardingDeploy: ({ ssid, bssid, password, mode, timeout, isBind, softAPSSIDPrefix, eventCallBack }: ISetDeviceOnboardingDeployProps) => Promise<ISDKResult<IDevice[]>>;
|
|
115
|
-
private setDomain;
|
|
116
|
-
private deviceSafetyApi;
|
|
117
|
-
getBindingList: () => Promise<import("./types").IServiceResult<IDevice[]>>;
|
|
118
|
-
getDevices: () => Promise<ISDKResult<IDevice[]>>;
|
|
119
|
-
stopDeviceOnboardingDeploy: () => void;
|
|
120
|
-
setLogLevel: (level: TLogType) => {
|
|
121
|
-
success: boolean;
|
|
122
|
-
err: import("./types").IError;
|
|
123
|
-
};
|
|
124
|
-
renameDevice: (device: IDevice, name: string) => Promise<import("./types").IServiceResult<import("./services/devices").IRenamePropsReturn> | {
|
|
125
|
-
success: boolean;
|
|
126
|
-
message: string;
|
|
127
|
-
}>;
|
|
128
|
-
removeEventListener: <K extends keyof TListenerType>(type: K, func: TListenerType[K]) => {
|
|
129
|
-
success: boolean;
|
|
130
|
-
};
|
|
131
|
-
addEventListener: <K extends keyof TListenerType>(type: K, func: TListenerType[K]) => Promise<{
|
|
132
|
-
success: boolean;
|
|
133
|
-
}>;
|
|
134
|
-
destory: () => void;
|
|
135
|
-
}
|
|
136
|
-
export default GizwitsMiniSDK;
|
package/dist/src/sentry.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { IDevice, IOpenApiDevice, IRandomCodesResult, IServiceResult } from '../types';
|
|
2
|
-
export declare const getBindingList: () => Promise<IServiceResult<IDevice[]>>;
|
|
3
|
-
export interface IBindMacParams {
|
|
4
|
-
mac: string;
|
|
5
|
-
productKey: string;
|
|
6
|
-
productSecret: string;
|
|
7
|
-
alias?: string;
|
|
8
|
-
beOwner?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function bindMac({ mac, productKey, productSecret, alias, beOwner, }: IBindMacParams): Promise<IServiceResult<IOpenApiDevice>>;
|
|
11
|
-
export interface IUnbindReturn {
|
|
12
|
-
failed: string[];
|
|
13
|
-
success: string[];
|
|
14
|
-
}
|
|
15
|
-
export declare function unbindDevice({ devices, }: {
|
|
16
|
-
devices: IDevice[];
|
|
17
|
-
}): Promise<IServiceResult<IUnbindReturn>>;
|
|
18
|
-
interface ICheckDeviceRegisterParams {
|
|
19
|
-
SSID: string;
|
|
20
|
-
password: string;
|
|
21
|
-
productKeys: string[];
|
|
22
|
-
}
|
|
23
|
-
export declare function checkDeviceRegister({ SSID, password, productKeys, }: ICheckDeviceRegisterParams): Promise<IServiceResult<IRandomCodesResult[]>>;
|
|
24
|
-
interface ISafeRegisterParams {
|
|
25
|
-
productKey: string;
|
|
26
|
-
productSecret: string;
|
|
27
|
-
mac: string;
|
|
28
|
-
passcode: string;
|
|
29
|
-
gwDid?: string;
|
|
30
|
-
isReset: boolean;
|
|
31
|
-
}
|
|
32
|
-
export interface ISafeRegisterReturn {
|
|
33
|
-
successDevices: IDevice[];
|
|
34
|
-
failedDevices: IDevice[];
|
|
35
|
-
}
|
|
36
|
-
export declare function safeRegister({ productKey, productSecret, mac, passcode, gwDid, isReset, }: ISafeRegisterParams): Promise<IServiceResult<ISafeRegisterReturn>>;
|
|
37
|
-
interface IRenameProps {
|
|
38
|
-
name?: string;
|
|
39
|
-
did: string;
|
|
40
|
-
remark?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface IRenamePropsReturn {
|
|
43
|
-
remark: string;
|
|
44
|
-
dev_alias: string;
|
|
45
|
-
}
|
|
46
|
-
export declare function editBindInfo({ name, remark, did, }: IRenameProps): Promise<IServiceResult<IRenamePropsReturn>>;
|
|
47
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IDevice } from '../types';
|
|
2
|
-
type EventType = "BleDeviceConnectStart" | "BleDeviceConnectEnd" | "BleDeviceConnectBind" | "BleDeviceConnectLogin" | "BleDeviceConnectFinish";
|
|
3
|
-
type FailureType = Omit<EventType, 'BleDeviceConnectStart' | 'BleDeviceConnectFinish'>;
|
|
4
|
-
interface IProps {
|
|
5
|
-
device: IDevice;
|
|
6
|
-
eventID: string;
|
|
7
|
-
eventType: EventType;
|
|
8
|
-
success: boolean;
|
|
9
|
-
failureType?: FailureType;
|
|
10
|
-
}
|
|
11
|
-
export declare function reportEvent({ device, eventID, eventType, success, failureType }: IProps): Promise<import("../types").IServiceResult<any>>;
|
|
12
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IDevice } from "../types";
|
|
2
|
-
export interface IUploadRes {
|
|
3
|
-
}
|
|
4
|
-
interface IData {
|
|
5
|
-
raw: string;
|
|
6
|
-
created_at: number;
|
|
7
|
-
}
|
|
8
|
-
interface IProps {
|
|
9
|
-
device: IDevice;
|
|
10
|
-
data: IData[];
|
|
11
|
-
productSecret: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function uploadP0({ device, data, productSecret }: IProps): Promise<import("../types").IServiceResult<IUploadRes>>;
|
|
14
|
-
export {};
|
package/dist/src/sleep.d.ts
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { TCPHandler } from "../handler/lan";
|
|
2
|
-
import DiscoverUDP from "../protocol/DiscoverUDP";
|
|
3
|
-
import { wrapErrorInfo } from "../utils";
|
|
4
|
-
export type TUtf8 = {
|
|
5
|
-
toBytes: (data: any) => any;
|
|
6
|
-
};
|
|
7
|
-
export type TUtils = {
|
|
8
|
-
utf8: TUtf8;
|
|
9
|
-
};
|
|
10
|
-
export interface ecb {
|
|
11
|
-
new (data: any): any;
|
|
12
|
-
}
|
|
13
|
-
export type TModeOfOperation = {
|
|
14
|
-
ecb: ecb;
|
|
15
|
-
};
|
|
16
|
-
export interface IError {
|
|
17
|
-
errorCode: number;
|
|
18
|
-
errorMessage?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface ICommonObj {
|
|
21
|
-
[key: string]: any;
|
|
22
|
-
}
|
|
23
|
-
export interface IDeviceStatusChangedProps {
|
|
24
|
-
did: string;
|
|
25
|
-
attrs: ICommonObj;
|
|
26
|
-
}
|
|
27
|
-
export interface IDeviceRawStatusChangedProps {
|
|
28
|
-
did: string;
|
|
29
|
-
raw: Uint8Array;
|
|
30
|
-
}
|
|
31
|
-
export interface IOnDeviceStatusChanged {
|
|
32
|
-
(data: IDeviceStatusChangedProps | IDeviceRawStatusChangedProps): void;
|
|
33
|
-
}
|
|
34
|
-
export interface IOnSocketStatusChanged {
|
|
35
|
-
(dids: string[], enabled: boolean): void;
|
|
36
|
-
}
|
|
37
|
-
export interface IEmptyFn {
|
|
38
|
-
(): void;
|
|
39
|
-
}
|
|
40
|
-
export interface IDevice {
|
|
41
|
-
mac: string;
|
|
42
|
-
productKey: string;
|
|
43
|
-
did: string;
|
|
44
|
-
bleWorkStatus?: number;
|
|
45
|
-
name: string;
|
|
46
|
-
localName: string;
|
|
47
|
-
isBind: boolean;
|
|
48
|
-
rootDeviceId?: string;
|
|
49
|
-
bleDeviceID?: string;
|
|
50
|
-
remark?: string;
|
|
51
|
-
passcode?: string;
|
|
52
|
-
connectType: TConnectType;
|
|
53
|
-
isOnline: boolean;
|
|
54
|
-
isLanOnline: boolean;
|
|
55
|
-
isBleOnline: boolean;
|
|
56
|
-
host?: string;
|
|
57
|
-
wss_port?: number;
|
|
58
|
-
ctime?: number;
|
|
59
|
-
}
|
|
60
|
-
export type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';
|
|
61
|
-
export interface IBluetoothAdapterStateResult {
|
|
62
|
-
discovering: boolean;
|
|
63
|
-
available: boolean;
|
|
64
|
-
}
|
|
65
|
-
export interface IWechatResult {
|
|
66
|
-
errMsg: string;
|
|
67
|
-
errCode: number;
|
|
68
|
-
}
|
|
69
|
-
export interface IWXDevicesResult {
|
|
70
|
-
success: true;
|
|
71
|
-
bleDevices: WechatMiniprogram.BlueToothDevice[];
|
|
72
|
-
}
|
|
73
|
-
export interface SyncCallBackParams {
|
|
74
|
-
event: TSyncEvnet;
|
|
75
|
-
currentNum?: number;
|
|
76
|
-
totalNum?: number;
|
|
77
|
-
message?: string;
|
|
78
|
-
}
|
|
79
|
-
export type TSyncEvnet = 'SYNC_START' | 'SYNC_END' | 'SYNC_FAIL' | 'SYNC_CANCEL' | 'SYNC_PROGRESS';
|
|
80
|
-
export type SyncCallBack = (data: SyncCallBackParams) => void;
|
|
81
|
-
export type IOTAType = 'MCU' | 'MODULE';
|
|
82
|
-
export interface ISDKResult<T> {
|
|
83
|
-
data?: T;
|
|
84
|
-
err?: IError;
|
|
85
|
-
message?: string;
|
|
86
|
-
success: boolean;
|
|
87
|
-
}
|
|
88
|
-
export interface ISetCommonDeviceOnboardingDeployProps {
|
|
89
|
-
ssid: string;
|
|
90
|
-
bssid?: string;
|
|
91
|
-
password: string;
|
|
92
|
-
timeout: number;
|
|
93
|
-
isBind?: boolean;
|
|
94
|
-
mode?: 0 | 3 | 5;
|
|
95
|
-
softAPSSIDPrefix?: string;
|
|
96
|
-
}
|
|
97
|
-
export interface ISetDeviceOnboardingDeployProps extends ISetCommonDeviceOnboardingDeployProps {
|
|
98
|
-
softAPSSIDPrefix: string;
|
|
99
|
-
eventCallBack: (event: ConfigEventData) => void;
|
|
100
|
-
}
|
|
101
|
-
export interface IRandomCodesResult {
|
|
102
|
-
random_code: string;
|
|
103
|
-
product_key: string;
|
|
104
|
-
mac: string;
|
|
105
|
-
did: string;
|
|
106
|
-
user_id: string;
|
|
107
|
-
timestamp: number;
|
|
108
|
-
type: string;
|
|
109
|
-
wifi_soft_ver: string;
|
|
110
|
-
lan_proto_ver: string;
|
|
111
|
-
}
|
|
112
|
-
export interface IBindRemoteDeviceParams {
|
|
113
|
-
productKey: string;
|
|
114
|
-
mac: string;
|
|
115
|
-
beOwner?: boolean;
|
|
116
|
-
alias?: string;
|
|
117
|
-
}
|
|
118
|
-
export interface IDeviceStatusNoti {
|
|
119
|
-
device: IDevice;
|
|
120
|
-
connectType: TConnectType;
|
|
121
|
-
}
|
|
122
|
-
export interface IDeviceAttrsNoti {
|
|
123
|
-
device: IDevice;
|
|
124
|
-
data: object;
|
|
125
|
-
}
|
|
126
|
-
export interface TListenerType {
|
|
127
|
-
GizDeviceListNotifications: TDeviceListNotifications;
|
|
128
|
-
GizDeviceStatusNotifications: TDeviceStatusNotifications;
|
|
129
|
-
GizDeviceAttrsNotifications: TDeviceAttrsNotifications;
|
|
130
|
-
onScanListChange: OnScanListChange;
|
|
131
|
-
onBleHandleError: OnBleHandleError;
|
|
132
|
-
}
|
|
133
|
-
export type TDeviceListNotifications = (devices: IDevice[]) => void;
|
|
134
|
-
export type TDeviceStatusNotifications = (data: IDeviceStatusNoti) => void;
|
|
135
|
-
export type TDeviceAttrsNotifications = (data: IDeviceAttrsNoti) => void;
|
|
136
|
-
export type OnScanListChange = (devices: IDevice[]) => void;
|
|
137
|
-
export type OnBleHandleError = (error: IError) => void;
|
|
138
|
-
export interface IDeviceSafetyRegisterParams {
|
|
139
|
-
mac: string;
|
|
140
|
-
productKey: string;
|
|
141
|
-
}
|
|
142
|
-
export interface IDeviceSafetyParams extends IDeviceSafetyRegisterParams {
|
|
143
|
-
isReset: boolean;
|
|
144
|
-
}
|
|
145
|
-
export interface IResult<T> {
|
|
146
|
-
success: boolean;
|
|
147
|
-
data?: T;
|
|
148
|
-
err?: IError;
|
|
149
|
-
}
|
|
150
|
-
export interface ICloudServiceInfo {
|
|
151
|
-
openAPIInfo: string;
|
|
152
|
-
}
|
|
153
|
-
export type TimeoutHandle = ReturnType<typeof setTimeout> | null;
|
|
154
|
-
export type IntervalHandle = ReturnType<typeof setInterval> | null;
|
|
155
|
-
export interface IProductInfo {
|
|
156
|
-
productKey: string;
|
|
157
|
-
productSecret: string;
|
|
158
|
-
}
|
|
159
|
-
export interface GizwitsSdkOption {
|
|
160
|
-
appID: string;
|
|
161
|
-
appSecret: string;
|
|
162
|
-
productInfo: IProductInfo[];
|
|
163
|
-
cloudServiceInfo?: ICloudServiceInfo;
|
|
164
|
-
token?: string;
|
|
165
|
-
uid?: string;
|
|
166
|
-
offlineThreshold?: number;
|
|
167
|
-
}
|
|
168
|
-
export interface IRejectCallback {
|
|
169
|
-
(result: IResult<unknown>): void;
|
|
170
|
-
}
|
|
171
|
-
export type TConfigEvent = 'GIZ_CONFIG_START' | 'GIZ_DISCOVER_SUCCESS' | 'GIZ_CONNECT_SUCCESS' | 'GIZ_CONFIG_SEND_SUCCESS' | 'GIZ_CONFIG_RECV_SUCCESS' | 'GIZ_CONFIG_SUCCESS';
|
|
172
|
-
export interface ConfigEventData {
|
|
173
|
-
event: TConfigEvent;
|
|
174
|
-
deviceID?: string;
|
|
175
|
-
}
|
|
176
|
-
export interface IOpenApiDevice {
|
|
177
|
-
product_key: string;
|
|
178
|
-
did: string;
|
|
179
|
-
mac: string;
|
|
180
|
-
passcode: string;
|
|
181
|
-
is_online: boolean;
|
|
182
|
-
host: string;
|
|
183
|
-
port: string;
|
|
184
|
-
port_s: string;
|
|
185
|
-
ws_port: number;
|
|
186
|
-
wss_port: number;
|
|
187
|
-
dev_alias: string;
|
|
188
|
-
remark: string;
|
|
189
|
-
type: 'normal' | 'center_control' | 'sub_dev';
|
|
190
|
-
}
|
|
191
|
-
export interface IDeviceRes {
|
|
192
|
-
devices: IOpenApiDevice[];
|
|
193
|
-
}
|
|
194
|
-
export interface IErrorCode {
|
|
195
|
-
[key: string]: IError;
|
|
196
|
-
}
|
|
197
|
-
export interface IWechatApiResult<T> {
|
|
198
|
-
data: T;
|
|
199
|
-
errMsg: string;
|
|
200
|
-
statusCode: number;
|
|
201
|
-
}
|
|
202
|
-
export interface IServiceResult<T> {
|
|
203
|
-
success: boolean;
|
|
204
|
-
data?: T;
|
|
205
|
-
err?: IError;
|
|
206
|
-
}
|
|
207
|
-
export interface IGetRandomCodes {
|
|
208
|
-
SSID: string;
|
|
209
|
-
password: string;
|
|
210
|
-
pks: string[];
|
|
211
|
-
}
|
|
212
|
-
export interface IGetRandomCode {
|
|
213
|
-
SSID: string;
|
|
214
|
-
password: string;
|
|
215
|
-
pk: string;
|
|
216
|
-
}
|
|
217
|
-
export interface IProductConfigData {
|
|
218
|
-
[key: string]: IDataPointConfig;
|
|
219
|
-
}
|
|
220
|
-
export interface IDataPointConfig {
|
|
221
|
-
name: string;
|
|
222
|
-
protocolType: 'var_len' | 'standard';
|
|
223
|
-
entities: IDataPointEntitie[];
|
|
224
|
-
}
|
|
225
|
-
export interface IDataPointEntitie {
|
|
226
|
-
display_name: string;
|
|
227
|
-
attrs: IDataPointAttr[];
|
|
228
|
-
}
|
|
229
|
-
export interface IDataPointPosition {
|
|
230
|
-
byte_offset: number;
|
|
231
|
-
unit: 'bit' | 'byte';
|
|
232
|
-
len: number;
|
|
233
|
-
bit_offset: number;
|
|
234
|
-
}
|
|
235
|
-
export type TDataType = 'bool' | 'uint8' | 'uint16' | 'uint32' | 'binary' | 'enum' | 'number';
|
|
236
|
-
export interface IUnitSpec {
|
|
237
|
-
addition: number;
|
|
238
|
-
max: number;
|
|
239
|
-
ratio: number;
|
|
240
|
-
min: number;
|
|
241
|
-
}
|
|
242
|
-
export type TDataOptionType = 'status_writable' | 'status_readonly' | 'alert' | 'fault' | 'ALL';
|
|
243
|
-
export interface IDataPointAttr {
|
|
244
|
-
display_name: string;
|
|
245
|
-
uint_spec: IUnitSpec;
|
|
246
|
-
name: string;
|
|
247
|
-
data_type: TDataType;
|
|
248
|
-
position: IDataPointPosition;
|
|
249
|
-
type: TDataOptionType;
|
|
250
|
-
id: number;
|
|
251
|
-
enum: string[];
|
|
252
|
-
desc: string;
|
|
253
|
-
}
|
|
254
|
-
export type GizBleDeviceListotifications = (devices: IDevice[]) => void;
|
|
255
|
-
export type GizBleDeviceDataNotifications = (curDevice: WechatMiniprogram.OnBLECharacteristicValueChangeListenerResult, hexString: string) => void;
|
|
256
|
-
export type GizBleErrorNotifications = (err: {
|
|
257
|
-
errCode: number;
|
|
258
|
-
errMsg: string;
|
|
259
|
-
}) => void;
|
|
260
|
-
export type TBleDataListener<T> = (_curDevice: WechatMiniprogram.OnBLECharacteristicValueChangeListenerResult, hexString: string) => T | null | undefined;
|
|
261
|
-
export interface CheckOTAParams {
|
|
262
|
-
device: IDevice;
|
|
263
|
-
type: IOTAType;
|
|
264
|
-
}
|
|
265
|
-
export type OTAEventCode = 'GizOTAEventPretreatment' | 'GizOTAEventDownload' | 'GizOTAEventTransmit' | 'GizOTAEventReboot' | 'GizOTAEventFinish';
|
|
266
|
-
export interface OTAEvent {
|
|
267
|
-
code: OTAEventCode;
|
|
268
|
-
}
|
|
269
|
-
export interface OTAProgressEvent {
|
|
270
|
-
firmwareSize: number;
|
|
271
|
-
packageMaxLen: number;
|
|
272
|
-
currentNumber: number;
|
|
273
|
-
currentProgress: number;
|
|
274
|
-
}
|
|
275
|
-
export type OTAProgressEventCallback = (event: OTAProgressEvent) => void;
|
|
276
|
-
export type OTAEventCallback = (event: OTAEvent) => void;
|
|
277
|
-
export interface StartUpgradeParams extends CheckOTAParams {
|
|
278
|
-
onProgress: OTAProgressEventCallback;
|
|
279
|
-
onEvent: OTAEventCallback;
|
|
280
|
-
productKey: string;
|
|
281
|
-
}
|
|
282
|
-
export interface TBleHandleEvent {
|
|
283
|
-
GizBleDeviceData: GizBleDeviceDataNotifications;
|
|
284
|
-
GizBleDeviceList: GizBleDeviceListotifications;
|
|
285
|
-
GizBleError: GizBleErrorNotifications;
|
|
286
|
-
}
|
|
287
|
-
export interface GizwitsWxBlueToothDevice extends WechatMiniprogram.BlueToothDevice {
|
|
288
|
-
communicationType: 'BLE_BROADCAST' | 'BLE';
|
|
289
|
-
}
|
|
290
|
-
export interface BleHandleParams {
|
|
291
|
-
serviceUUIDSuffix: string;
|
|
292
|
-
characteristicUUIDSuffix: string;
|
|
293
|
-
}
|
|
294
|
-
export interface IStartScanResult {
|
|
295
|
-
scanList: IDevice[];
|
|
296
|
-
err?: ReturnType<typeof wrapErrorInfo>;
|
|
297
|
-
}
|
|
298
|
-
export interface IDeviceReq<T> {
|
|
299
|
-
success: boolean;
|
|
300
|
-
data: T;
|
|
301
|
-
}
|
|
302
|
-
export type OnScanDevice = (scanList: IDevice[]) => void;
|
|
303
|
-
export interface BleConnectDevice {
|
|
304
|
-
deviceId?: string;
|
|
305
|
-
serviceId?: string;
|
|
306
|
-
characteristicId?: string;
|
|
307
|
-
errMsg?: string;
|
|
308
|
-
}
|
|
309
|
-
export interface BleConstructorParams {
|
|
310
|
-
pks: string[];
|
|
311
|
-
bleHandleParams?: BleHandleParams;
|
|
312
|
-
offlineThreshold?: number;
|
|
313
|
-
}
|
|
314
|
-
export interface LanConnectDevice {
|
|
315
|
-
mac: string;
|
|
316
|
-
productKey: string;
|
|
317
|
-
socketHandle: TCPHandler;
|
|
318
|
-
}
|
|
319
|
-
export interface ILanDevice extends IDevice {
|
|
320
|
-
expandData: DiscoverUDP;
|
|
321
|
-
ip: string;
|
|
322
|
-
}
|
|
323
|
-
export type GizLanDeviceListNotifications = (devices: IDevice[]) => void;
|
|
324
|
-
export type GizLanDeviceDataNotifications = (mac: string, data: string) => void;
|
|
325
|
-
export interface TLanHandleEvent {
|
|
326
|
-
GizLanDeviceList: GizLanDeviceListNotifications;
|
|
327
|
-
GizLanDeviceData: GizLanDeviceDataNotifications;
|
|
328
|
-
}
|
|
329
|
-
export interface IBLEService {
|
|
330
|
-
uuid: string;
|
|
331
|
-
isPrimary: boolean;
|
|
332
|
-
}
|
|
333
|
-
export interface IBLECharacteristic {
|
|
334
|
-
uuid: string;
|
|
335
|
-
properties: {
|
|
336
|
-
read: boolean;
|
|
337
|
-
write: boolean;
|
|
338
|
-
notify: boolean;
|
|
339
|
-
indicate: boolean;
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
export interface ILoginRes {
|
|
343
|
-
expire_at: number;
|
|
344
|
-
token: string;
|
|
345
|
-
uid: string;
|
|
346
|
-
}
|
|
347
|
-
export interface OTARes {
|
|
348
|
-
download_url: string;
|
|
349
|
-
soft_ver: string;
|
|
350
|
-
}
|
|
351
|
-
export interface configDeviceParams {
|
|
352
|
-
ssid: string;
|
|
353
|
-
password: string;
|
|
354
|
-
softAPSSIDPrefix: string;
|
|
355
|
-
}
|
|
356
|
-
export interface configBLEDeviceParams {
|
|
357
|
-
ssid: string;
|
|
358
|
-
password: string;
|
|
359
|
-
softAPSSIDPrefix?: string;
|
|
360
|
-
timeout: number;
|
|
361
|
-
}
|