mini_program_gizwits_sdk 3.6.1 → 3.6.3
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.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/src/GizLog.d.ts +1 -1
- package/dist/src/errorCode.d.ts +1 -3
- package/dist/src/handler/ble.d.ts +5 -66
- package/dist/src/handler/lan.d.ts +3 -18
- package/dist/src/handler/socket.d.ts +1 -0
- package/dist/src/openApiRequest.d.ts +1 -5
- package/dist/src/productConfigFileManage.d.ts +3 -6
- package/dist/src/protocol/OTA/CheckCanOTA.d.ts +1 -1
- package/dist/src/protocol/{DataPoint.d.ts → dataPoint.d.ts} +0 -34
- package/dist/src/randomCode.d.ts +1 -5
- package/dist/src/sdk.d.ts +9 -104
- package/dist/src/services/devices.d.ts +1 -17
- package/dist/src/services/login.d.ts +2 -6
- package/dist/src/services/monitor.d.ts +2 -1
- package/dist/src/services/ota.d.ts +2 -6
- package/dist/src/services/uploadP0.d.ts +2 -1
- package/dist/src/types/index.d.ts +360 -0
- package/dist/src/utils.d.ts +1 -6
- package/dist/src/wechatApi.d.ts +1 -22
- package/dist/src/wifiConfig/ConfigBase.d.ts +2 -9
- package/dist/src/wifiConfig/ap.d.ts +1 -11
- package/dist/src/wifiConfig/ble.d.ts +2 -8
- package/dist/src/wifiConfig/nfc/index.d.ts +2 -2
- package/global.d.ts +3 -19
- package/index.ts +2 -1
- package/package.json +2 -2
- package/src/errorCode.ts +3 -3
- package/src/handler/ble.ts +4 -79
- package/src/handler/lan.ts +3 -24
- package/src/handler/socket.ts +3 -0
- package/src/openApiRequest.ts +2 -14
- package/src/productConfigFileManage.ts +3 -5
- package/src/protocol/OTA/AwaitNoti.ts +0 -2
- package/src/protocol/OTA/CheckCanOTA.ts +1 -2
- package/src/protocol/OTA/OTAPackPackage.ts +1 -1
- package/src/protocol/OTA/PreOTA.ts +2 -3
- package/src/protocol/OTA/ResetPosition.ts +1 -2
- package/src/protocol/dataPoint.ts +1 -42
- package/src/randomCode.ts +1 -12
- package/src/sdk.ts +11 -114
- package/src/services/devices.ts +2 -22
- package/src/services/login.ts +1 -5
- package/src/services/monitor.ts +1 -0
- package/src/services/ota.ts +1 -5
- package/src/services/uploadP0.ts +1 -0
- package/src/types/index.ts +455 -0
- package/src/utils.ts +1 -6
- package/src/wechatApi.ts +1 -22
- package/src/wifiConfig/ConfigBase.ts +2 -10
- package/src/wifiConfig/ap.ts +1 -13
- package/src/wifiConfig/ble.ts +2 -9
- package/src/wifiConfig/nfc/index.ts +1 -4
- package/src/global.d.ts +0 -52
package/dist/src/GizLog.d.ts
CHANGED
package/dist/src/errorCode.d.ts
CHANGED
|
@@ -1,69 +1,9 @@
|
|
|
1
|
-
import { wrapErrorInfo } from '../utils';
|
|
2
1
|
import EventListener from './EventListener';
|
|
3
|
-
import { IOTAType, IResult } from '../sdk';
|
|
4
2
|
import DeviceInfo from '../protocol/DeviceInfo';
|
|
5
|
-
|
|
6
|
-
type GizBleDeviceDataNotifications = (curDevice: WechatMiniprogram.OnBLECharacteristicValueChangeListenerResult, hexString: string) => void;
|
|
7
|
-
type GizBleErrorNotifications = (err: {
|
|
8
|
-
errCode: number;
|
|
9
|
-
errMsg: string;
|
|
10
|
-
}) => void;
|
|
11
|
-
interface CheckOTAParams {
|
|
12
|
-
device: IDevice;
|
|
13
|
-
type: IOTAType;
|
|
14
|
-
}
|
|
15
|
-
type OTAEventCode = 'GizOTAEventPretreatment' | 'GizOTAEventDownload' | 'GizOTAEventTransmit' | 'GizOTAEventReboot' | 'GizOTAEventFinish';
|
|
16
|
-
interface OTAEvent {
|
|
17
|
-
code: OTAEventCode;
|
|
18
|
-
}
|
|
19
|
-
interface OTAProgressEvent {
|
|
20
|
-
firmwareSize: number;
|
|
21
|
-
packageMaxLen: number;
|
|
22
|
-
currentNumber: number;
|
|
23
|
-
currentProgress: number;
|
|
24
|
-
}
|
|
25
|
-
export type OTAProgressEventCallback = (event: OTAProgressEvent) => void;
|
|
26
|
-
export type OTAEventCallback = (event: OTAEvent) => void;
|
|
27
|
-
interface StartUpgradeParams extends CheckOTAParams {
|
|
28
|
-
onProgress: OTAProgressEventCallback;
|
|
29
|
-
onEvent: OTAEventCallback;
|
|
30
|
-
productKey: string;
|
|
31
|
-
}
|
|
32
|
-
export interface TBleHandleEvent {
|
|
33
|
-
GizBleDeviceData: GizBleDeviceDataNotifications;
|
|
34
|
-
GizBleDeviceList: GizBleDeviceListotifications;
|
|
35
|
-
GizBleError: GizBleErrorNotifications;
|
|
36
|
-
}
|
|
37
|
-
export interface GizwitsWxBlueToothDevice extends WechatMiniprogram.BlueToothDevice {
|
|
38
|
-
communicationType: 'BLE_BROADCAST' | 'BLE';
|
|
39
|
-
}
|
|
40
|
-
interface BleHandleParams {
|
|
41
|
-
serviceUUIDSuffix: string;
|
|
42
|
-
characteristicUUIDSuffix: string;
|
|
43
|
-
}
|
|
44
|
-
export interface IStartScanResult {
|
|
45
|
-
scanList: IDevice[];
|
|
46
|
-
err?: ReturnType<typeof wrapErrorInfo>;
|
|
47
|
-
}
|
|
48
|
-
interface IDeviceReq<T> {
|
|
49
|
-
success: boolean;
|
|
50
|
-
data: T;
|
|
51
|
-
}
|
|
52
|
-
export type OnScanDevice = (scanList: IDevice[]) => void;
|
|
53
|
-
interface ConnectDevice {
|
|
54
|
-
deviceId?: string;
|
|
55
|
-
serviceId?: string;
|
|
56
|
-
characteristicId?: string;
|
|
57
|
-
errMsg?: string;
|
|
58
|
-
}
|
|
59
|
-
interface ConstructorParams {
|
|
60
|
-
pks: string[];
|
|
61
|
-
bleHandleParams?: BleHandleParams;
|
|
62
|
-
offlineThreshold?: number;
|
|
63
|
-
}
|
|
3
|
+
import { BleConnectDevice, IDevice, IResult, TBleHandleEvent, BleConstructorParams, IStartScanResult, IDeviceReq, StartUpgradeParams, CheckOTAParams } from '../types';
|
|
64
4
|
export declare class BleHandle extends EventListener<TBleHandleEvent> {
|
|
65
5
|
private serviceUUIDSuffix;
|
|
66
|
-
connectedList:
|
|
6
|
+
connectedList: BleConnectDevice[];
|
|
67
7
|
private connectingDevId;
|
|
68
8
|
pks: string[];
|
|
69
9
|
private listenDevOfflineTimer;
|
|
@@ -82,7 +22,7 @@ export declare class BleHandle extends EventListener<TBleHandleEvent> {
|
|
|
82
22
|
set offlineThreshold(value: any);
|
|
83
23
|
get offlineThreshold(): any;
|
|
84
24
|
scanList: IDevice[];
|
|
85
|
-
constructor({ pks, bleHandleParams, offlineThreshold, }:
|
|
25
|
+
constructor({ pks, bleHandleParams, offlineThreshold, }: BleConstructorParams);
|
|
86
26
|
private onBluetoothAdapterStateChange;
|
|
87
27
|
private onAppShow;
|
|
88
28
|
private onAppHide;
|
|
@@ -138,11 +78,11 @@ export declare class BleHandle extends EventListener<TBleHandleEvent> {
|
|
|
138
78
|
private handleWatchBleData;
|
|
139
79
|
private handleBindReq;
|
|
140
80
|
private handleLoginReq;
|
|
141
|
-
startUpgrade: ({ device, type, onEvent, onProgress, productKey }: StartUpgradeParams) => Promise<import("../
|
|
81
|
+
startUpgrade: ({ device, type, onEvent, onProgress, productKey }: StartUpgradeParams) => Promise<import("../types").IServiceResult<import("../types").OTARes>>;
|
|
142
82
|
getDeviceInfo: ({ deviceId }: {
|
|
143
83
|
deviceId: string;
|
|
144
84
|
}) => Promise<IResult<DeviceInfo>>;
|
|
145
|
-
checkUpdate: ({ device, type }: CheckOTAParams) => Promise<import("../
|
|
85
|
+
checkUpdate: ({ device, type }: CheckOTAParams) => Promise<import("../types").IServiceResult<import("../types").OTARes>>;
|
|
146
86
|
watchBleDevice: (deviceId: any, func: any) => Promise<{
|
|
147
87
|
success: boolean;
|
|
148
88
|
message: string;
|
|
@@ -163,4 +103,3 @@ export declare class BleHandle extends EventListener<TBleHandleEvent> {
|
|
|
163
103
|
private getTargetDevice;
|
|
164
104
|
destory: () => void;
|
|
165
105
|
}
|
|
166
|
-
export {};
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import DiscoverUDP from "../protocol/DiscoverUDP";
|
|
2
|
-
import { IResult } from "../
|
|
2
|
+
import { IDevice, ILanDevice, IResult, LanConnectDevice, TLanHandleEvent } from "../types";
|
|
3
3
|
import EventListener from "./EventListener";
|
|
4
|
-
interface ConnectDevice {
|
|
5
|
-
mac: string;
|
|
6
|
-
productKey: string;
|
|
7
|
-
socketHandle: TCPHandler;
|
|
8
|
-
}
|
|
9
|
-
interface ILanDevice extends IDevice {
|
|
10
|
-
expandData: DiscoverUDP;
|
|
11
|
-
ip: string;
|
|
12
|
-
}
|
|
13
|
-
type GizLanDeviceListNotifications = (devices: IDevice[]) => void;
|
|
14
|
-
type GizLanDeviceDataNotifications = (mac: string, data: string) => void;
|
|
15
|
-
export interface TLanHandleEvent {
|
|
16
|
-
GizLanDeviceList: GizLanDeviceListNotifications;
|
|
17
|
-
GizLanDeviceData: GizLanDeviceDataNotifications;
|
|
18
|
-
}
|
|
19
4
|
export declare class LanHandle extends EventListener<TLanHandleEvent> {
|
|
20
|
-
connectedList:
|
|
5
|
+
connectedList: LanConnectDevice[];
|
|
21
6
|
pks: string[];
|
|
22
7
|
scanList: ILanDevice[];
|
|
23
8
|
private boradcastTimer;
|
|
@@ -71,7 +56,7 @@ interface ITCPHandlerProps {
|
|
|
71
56
|
onClose: (ip: any) => void;
|
|
72
57
|
onData: (mac: string, data: string) => void;
|
|
73
58
|
}
|
|
74
|
-
declare class TCPHandler {
|
|
59
|
+
export declare class TCPHandler {
|
|
75
60
|
private deviceTCPPort;
|
|
76
61
|
private ip;
|
|
77
62
|
private productKey;
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
success: boolean;
|
|
3
|
-
data?: T;
|
|
4
|
-
err?: IError;
|
|
5
|
-
}
|
|
1
|
+
import { IServiceResult } from './types';
|
|
6
2
|
declare const openApiRequest: <T>(url: string, options: any, needToken?: boolean) => Promise<IServiceResult<T>>;
|
|
7
3
|
export default openApiRequest;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { IDataPointConfig } from './
|
|
2
|
-
interface IData {
|
|
3
|
-
[key: string]: IDataPointConfig;
|
|
4
|
-
}
|
|
1
|
+
import { IProductConfigData, IDataPointConfig } from './types';
|
|
5
2
|
declare class ProductConfigFileManage {
|
|
6
|
-
data:
|
|
3
|
+
data: IProductConfigData;
|
|
7
4
|
key: string;
|
|
8
5
|
init: () => Promise<void>;
|
|
9
6
|
getConfigFileMap: Record<string, Promise<IDataPointConfig | null>>;
|
|
10
7
|
getConfigFile: (pk: string) => Promise<IDataPointConfig | null>;
|
|
11
|
-
getAttrItem: (pk: string, key: string) => Promise<import("./
|
|
8
|
+
getAttrItem: (pk: string, key: string) => Promise<import("./types").IDataPointAttr>;
|
|
12
9
|
}
|
|
13
10
|
declare const productConfigFileManage: ProductConfigFileManage;
|
|
14
11
|
export default productConfigFileManage;
|
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
export interface IDataPointConfig {
|
|
2
|
-
name: string;
|
|
3
|
-
protocolType: 'var_len' | 'standard';
|
|
4
|
-
entities: IDataPointEntitie[];
|
|
5
|
-
}
|
|
6
|
-
interface IDataPointEntitie {
|
|
7
|
-
display_name: string;
|
|
8
|
-
attrs: IDataPointAttr[];
|
|
9
|
-
}
|
|
10
|
-
interface IDataPointPosition {
|
|
11
|
-
byte_offset: number;
|
|
12
|
-
unit: 'bit' | 'byte';
|
|
13
|
-
len: number;
|
|
14
|
-
bit_offset: number;
|
|
15
|
-
}
|
|
16
|
-
type TDataType = 'bool' | 'uint8' | 'uint16' | 'uint32' | 'binary' | 'enum' | 'number';
|
|
17
|
-
interface IUnitSpec {
|
|
18
|
-
addition: number;
|
|
19
|
-
max: number;
|
|
20
|
-
ratio: number;
|
|
21
|
-
min: number;
|
|
22
|
-
}
|
|
23
|
-
type TDataOptionType = 'status_writable' | 'status_readonly' | 'alert' | 'fault' | 'ALL';
|
|
24
|
-
export interface IDataPointAttr {
|
|
25
|
-
display_name: string;
|
|
26
|
-
uint_spec: IUnitSpec;
|
|
27
|
-
name: string;
|
|
28
|
-
data_type: TDataType;
|
|
29
|
-
position: IDataPointPosition;
|
|
30
|
-
type: TDataOptionType;
|
|
31
|
-
id: number;
|
|
32
|
-
enum: string[];
|
|
33
|
-
desc: string;
|
|
34
|
-
}
|
|
35
1
|
interface IRawData {
|
|
36
2
|
header: string;
|
|
37
3
|
len: string;
|
package/dist/src/randomCode.d.ts
CHANGED
package/dist/src/sdk.d.ts
CHANGED
|
@@ -1,101 +1,6 @@
|
|
|
1
|
-
import { IDataPointConfig } from './protocol/DataPoint';
|
|
2
|
-
import { OTAEventCallback, OTAProgressEventCallback } from './handler/ble';
|
|
3
1
|
import { TLogType } from './GizLog';
|
|
4
|
-
import {
|
|
5
|
-
import { ILoginRes } from './
|
|
6
|
-
import { ConfigEventData } from './wifiConfig/ConfigBase';
|
|
7
|
-
interface SyncCallBackParams {
|
|
8
|
-
event: TSyncEvnet;
|
|
9
|
-
currentNum?: number;
|
|
10
|
-
totalNum?: number;
|
|
11
|
-
message?: string;
|
|
12
|
-
}
|
|
13
|
-
type TSyncEvnet = 'SYNC_START' | 'SYNC_END' | 'SYNC_FAIL' | 'SYNC_CANCEL' | 'SYNC_PROGRESS';
|
|
14
|
-
export type SyncCallBack = (data: SyncCallBackParams) => void;
|
|
15
|
-
export type IOTAType = 'MCU' | 'MODULE';
|
|
16
|
-
export interface ISDKResult<T> {
|
|
17
|
-
data?: T;
|
|
18
|
-
err?: IError;
|
|
19
|
-
message?: string;
|
|
20
|
-
success: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface ISetCommonDeviceOnboardingDeployProps {
|
|
23
|
-
ssid: string;
|
|
24
|
-
bssid?: string;
|
|
25
|
-
password: string;
|
|
26
|
-
timeout: number;
|
|
27
|
-
isBind?: boolean;
|
|
28
|
-
mode?: 0 | 3 | 5;
|
|
29
|
-
softAPSSIDPrefix?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ISetDeviceOnboardingDeployProps extends ISetCommonDeviceOnboardingDeployProps {
|
|
32
|
-
softAPSSIDPrefix: string;
|
|
33
|
-
eventCallBack: (event: ConfigEventData) => void;
|
|
34
|
-
}
|
|
35
|
-
export interface IRandomCodesResult {
|
|
36
|
-
random_code: string;
|
|
37
|
-
product_key: string;
|
|
38
|
-
mac: string;
|
|
39
|
-
did: string;
|
|
40
|
-
user_id: string;
|
|
41
|
-
timestamp: number;
|
|
42
|
-
type: string;
|
|
43
|
-
wifi_soft_ver: string;
|
|
44
|
-
lan_proto_ver: string;
|
|
45
|
-
}
|
|
46
|
-
interface IBindRemoteDeviceParams {
|
|
47
|
-
productKey: string;
|
|
48
|
-
mac: string;
|
|
49
|
-
beOwner?: boolean;
|
|
50
|
-
alias?: string;
|
|
51
|
-
}
|
|
52
|
-
interface IDeviceStatusNoti {
|
|
53
|
-
device: IDevice;
|
|
54
|
-
connectType: TConnectType;
|
|
55
|
-
}
|
|
56
|
-
interface IDeviceAttrsNoti {
|
|
57
|
-
device: IDevice;
|
|
58
|
-
data: object;
|
|
59
|
-
}
|
|
60
|
-
export interface TListenerType {
|
|
61
|
-
GizDeviceListNotifications: TDeviceListNotifications;
|
|
62
|
-
GizDeviceStatusNotifications: TDeviceStatusNotifications;
|
|
63
|
-
GizDeviceAttrsNotifications: TDeviceAttrsNotifications;
|
|
64
|
-
onScanListChange: OnScanListChange;
|
|
65
|
-
onBleHandleError: OnBleHandleError;
|
|
66
|
-
}
|
|
67
|
-
type TDeviceListNotifications = (devices: IDevice[]) => void;
|
|
68
|
-
type TDeviceStatusNotifications = (data: IDeviceStatusNoti) => void;
|
|
69
|
-
type TDeviceAttrsNotifications = (data: IDeviceAttrsNoti) => void;
|
|
70
|
-
type OnScanListChange = (devices: IDevice[]) => void;
|
|
71
|
-
type OnBleHandleError = (error: IError) => void;
|
|
72
|
-
interface IDeviceSafetyRegisterParams {
|
|
73
|
-
mac: string;
|
|
74
|
-
productKey: string;
|
|
75
|
-
}
|
|
76
|
-
export interface IResult<T> {
|
|
77
|
-
success: boolean;
|
|
78
|
-
data?: T;
|
|
79
|
-
err?: IError;
|
|
80
|
-
}
|
|
81
|
-
interface ICloudServiceInfo {
|
|
82
|
-
openAPIInfo: string;
|
|
83
|
-
}
|
|
84
|
-
export type TimeoutHandle = ReturnType<typeof setTimeout> | null;
|
|
85
|
-
export type IntervalHandle = ReturnType<typeof setInterval> | null;
|
|
86
|
-
export interface IProductInfo {
|
|
87
|
-
productKey: string;
|
|
88
|
-
productSecret: string;
|
|
89
|
-
}
|
|
90
|
-
interface GizwitsSdkOption {
|
|
91
|
-
appID: string;
|
|
92
|
-
appSecret: string;
|
|
93
|
-
productInfo: IProductInfo[];
|
|
94
|
-
cloudServiceInfo?: ICloudServiceInfo;
|
|
95
|
-
token?: string;
|
|
96
|
-
uid?: string;
|
|
97
|
-
offlineThreshold?: number;
|
|
98
|
-
}
|
|
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';
|
|
99
4
|
declare class GizwitsMiniSDK {
|
|
100
5
|
private listenerMap;
|
|
101
6
|
private keepScanTimer;
|
|
@@ -163,7 +68,7 @@ declare class GizwitsMiniSDK {
|
|
|
163
68
|
getDeviceStatus: (device: IDevice, attrNames?: string[]) => Promise<any>;
|
|
164
69
|
subscribe: (device: IDevice, connectType?: TConnectType, _autoGetDeviceStatus?: boolean) => Promise<IResult<any> | {
|
|
165
70
|
success: boolean;
|
|
166
|
-
errorCode: IError;
|
|
71
|
+
errorCode: import("./types").IError;
|
|
167
72
|
} | {
|
|
168
73
|
success: boolean;
|
|
169
74
|
errorCode?: undefined;
|
|
@@ -173,7 +78,7 @@ declare class GizwitsMiniSDK {
|
|
|
173
78
|
}>;
|
|
174
79
|
batchSubscribe: (devices: IDevice[], connectType?: TConnectType) => Promise<{
|
|
175
80
|
success: boolean;
|
|
176
|
-
errorCode: IError;
|
|
81
|
+
errorCode: import("./types").IError;
|
|
177
82
|
} | {
|
|
178
83
|
success: boolean;
|
|
179
84
|
errorCode?: undefined;
|
|
@@ -191,7 +96,7 @@ declare class GizwitsMiniSDK {
|
|
|
191
96
|
checkUpdate: ({ device, type }: {
|
|
192
97
|
device: IDevice;
|
|
193
98
|
type: IOTAType;
|
|
194
|
-
}) => Promise<import("./
|
|
99
|
+
}) => Promise<import("./types").IServiceResult<import("./types").OTARes>>;
|
|
195
100
|
getDeviceInfo: ({ device }: {
|
|
196
101
|
device: IDevice;
|
|
197
102
|
}) => Promise<IResult<import("./protocol/DeviceInfo").default>>;
|
|
@@ -200,7 +105,7 @@ declare class GizwitsMiniSDK {
|
|
|
200
105
|
type: IOTAType;
|
|
201
106
|
onProgress: OTAProgressEventCallback;
|
|
202
107
|
onEvent: OTAEventCallback;
|
|
203
|
-
}) => Promise<import("./
|
|
108
|
+
}) => Promise<import("./types").IServiceResult<import("./types").OTARes>>;
|
|
204
109
|
unbindDevice: ({ devices, }: {
|
|
205
110
|
devices: IDevice[];
|
|
206
111
|
}) => Promise<ISDKResult<IUnbindReturn>>;
|
|
@@ -209,14 +114,14 @@ declare class GizwitsMiniSDK {
|
|
|
209
114
|
setDeviceOnboardingDeploy: ({ ssid, bssid, password, mode, timeout, isBind, softAPSSIDPrefix, eventCallBack }: ISetDeviceOnboardingDeployProps) => Promise<ISDKResult<IDevice[]>>;
|
|
210
115
|
private setDomain;
|
|
211
116
|
private deviceSafetyApi;
|
|
212
|
-
getBindingList: () => Promise<import("./
|
|
117
|
+
getBindingList: () => Promise<import("./types").IServiceResult<IDevice[]>>;
|
|
213
118
|
getDevices: () => Promise<ISDKResult<IDevice[]>>;
|
|
214
119
|
stopDeviceOnboardingDeploy: () => void;
|
|
215
120
|
setLogLevel: (level: TLogType) => {
|
|
216
121
|
success: boolean;
|
|
217
|
-
err: IError;
|
|
122
|
+
err: import("./types").IError;
|
|
218
123
|
};
|
|
219
|
-
renameDevice: (device: IDevice, name: string) => Promise<import("./
|
|
124
|
+
renameDevice: (device: IDevice, name: string) => Promise<import("./types").IServiceResult<import("./services/devices").IRenamePropsReturn> | {
|
|
220
125
|
success: boolean;
|
|
221
126
|
message: string;
|
|
222
127
|
}>;
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import { IServiceResult } from '../
|
|
2
|
-
import { IRandomCodesResult } from '../sdk';
|
|
3
|
-
export interface IOpenApiDevice {
|
|
4
|
-
product_key: string;
|
|
5
|
-
did: string;
|
|
6
|
-
mac: string;
|
|
7
|
-
passcode: string;
|
|
8
|
-
is_online: boolean;
|
|
9
|
-
host: string;
|
|
10
|
-
port: string;
|
|
11
|
-
port_s: string;
|
|
12
|
-
ws_port: number;
|
|
13
|
-
wss_port: number;
|
|
14
|
-
dev_alias: string;
|
|
15
|
-
remark: string;
|
|
16
|
-
type: 'normal' | 'center_control' | 'sub_dev';
|
|
17
|
-
}
|
|
1
|
+
import { IDevice, IOpenApiDevice, IRandomCodesResult, IServiceResult } from '../types';
|
|
18
2
|
export declare const getBindingList: () => Promise<IServiceResult<IDevice[]>>;
|
|
19
3
|
export interface IBindMacParams {
|
|
20
4
|
mac: string;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
expire_at: number;
|
|
3
|
-
token: string;
|
|
4
|
-
uid: string;
|
|
5
|
-
}
|
|
1
|
+
import { ILoginRes } from "../types";
|
|
6
2
|
export declare function AnonymousLogin({ uid }: {
|
|
7
3
|
uid: string;
|
|
8
|
-
}): Promise<import("../
|
|
4
|
+
}): Promise<import("../types").IServiceResult<ILoginRes>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDevice } from '../types';
|
|
1
2
|
type EventType = "BleDeviceConnectStart" | "BleDeviceConnectEnd" | "BleDeviceConnectBind" | "BleDeviceConnectLogin" | "BleDeviceConnectFinish";
|
|
2
3
|
type FailureType = Omit<EventType, 'BleDeviceConnectStart' | 'BleDeviceConnectFinish'>;
|
|
3
4
|
interface IProps {
|
|
@@ -7,5 +8,5 @@ interface IProps {
|
|
|
7
8
|
success: boolean;
|
|
8
9
|
failureType?: FailureType;
|
|
9
10
|
}
|
|
10
|
-
export declare function reportEvent({ device, eventID, eventType, success, failureType }: IProps): Promise<import("../
|
|
11
|
+
export declare function reportEvent({ device, eventID, eventType, success, failureType }: IProps): Promise<import("../types").IServiceResult<any>>;
|
|
11
12
|
export {};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { IOTAType } from "../
|
|
2
|
-
export interface OTARes {
|
|
3
|
-
download_url: string;
|
|
4
|
-
soft_ver: string;
|
|
5
|
-
}
|
|
1
|
+
import { IOTAType, OTARes } from "../types";
|
|
6
2
|
export declare function checkUpdate({ did, type, hardVersion, softVersion }: {
|
|
7
3
|
did: string;
|
|
8
4
|
type: IOTAType;
|
|
9
5
|
hardVersion: string;
|
|
10
6
|
softVersion: string;
|
|
11
|
-
}): Promise<import("../
|
|
7
|
+
}): Promise<import("../types").IServiceResult<OTARes>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IDevice } from "../types";
|
|
1
2
|
export interface IUploadRes {
|
|
2
3
|
}
|
|
3
4
|
interface IData {
|
|
@@ -9,5 +10,5 @@ interface IProps {
|
|
|
9
10
|
data: IData[];
|
|
10
11
|
productSecret: string;
|
|
11
12
|
}
|
|
12
|
-
export declare function uploadP0({ device, data, productSecret }: IProps): Promise<import("../
|
|
13
|
+
export declare function uploadP0({ device, data, productSecret }: IProps): Promise<import("../types").IServiceResult<IUploadRes>>;
|
|
13
14
|
export {};
|