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.
Files changed (55) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +3 -3
  3. package/dist/src/GizLog.d.ts +1 -1
  4. package/dist/src/errorCode.d.ts +1 -3
  5. package/dist/src/handler/ble.d.ts +5 -66
  6. package/dist/src/handler/lan.d.ts +3 -18
  7. package/dist/src/handler/socket.d.ts +1 -0
  8. package/dist/src/openApiRequest.d.ts +1 -5
  9. package/dist/src/productConfigFileManage.d.ts +3 -6
  10. package/dist/src/protocol/OTA/CheckCanOTA.d.ts +1 -1
  11. package/dist/src/protocol/{DataPoint.d.ts → dataPoint.d.ts} +0 -34
  12. package/dist/src/randomCode.d.ts +1 -5
  13. package/dist/src/sdk.d.ts +9 -104
  14. package/dist/src/services/devices.d.ts +1 -17
  15. package/dist/src/services/login.d.ts +2 -6
  16. package/dist/src/services/monitor.d.ts +2 -1
  17. package/dist/src/services/ota.d.ts +2 -6
  18. package/dist/src/services/uploadP0.d.ts +2 -1
  19. package/dist/src/types/index.d.ts +360 -0
  20. package/dist/src/utils.d.ts +1 -6
  21. package/dist/src/wechatApi.d.ts +1 -22
  22. package/dist/src/wifiConfig/ConfigBase.d.ts +2 -9
  23. package/dist/src/wifiConfig/ap.d.ts +1 -11
  24. package/dist/src/wifiConfig/ble.d.ts +2 -8
  25. package/dist/src/wifiConfig/nfc/index.d.ts +2 -2
  26. package/global.d.ts +3 -19
  27. package/index.ts +2 -1
  28. package/package.json +2 -2
  29. package/src/errorCode.ts +3 -3
  30. package/src/handler/ble.ts +4 -79
  31. package/src/handler/lan.ts +3 -24
  32. package/src/handler/socket.ts +3 -0
  33. package/src/openApiRequest.ts +2 -14
  34. package/src/productConfigFileManage.ts +3 -5
  35. package/src/protocol/OTA/AwaitNoti.ts +0 -2
  36. package/src/protocol/OTA/CheckCanOTA.ts +1 -2
  37. package/src/protocol/OTA/OTAPackPackage.ts +1 -1
  38. package/src/protocol/OTA/PreOTA.ts +2 -3
  39. package/src/protocol/OTA/ResetPosition.ts +1 -2
  40. package/src/protocol/dataPoint.ts +1 -42
  41. package/src/randomCode.ts +1 -12
  42. package/src/sdk.ts +11 -114
  43. package/src/services/devices.ts +2 -22
  44. package/src/services/login.ts +1 -5
  45. package/src/services/monitor.ts +1 -0
  46. package/src/services/ota.ts +1 -5
  47. package/src/services/uploadP0.ts +1 -0
  48. package/src/types/index.ts +455 -0
  49. package/src/utils.ts +1 -6
  50. package/src/wechatApi.ts +1 -22
  51. package/src/wifiConfig/ConfigBase.ts +2 -10
  52. package/src/wifiConfig/ap.ts +1 -13
  53. package/src/wifiConfig/ble.ts +2 -9
  54. package/src/wifiConfig/nfc/index.ts +1 -4
  55. package/src/global.d.ts +0 -52
@@ -0,0 +1,455 @@
1
+ import { TCPHandler } from "../handler/lan";
2
+ import DiscoverUDP from "../protocol/DiscoverUDP";
3
+ import { wrapErrorInfo } from "../utils";
4
+
5
+
6
+ export type TUtf8 = {
7
+ toBytes: (data: any) => any
8
+ }
9
+
10
+ export type TUtils = {
11
+ utf8: TUtf8;
12
+ }
13
+
14
+ export interface ecb {
15
+ new(data: any): any;
16
+ }
17
+
18
+ export type TModeOfOperation = {
19
+ ecb: ecb;
20
+ }
21
+ export interface IError {
22
+ errorCode: number;
23
+ errorMessage?: string;
24
+ }
25
+
26
+ export interface ICommonObj {
27
+ [key: string]: any
28
+ }
29
+
30
+ export interface IDeviceStatusChangedProps {
31
+ did: string;
32
+ attrs: ICommonObj;
33
+ }
34
+
35
+ export interface IDeviceRawStatusChangedProps {
36
+ did: string;
37
+ raw: Uint8Array;
38
+ }
39
+
40
+ export interface IOnDeviceStatusChanged {
41
+ (data: IDeviceStatusChangedProps | IDeviceRawStatusChangedProps): void;
42
+ }
43
+
44
+ export interface IOnSocketStatusChanged {
45
+ (dids: string[], enabled: boolean): void;
46
+ }
47
+
48
+ export interface IEmptyFn {
49
+ (): void;
50
+ }
51
+
52
+ export interface IDevice {
53
+ mac: string;
54
+ productKey: string;
55
+ did: string;
56
+ bleWorkStatus?: number; // 0 默认状态 1 配网状态
57
+ name: string;
58
+ isBind: boolean;
59
+ rootDeviceId?: string;
60
+ bleDeviceID?: string;
61
+ remark?: string;
62
+ passcode?: string;
63
+ connectType: TConnectType;
64
+ isOnline: boolean; // 代表大循环在线
65
+ isLanOnline: boolean; // 代表小循环在线
66
+ isBleOnline: boolean; // 代表蓝牙在线
67
+ host?: string;
68
+ wss_port?: number;
69
+ ctime?: number;
70
+ }
71
+
72
+ export type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';
73
+
74
+ export interface IBluetoothAdapterStateResult {
75
+ discovering: boolean;
76
+ available: boolean;
77
+ }
78
+
79
+ export interface IWechatResult {
80
+ errMsg: string;
81
+ errCode: number;
82
+ }
83
+
84
+ export interface IWXDevicesResult {
85
+ success: true;
86
+ bleDevices: WechatMiniprogram.BlueToothDevice[];
87
+ }
88
+
89
+ /**sdk */
90
+
91
+ export interface SyncCallBackParams {
92
+ event: TSyncEvnet;
93
+ currentNum?: number;
94
+ totalNum?: number;
95
+ message?: string;
96
+ }
97
+ export type TSyncEvnet = 'SYNC_START' | 'SYNC_END' | 'SYNC_FAIL' | 'SYNC_CANCEL' | 'SYNC_PROGRESS';
98
+ export type SyncCallBack = (data: SyncCallBackParams) => void
99
+ export type IOTAType = 'MCU' | 'MODULE'
100
+
101
+ // 接口返回格式
102
+ export interface ISDKResult<T> {
103
+ data?: T;
104
+ err?: IError;
105
+ message?: string;
106
+ success: boolean;
107
+ }
108
+ export interface ISetCommonDeviceOnboardingDeployProps {
109
+ ssid: string;
110
+ bssid?: string;
111
+ password: string;
112
+ timeout: number;
113
+ isBind?: boolean;
114
+ mode?: 0 | 3 | 5; // 0 AP 3 BLE 5 NFC
115
+ softAPSSIDPrefix?: string;
116
+ }
117
+
118
+ export interface ISetDeviceOnboardingDeployProps
119
+ extends ISetCommonDeviceOnboardingDeployProps {
120
+ softAPSSIDPrefix: string;
121
+ eventCallBack: (event: ConfigEventData) => void, // 配网回调
122
+ }
123
+
124
+ export interface IRandomCodesResult {
125
+ random_code: string;
126
+ product_key: string;
127
+ mac: string;
128
+ did: string;
129
+ user_id: string;
130
+ timestamp: number;
131
+ type: string;
132
+ wifi_soft_ver: string;
133
+ lan_proto_ver: string;
134
+ }
135
+
136
+ export interface IBindRemoteDeviceParams {
137
+ productKey: string;
138
+ mac: string;
139
+ beOwner?: boolean;
140
+ alias?: string;
141
+ }
142
+
143
+ export interface IDeviceStatusNoti {
144
+ device: IDevice;
145
+ connectType: TConnectType;
146
+ }
147
+ export interface IDeviceAttrsNoti {
148
+ device: IDevice;
149
+ data: object;
150
+ }
151
+
152
+ export interface TListenerType {
153
+ GizDeviceListNotifications: TDeviceListNotifications;
154
+ GizDeviceStatusNotifications: TDeviceStatusNotifications;
155
+ GizDeviceAttrsNotifications: TDeviceAttrsNotifications;
156
+ onScanListChange: OnScanListChange;
157
+ onBleHandleError: OnBleHandleError;
158
+ }
159
+
160
+ export type TDeviceListNotifications = (devices: IDevice[]) => void;
161
+ export type TDeviceStatusNotifications = (data: IDeviceStatusNoti) => void;
162
+ export type TDeviceAttrsNotifications = (data: IDeviceAttrsNoti) => void;
163
+ export type OnScanListChange = (devices: IDevice[]) => void;
164
+ export type OnBleHandleError = (error: IError) => void;
165
+
166
+ export interface IDeviceSafetyRegisterParams {
167
+ mac: string;
168
+ productKey: string;
169
+ }
170
+
171
+ export interface IDeviceSafetyParams extends IDeviceSafetyRegisterParams {
172
+ isReset: boolean;
173
+ }
174
+ export interface IResult<T> {
175
+ success: boolean;
176
+ data?: T;
177
+ err?: IError;
178
+ }
179
+
180
+ export interface ICloudServiceInfo {
181
+ openAPIInfo: string;
182
+ }
183
+
184
+ export type TimeoutHandle = ReturnType<typeof setTimeout> | null;
185
+ export type IntervalHandle = ReturnType<typeof setInterval> | null;
186
+ export interface IProductInfo {
187
+ productKey: string;
188
+ productSecret: string;
189
+ }
190
+ export interface GizwitsSdkOption {
191
+ appID: string;
192
+ appSecret: string;
193
+ productInfo: IProductInfo[];
194
+ cloudServiceInfo?: ICloudServiceInfo;
195
+ token?: string;
196
+ uid?: string;
197
+ offlineThreshold?: number;
198
+ }
199
+
200
+ /**sdk */
201
+
202
+
203
+ export interface IRejectCallback {
204
+ (result: IResult<unknown>): void;
205
+ }
206
+ export type TConfigEvent = 'GIZ_CONFIG_START' | 'GIZ_DISCOVER_SUCCESS' | 'GIZ_CONNECT_SUCCESS' | 'GIZ_CONFIG_SEND_SUCCESS' | 'GIZ_CONFIG_RECV_SUCCESS' | 'GIZ_CONFIG_SUCCESS'
207
+ export interface ConfigEventData {
208
+ event: TConfigEvent;
209
+ deviceID?: string;
210
+ }
211
+
212
+ export interface IOpenApiDevice {
213
+ product_key: string;
214
+ did: string;
215
+ mac: string;
216
+ passcode: string;
217
+ is_online: boolean;
218
+ host: string;
219
+ port: string;
220
+ port_s: string;
221
+ ws_port: number;
222
+ wss_port: number;
223
+ dev_alias: string;
224
+ remark: string;
225
+ type: 'normal' | 'center_control' | 'sub_dev';
226
+ }
227
+
228
+ export interface IDeviceRes {
229
+ devices: IOpenApiDevice[];
230
+ }
231
+
232
+ export interface IErrorCode {
233
+ [key: string]: IError;
234
+ }
235
+
236
+ export interface IWechatApiResult<T> {
237
+ data: T;
238
+ errMsg: string;
239
+ statusCode: number;
240
+ }
241
+
242
+ export interface IServiceResult<T> {
243
+ success: boolean;
244
+ data?: T;
245
+ err?: IError;
246
+ }
247
+
248
+
249
+ export interface IGetRandomCodes {
250
+ SSID: string;
251
+ password: string;
252
+ pks: string[];
253
+ }
254
+
255
+ export interface IGetRandomCode {
256
+ SSID: string;
257
+ password: string;
258
+ pk: string;
259
+ }
260
+
261
+
262
+ export interface IProductConfigData {
263
+ [key: string]: IDataPointConfig;
264
+ }
265
+
266
+
267
+ export interface IDataPointConfig {
268
+ name: string;
269
+ protocolType: 'var_len' | 'standard';
270
+ entities: IDataPointEntitie[];
271
+ }
272
+
273
+
274
+
275
+ export interface IDataPointEntitie {
276
+ display_name: string;
277
+ attrs: IDataPointAttr[];
278
+ }
279
+
280
+ export interface IDataPointPosition {
281
+ byte_offset: number;
282
+ unit: 'bit' | 'byte';
283
+ len: number;
284
+ bit_offset: number;
285
+ }
286
+
287
+ export type TDataType = 'bool' | 'uint8' | 'uint16' | 'uint32' | 'binary' | 'enum' | 'number';
288
+
289
+
290
+ export interface IUnitSpec {
291
+ addition: number;
292
+ max: number;
293
+ ratio: number;
294
+ min: number;
295
+ }
296
+
297
+ export type TDataOptionType = 'status_writable' | 'status_readonly' | 'alert' | 'fault' | 'ALL';
298
+ export interface IDataPointAttr {
299
+ display_name: string;
300
+ uint_spec: IUnitSpec;
301
+ name:string;
302
+ data_type: TDataType;
303
+ position: IDataPointPosition;
304
+ type: TDataOptionType;
305
+ id: number;
306
+ enum: string[];
307
+ desc: string;
308
+ }
309
+
310
+ /**
311
+ * 蓝牙
312
+ */
313
+
314
+ export type GizBleDeviceListotifications = (devices: IDevice[]) => void;
315
+ export type GizBleDeviceDataNotifications = (
316
+ curDevice: WechatMiniprogram.OnBLECharacteristicValueChangeListenerResult,
317
+ hexString: string
318
+ ) => void;
319
+ export type GizBleErrorNotifications = (err: { errCode: number; errMsg: string }) => void;
320
+ // 返回true 代表放弃监听
321
+ export type TBleDataListener<T> = (_curDevice: WechatMiniprogram.OnBLECharacteristicValueChangeListenerResult,
322
+ hexString: string) => T | null | undefined;
323
+
324
+ export interface CheckOTAParams {
325
+ device: IDevice;
326
+ type: IOTAType;
327
+ }
328
+
329
+ export type OTAEventCode = 'GizOTAEventPretreatment' | 'GizOTAEventDownload' | 'GizOTAEventTransmit' | 'GizOTAEventReboot' | 'GizOTAEventFinish'
330
+ export interface OTAEvent {
331
+ code: OTAEventCode; //
332
+ };
333
+ export interface OTAProgressEvent {
334
+ firmwareSize: number;
335
+ packageMaxLen: number;
336
+ currentNumber: number;
337
+ currentProgress: number; // 0 ~ 100
338
+ }
339
+
340
+ export type OTAProgressEventCallback = (event: OTAProgressEvent) => void;
341
+ export type OTAEventCallback = (event: OTAEvent) => void;
342
+ export interface StartUpgradeParams extends CheckOTAParams {
343
+ onProgress: OTAProgressEventCallback
344
+ onEvent: OTAEventCallback
345
+ productKey: string
346
+ }
347
+
348
+
349
+ export interface TBleHandleEvent {
350
+ GizBleDeviceData: GizBleDeviceDataNotifications;
351
+ GizBleDeviceList: GizBleDeviceListotifications;
352
+ GizBleError: GizBleErrorNotifications;
353
+ }
354
+
355
+ export interface GizwitsWxBlueToothDevice extends WechatMiniprogram.BlueToothDevice {
356
+ communicationType: 'BLE_BROADCAST' | 'BLE';
357
+ }
358
+
359
+ export interface BleHandleParams {
360
+ serviceUUIDSuffix: string;
361
+ characteristicUUIDSuffix: string;
362
+ }
363
+
364
+ export interface IStartScanResult {
365
+ scanList: IDevice[];
366
+ err?: ReturnType<typeof wrapErrorInfo>;
367
+ }
368
+
369
+ export interface IDeviceReq<T> {
370
+ success: boolean;
371
+ data: T;
372
+ }
373
+
374
+ // export type BleHandle = ReturnType<typeof createBleHandle>;
375
+
376
+ export type OnScanDevice = (scanList: IDevice[]) => void;
377
+ export interface BleConnectDevice {
378
+ deviceId?: string;
379
+ serviceId?: string;
380
+ characteristicId?: string;
381
+ errMsg?: string;
382
+ }
383
+
384
+ export interface BleConstructorParams {
385
+ pks: string[];
386
+ bleHandleParams?: BleHandleParams;
387
+ offlineThreshold?: number;
388
+ }
389
+ /**
390
+ * 蓝牙
391
+ */
392
+
393
+
394
+
395
+ // 局域网连接设备结构
396
+ export interface LanConnectDevice {
397
+ mac: string
398
+ productKey: string
399
+ socketHandle: TCPHandler
400
+ }
401
+
402
+ // 局域网设备
403
+ export interface ILanDevice extends IDevice {
404
+ expandData: DiscoverUDP
405
+ ip: string
406
+ }
407
+
408
+ export type GizLanDeviceListNotifications = (devices: IDevice[]) => void;
409
+ export type GizLanDeviceDataNotifications = (mac: string, data: string) => void;
410
+ export interface TLanHandleEvent {
411
+ GizLanDeviceList: GizLanDeviceListNotifications;
412
+ GizLanDeviceData: GizLanDeviceDataNotifications
413
+ }
414
+
415
+
416
+
417
+ export interface IBLEService {
418
+ uuid: string;
419
+ isPrimary: boolean;
420
+ }
421
+ export interface IBLECharacteristic {
422
+ uuid: string;
423
+ properties: {
424
+ read: boolean;
425
+ write: boolean;
426
+ notify: boolean;
427
+ indicate: boolean;
428
+ }
429
+ }
430
+
431
+ export interface ILoginRes {
432
+ expire_at: number;
433
+ token: string;
434
+ uid: string;
435
+ }
436
+
437
+ export interface OTARes {
438
+ download_url: string;
439
+ soft_ver: string; // 新的版本号
440
+ }
441
+
442
+ export interface configDeviceParams {
443
+ ssid: string;
444
+ password: string;
445
+ softAPSSIDPrefix: string;
446
+ }
447
+
448
+
449
+
450
+ export interface configBLEDeviceParams {
451
+ ssid: string;
452
+ password: string;
453
+ softAPSSIDPrefix?: string;
454
+ timeout: number;
455
+ }
package/src/utils.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { lib } from "crypto-js/core";
2
2
 
3
- import { IProductInfo } from './sdk';
4
- import { GizwitsWxBlueToothDevice } from './handler/ble';
5
3
  import GizLog from './GizLog';
4
+ import { IDevice, IError, IWXDevicesResult, TConnectType, IProductInfo, GizwitsWxBlueToothDevice } from "./types";
6
5
 
7
6
  export function ab2hex(buffer: ArrayBuffer) {
8
7
  let hexArr = Array.prototype.map.call(new Uint8Array(buffer), function (bit) {
@@ -55,10 +54,6 @@ export const unionBy = <T>(array: T[], key: string) => {
55
54
  }, []);
56
55
  };
57
56
 
58
- interface IWXDevicesResult {
59
- success: true;
60
- bleDevices: WechatMiniprogram.BlueToothDevice[];
61
- }
62
57
  export function isWXDevicesResult(res: unknown): res is IWXDevicesResult {
63
58
  return (
64
59
  (res as IWXDevicesResult).success &&
package/src/wechatApi.ts CHANGED
@@ -1,15 +1,7 @@
1
1
  import GizLog from "./GizLog";
2
2
  import sleep from "./sleep";
3
+ import { IBluetoothAdapterStateResult, IWechatResult, IBLEService, IBLECharacteristic } from "./types";
3
4
 
4
- interface IBluetoothAdapterStateResult {
5
- discovering: boolean;
6
- available: boolean;
7
- }
8
-
9
- export interface IWechatResult {
10
- errMsg: string;
11
- errCode: number;
12
- }
13
5
 
14
6
  /**
15
7
  * 重连
@@ -98,10 +90,6 @@ export function createBLEConnection(deviceId: string, timeout: number) {
98
90
  })
99
91
  }
100
92
 
101
- interface IBLEService {
102
- uuid: string;
103
- isPrimary: boolean;
104
- }
105
93
 
106
94
  export function getBLEDeviceServices(deviceId: string) {
107
95
  return new Promise<IBLEService[]>((res, rej) => {
@@ -113,15 +101,6 @@ export function getBLEDeviceServices(deviceId: string) {
113
101
  })
114
102
  }
115
103
 
116
- interface IBLECharacteristic {
117
- uuid: string;
118
- properties: {
119
- read: boolean;
120
- write: boolean;
121
- notify: boolean;
122
- indicate: boolean;
123
- }
124
- }
125
104
 
126
105
  export function getBLEDeviceCharacteristics(deviceId: string, serviceId: string) {
127
106
  return new Promise<IBLECharacteristic[]>((res, rej) => {
@@ -1,18 +1,10 @@
1
- import { IRandomCodesResult, IResult, TimeoutHandle } from "../sdk";
1
+ import { IRandomCodesResult, IRejectCallback, IResult, TimeoutHandle } from "../types";
2
2
  import sleep from "../sleep";
3
3
  import errorCode from "../errorCode";
4
4
  import { bindMac, checkDeviceRegister } from '../services/devices';
5
5
  import GizLog from "../GizLog";
6
+ import { ConfigEventData, IDevice } from "../types";
6
7
  // import timeZoneDic from './timeZoneName.json'
7
-
8
- interface IRejectCallback {
9
- (result: IResult<unknown>): void;
10
- }
11
- export type TConfigEvent = 'GIZ_CONFIG_START' | 'GIZ_DISCOVER_SUCCESS' | 'GIZ_CONNECT_SUCCESS' | 'GIZ_CONFIG_SEND_SUCCESS' | 'GIZ_CONFIG_RECV_SUCCESS' | 'GIZ_CONFIG_SUCCESS'
12
- export interface ConfigEventData {
13
- event: TConfigEvent;
14
- deviceID?: string;
15
- }
16
8
  class ConfigBase {
17
9
  ssid = '';
18
10
  bssid = '';
@@ -1,21 +1,9 @@
1
1
  import errorCode from "../errorCode";
2
2
  import GizLog from "../GizLog";
3
3
  import WifiConfig from "../protocol/WifiConfig";
4
- import { IRandomCodesResult, IResult, IntervalHandle } from "../sdk";
4
+ import { IDevice, IRandomCodesResult, IResult, IntervalHandle, configDeviceParams, ISetDeviceOnboardingDeployProps } from "../types";
5
5
  import ConfigBase from "./ConfigBase";
6
6
 
7
-
8
- interface configDeviceParams {
9
- ssid: string;
10
- password: string;
11
- softAPSSIDPrefix: string;
12
- }
13
-
14
- interface ISetDeviceOnboardingDeployProps {
15
- timeout: number;
16
- isBind: boolean;
17
- softAPSSIDPrefix: string;
18
- }
19
7
  class ApConfig extends ConfigBase {
20
8
 
21
9
  disableSendUDP = false;
@@ -1,5 +1,4 @@
1
1
  import errorCode from "../errorCode";
2
- import { IRandomCodesResult, IResult } from "../sdk";
3
2
  import { ab2hex, advertisData2PkAndMac, isWXDevicesResult } from '../utils';
4
3
 
5
4
  import GizLog from "../GizLog";
@@ -10,7 +9,8 @@ import {
10
9
  getBLEDeviceCharacteristics, getBLEDeviceServices, getBluetoothAdapterState, getBluetoothDevices,
11
10
  notifyBLECharacteristicValueChange, retryConnect, startBluetoothDevicesDiscovery, unpackWriteBLECharacteristicValue
12
11
  } from '../wechatApi';
13
- import ConfigBase, { ConfigEventData } from "./ConfigBase";
12
+ import ConfigBase from "./ConfigBase";
13
+ import { IDevice, IError, ConfigEventData, IRandomCodesResult, IResult, configBLEDeviceParams } from "../types";
14
14
 
15
15
  type EnableAndGetBluetoothDevicesRes = Promise<
16
16
  | { success: false; err: IError }
@@ -28,13 +28,6 @@ interface IArgs {
28
28
 
29
29
  const configAck = '0000000303000002';
30
30
 
31
- interface configBLEDeviceParams {
32
- ssid: string;
33
- password: string;
34
- softAPSSIDPrefix?: string;
35
- timeout: number;
36
- }
37
-
38
31
 
39
32
  interface ISetDeviceOnboardingDeployProps {
40
33
  timeout: number;
@@ -2,11 +2,8 @@ import { disposeData } from './disposeData';
2
2
  import { formatData } from './formatData';
3
3
  import { formatSSID } from './formatSSID';
4
4
  import { transceive } from './transceive.wx';
5
- import errorCode from "../../errorCode";
6
- import GizLog from "../../GizLog";
7
- import WifiConfig from "../../protocol/WifiConfig";
8
- import { IRandomCodesResult, IResult, IntervalHandle } from "../../sdk";
9
5
  import ConfigBase from "../ConfigBase";
6
+ import { IDevice, IResult } from '../../types';
10
7
 
11
8
  // type IParams = {
12
9
  // SSID: string;
package/src/global.d.ts DELETED
@@ -1,52 +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
- }
51
-
52
- type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';