mini_program_gizwits_sdk 3.6.4 → 3.6.6

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 (134) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
  3. package/yarn-error.log +6901 -0
  4. package/dist/src/GizLog.d.ts +0 -18
  5. package/dist/src/crc/calculators/crc16modbus.d.ts +0 -2
  6. package/dist/src/crc/calculators/crc32.d.ts +0 -2
  7. package/dist/src/crc/crc16modbus.d.ts +0 -7
  8. package/dist/src/crc/crc32.d.ts +0 -7
  9. package/dist/src/crc/create_buffer.d.ts +0 -3
  10. package/dist/src/crc/define_crc.d.ts +0 -7
  11. package/dist/src/crc/index.d.ts +0 -19
  12. package/dist/src/crc/types.d.ts +0 -11
  13. package/dist/src/errorCode.d.ts +0 -3
  14. package/dist/src/globalData.d.ts +0 -2
  15. package/dist/src/handler/EventListener.d.ts +0 -9
  16. package/dist/src/handler/ble.d.ts +0 -105
  17. package/dist/src/handler/lan.d.ts +0 -78
  18. package/dist/src/handler/socket.d.ts +0 -151
  19. package/dist/src/openApiRequest.d.ts +0 -3
  20. package/dist/src/productConfigFileManage.d.ts +0 -11
  21. package/dist/src/protocol/Bind.d.ts +0 -7
  22. package/dist/src/protocol/DeviceInfo.d.ts +0 -11
  23. package/dist/src/protocol/DiscoverUDP.d.ts +0 -17
  24. package/dist/src/protocol/GetDeviceStatus.d.ts +0 -5
  25. package/dist/src/protocol/Login.d.ts +0 -12
  26. package/dist/src/protocol/Ntp.d.ts +0 -5
  27. package/dist/src/protocol/OTA/AwaitNoti.d.ts +0 -7
  28. package/dist/src/protocol/OTA/CheckCanOTA.d.ts +0 -10
  29. package/dist/src/protocol/OTA/OTAPackPackage.d.ts +0 -8
  30. package/dist/src/protocol/OTA/OtaComplete.d.ts +0 -8
  31. package/dist/src/protocol/OTA/PreOTA.d.ts +0 -11
  32. package/dist/src/protocol/OTA/ResetPosition.d.ts +0 -6
  33. package/dist/src/protocol/OffLineData.d.ts +0 -23
  34. package/dist/src/protocol/ProtocolBase.d.ts +0 -11
  35. package/dist/src/protocol/Reset.d.ts +0 -8
  36. package/dist/src/protocol/SetReset.d.ts +0 -7
  37. package/dist/src/protocol/WifiConfig.d.ts +0 -6
  38. package/dist/src/protocol/dataPoint.d.ts +0 -34
  39. package/dist/src/protocol/tool.d.ts +0 -14
  40. package/dist/src/randomCode.d.ts +0 -3
  41. package/dist/src/request.d.ts +0 -1
  42. package/dist/src/sdk.d.ts +0 -136
  43. package/dist/src/sentry.d.ts +0 -2
  44. package/dist/src/services/devices.d.ts +0 -47
  45. package/dist/src/services/login.d.ts +0 -4
  46. package/dist/src/services/monitor.d.ts +0 -12
  47. package/dist/src/services/ota.d.ts +0 -7
  48. package/dist/src/services/tool.d.ts +0 -4
  49. package/dist/src/services/uploadP0.d.ts +0 -14
  50. package/dist/src/sleep.d.ts +0 -2
  51. package/dist/src/types/index.d.ts +0 -361
  52. package/dist/src/utils.d.ts +0 -46
  53. package/dist/src/wechatApi.d.ts +0 -19
  54. package/dist/src/wifiConfig/ConfigBase.d.ts +0 -27
  55. package/dist/src/wifiConfig/ap.d.ts +0 -11
  56. package/dist/src/wifiConfig/ble.d.ts +0 -41
  57. package/dist/src/wifiConfig/nfc/disposeData.d.ts +0 -2
  58. package/dist/src/wifiConfig/nfc/formatData.d.ts +0 -3
  59. package/dist/src/wifiConfig/nfc/formatSSID.d.ts +0 -6
  60. package/dist/src/wifiConfig/nfc/index.d.ts +0 -22
  61. package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +0 -1
  62. package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +0 -6
  63. package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +0 -5
  64. package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +0 -1
  65. package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +0 -1
  66. package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +0 -2
  67. package/dist/src/wifiConfig/nfc/types.d.ts +0 -15
  68. package/index.ts +0 -8
  69. package/src/GizLog.ts +0 -51
  70. package/src/crc/calculators/crc16modbus.ts +0 -36
  71. package/src/crc/calculators/crc32.ts +0 -47
  72. package/src/crc/crc16modbus.ts +0 -3
  73. package/src/crc/crc32.ts +0 -4
  74. package/src/crc/create_buffer.ts +0 -7
  75. package/src/crc/define_crc.ts +0 -9
  76. package/src/crc/index.ts +0 -10
  77. package/src/crc/package.json +0 -3
  78. package/src/crc/types.ts +0 -10
  79. package/src/errorCode.ts +0 -83
  80. package/src/globalData.ts +0 -9
  81. package/src/handler/EventListener.ts +0 -44
  82. package/src/handler/ble.ts +0 -1369
  83. package/src/handler/lan.ts +0 -389
  84. package/src/handler/socket.ts +0 -686
  85. package/src/openApiRequest.ts +0 -50
  86. package/src/productConfigFileManage.ts +0 -72
  87. package/src/protocol/Bind.ts +0 -22
  88. package/src/protocol/DeviceInfo.ts +0 -37
  89. package/src/protocol/DiscoverUDP.ts +0 -80
  90. package/src/protocol/GetDeviceStatus.ts +0 -61
  91. package/src/protocol/Login.ts +0 -43
  92. package/src/protocol/Ntp.ts +0 -13
  93. package/src/protocol/OTA/AwaitNoti.ts +0 -14
  94. package/src/protocol/OTA/CheckCanOTA.ts +0 -23
  95. package/src/protocol/OTA/OTAPackPackage.ts +0 -37
  96. package/src/protocol/OTA/OtaComplete.ts +0 -17
  97. package/src/protocol/OTA/PreOTA.ts +0 -48
  98. package/src/protocol/OTA/ResetPosition.ts +0 -14
  99. package/src/protocol/OffLineData.ts +0 -81
  100. package/src/protocol/ProtocolBase.ts +0 -54
  101. package/src/protocol/Reset.ts +0 -16
  102. package/src/protocol/SetReset.ts +0 -13
  103. package/src/protocol/WifiConfig.ts +0 -42
  104. package/src/protocol/dataPoint.ts +0 -687
  105. package/src/protocol/tool.ts +0 -140
  106. package/src/randomCode.ts +0 -25
  107. package/src/request.ts +0 -22
  108. package/src/sdk.ts +0 -1536
  109. package/src/sentry.ts +0 -55
  110. package/src/services/devices.ts +0 -313
  111. package/src/services/login.ts +0 -11
  112. package/src/services/monitor.ts +0 -117
  113. package/src/services/ota.ts +0 -17
  114. package/src/services/tool.ts +0 -10
  115. package/src/services/uploadP0.ts +0 -57
  116. package/src/sleep.ts +0 -2
  117. package/src/types/index.ts +0 -456
  118. package/src/utils.ts +0 -449
  119. package/src/wechatApi.ts +0 -211
  120. package/src/wifiConfig/ConfigBase.ts +0 -235
  121. package/src/wifiConfig/ap.ts +0 -185
  122. package/src/wifiConfig/ble.ts +0 -460
  123. package/src/wifiConfig/nfc/disposeData.ts +0 -63
  124. package/src/wifiConfig/nfc/formatData.ts +0 -46
  125. package/src/wifiConfig/nfc/formatSSID.ts +0 -59
  126. package/src/wifiConfig/nfc/index.ts +0 -134
  127. package/src/wifiConfig/nfc/isIncludedCH.ts +0 -8
  128. package/src/wifiConfig/nfc/nfcAConnect.ts +0 -30
  129. package/src/wifiConfig/nfc/nfcATransceive.ts +0 -29
  130. package/src/wifiConfig/nfc/ssIDToASC.ts +0 -12
  131. package/src/wifiConfig/nfc/stringToGbk.ts +0 -51
  132. package/src/wifiConfig/nfc/transceive.wx.ts +0 -124
  133. package/src/wifiConfig/nfc/types.ts +0 -18
  134. package/src/wifiConfig/timeZoneName.json +0 -1
@@ -1,18 +0,0 @@
1
- export type TLogType = 'debug' | 'info' | 'warn' | 'error';
2
- declare class Log {
3
- logMap: {
4
- id: string;
5
- }[];
6
- console: Console;
7
- debug: (...data: any[]) => void;
8
- info: (...data: any[]) => void;
9
- log: (...data: any[]) => void;
10
- warn: (...data: any[]) => void;
11
- error: (info: string, error: Error) => void;
12
- setLogLevel: (type: TLogType) => {
13
- success: boolean;
14
- err: import("./types").IError;
15
- };
16
- }
17
- declare const _default: Log;
18
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const crc16modbus: (current: any, previous: any) => number;
2
- export default crc16modbus;
@@ -1,2 +0,0 @@
1
- declare const crc32: (current: any, previous: any) => number;
2
- export default crc32;
@@ -1,7 +0,0 @@
1
- declare const _default: {
2
- (value: any, previous?: any): number;
3
- signed(value: any, previous?: any): number;
4
- unsigned: any;
5
- model: string;
6
- };
7
- export default _default;
@@ -1,7 +0,0 @@
1
- declare const _default: {
2
- (value: any, previous?: any): number;
3
- signed(value: any, previous?: any): number;
4
- unsigned: any;
5
- model: string;
6
- };
7
- export default _default;
@@ -1,3 +0,0 @@
1
- import { BufferInput } from './types';
2
- declare const createBuffer: (value: BufferInput, encoding?: BufferEncoding) => Buffer;
3
- export default createBuffer;
@@ -1,7 +0,0 @@
1
- import { CRCCalculator } from './types';
2
- export default function defineCrc(model: string, calculator: CRCCalculator<Uint8Array>): {
3
- (value: any, previous?: any): number;
4
- signed(value: any, previous?: any): number;
5
- unsigned: any;
6
- model: string;
7
- };
@@ -1,19 +0,0 @@
1
- import crc16modbus from './crc16modbus';
2
- import crc32 from './crc32';
3
- export { crc16modbus };
4
- export { crc32 };
5
- declare const _default: {
6
- crc16modbus: {
7
- (value: any, previous?: any): number;
8
- signed(value: any, previous?: any): number;
9
- unsigned: any;
10
- model: string;
11
- };
12
- crc32: {
13
- (value: any, previous?: any): number;
14
- signed(value: any, previous?: any): number;
15
- unsigned: any;
16
- model: string;
17
- };
18
- };
19
- export default _default;
@@ -1,11 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- export type BufferInput = string | ArrayBuffer | Buffer;
4
- export interface CRCCalculator<T = BufferInput | Uint8Array> {
5
- (value: T, previous?: number): number;
6
- }
7
- export interface CRCModule extends CRCCalculator<BufferInput> {
8
- signed: CRCCalculator<BufferInput>;
9
- unsigned: CRCCalculator<BufferInput>;
10
- model: string;
11
- }
@@ -1,3 +0,0 @@
1
- import { IErrorCode } from "./types";
2
- declare const errorCode: IErrorCode;
3
- export default errorCode;
@@ -1,2 +0,0 @@
1
- export declare function setGlobalData(key: any, value: any): void;
2
- export declare function getGlobalData(key: any): any;
@@ -1,9 +0,0 @@
1
- export default class EventListener<T> {
2
- listenerMap: any;
3
- addEventListener: <K extends keyof T>(type: K, func: T[K]) => Promise<{
4
- success: boolean;
5
- }>;
6
- removeEventListener: <K extends keyof T>(type: K, func: T[K]) => {
7
- success: boolean;
8
- };
9
- }
@@ -1,105 +0,0 @@
1
- import EventListener from './EventListener';
2
- import DeviceInfo from '../protocol/DeviceInfo';
3
- import { BleConnectDevice, IDevice, IResult, TBleHandleEvent, BleConstructorParams, IStartScanResult, IDeviceReq, StartUpgradeParams, CheckOTAParams } from '../types';
4
- export declare class BleHandle extends EventListener<TBleHandleEvent> {
5
- private serviceUUIDSuffix;
6
- connectedList: BleConnectDevice[];
7
- private connectingDevId;
8
- pks: string[];
9
- private listenDevOfflineTimer;
10
- private methodQueue;
11
- private boradcastTimer;
12
- private boradcastDataCache;
13
- private baseServices;
14
- private tmpBleData;
15
- private tmpDataNum;
16
- private disableScanFlag;
17
- private peripheralServer;
18
- private isActive;
19
- private isInitSuccess;
20
- private isRunInit;
21
- private _offlineThreshold;
22
- set offlineThreshold(value: any);
23
- get offlineThreshold(): any;
24
- scanList: IDevice[];
25
- constructor({ pks, bleHandleParams, offlineThreshold, }: BleConstructorParams);
26
- private onBluetoothAdapterStateChange;
27
- private onAppShow;
28
- private onAppHide;
29
- private listenDevOffline;
30
- private openBluetoothAdapter;
31
- private handleOnBLECharacteristicValueChange;
32
- private notiDeviceDataToSdk;
33
- private notifyError;
34
- private notifyDevices;
35
- private listenConnection;
36
- private init;
37
- checkPermission: () => Promise<{
38
- data: {
39
- discovering: boolean;
40
- };
41
- err: {
42
- errorCode: string;
43
- errorMessage: string;
44
- };
45
- success: boolean;
46
- } | {
47
- success: boolean;
48
- }>;
49
- private getBluetoothAdapterState;
50
- getDeviceStatus: (deviceId: string, productKey: string, gwDid?: string, attrNames?: string[]) => Promise<any>;
51
- private updateDevice;
52
- private updateCtime;
53
- private checkDeviceIsChange;
54
- private handleBluetoothDeviceFound;
55
- startScan: (delay?: number, services?: string[]) => Promise<IStartScanResult>;
56
- stopScan: () => Promise<any>;
57
- disableScan: () => Promise<WechatMiniprogram.BluetoothError>;
58
- enableScan: () => void;
59
- private connectDeviceBle;
60
- private connectDeviceBindRequest;
61
- private connectDeviceLoginRequest;
62
- private _connectDevice;
63
- connectDevice: (device: IDevice) => Promise<{
64
- success: boolean;
65
- message: any;
66
- data?: undefined;
67
- } | {
68
- success: boolean;
69
- data: {
70
- serviceId: any;
71
- characteristicId: any;
72
- };
73
- message?: undefined;
74
- } | IDeviceReq<string> | {
75
- success: boolean;
76
- message: string;
77
- }>;
78
- private handleWatchBleData;
79
- private handleBindReq;
80
- private handleLoginReq;
81
- startUpgrade: ({ device, type, onEvent, onProgress, productKey }: StartUpgradeParams) => Promise<import("../types").IServiceResult<import("../types").OTARes>>;
82
- getDeviceInfo: ({ deviceId }: {
83
- deviceId: string;
84
- }) => Promise<IResult<DeviceInfo>>;
85
- checkUpdate: ({ device, type }: CheckOTAParams) => Promise<import("../types").IServiceResult<import("../types").OTARes>>;
86
- watchBleDevice: (deviceId: any, func: any) => Promise<{
87
- success: boolean;
88
- message: string;
89
- }>;
90
- writeBoradcast: (bleDeviceID: string, value: number[]) => Promise<{
91
- success: boolean;
92
- message: string;
93
- } | {
94
- success: boolean;
95
- message?: undefined;
96
- }>;
97
- write: (bleDeviceID: any, value: any) => Promise<any>;
98
- disConnectDevice: (deviceId: string) => Promise<{
99
- err: string;
100
- success: boolean;
101
- }>;
102
- private removeDevById;
103
- private getTargetDevice;
104
- destory: () => void;
105
- }
@@ -1,78 +0,0 @@
1
- import DiscoverUDP from "../protocol/DiscoverUDP";
2
- import { IDevice, ILanDevice, IResult, LanConnectDevice, TLanHandleEvent } from "../types";
3
- import EventListener from "./EventListener";
4
- export declare class LanHandle extends EventListener<TLanHandleEvent> {
5
- connectedList: LanConnectDevice[];
6
- pks: string[];
7
- scanList: ILanDevice[];
8
- private boradcastTimer;
9
- private UDPSocket;
10
- private deviceUDPPort;
11
- private appUDPPort;
12
- private offlineThreshold;
13
- private isActive;
14
- private listenDevOfflineTimer;
15
- constructor({ pks }: {
16
- pks: any;
17
- });
18
- init: () => void;
19
- private onAppShow;
20
- private onAppHide;
21
- private listenDevOffline;
22
- private notifyDevices;
23
- private notifyDeviceData;
24
- isSameDevice: (deviceA: IDevice, deviceB: IDevice) => boolean;
25
- disConnectDevice: (target: IDevice) => {
26
- success: boolean;
27
- err?: undefined;
28
- } | {
29
- success: boolean;
30
- err: any;
31
- };
32
- onData: (mac: string, hexString: string) => void;
33
- connectDevice: (device: any) => Promise<IResult<any>>;
34
- onError: (err: any) => void;
35
- isMatchPk: (pk: any) => boolean;
36
- onMessage: (res: WechatMiniprogram.UDPSocketOnMessageListenerResult) => void;
37
- onDeviceClose: ({ productKey, mac }: {
38
- productKey: any;
39
- mac: any;
40
- }) => void;
41
- write: (device: IDevice, value: ArrayBuffer) => Promise<{
42
- success: boolean;
43
- } | {
44
- success: boolean;
45
- message: string;
46
- }>;
47
- updateDevice: (updateDevice: DiscoverUDP, ip: string) => void;
48
- sendBoradCast: () => void;
49
- private startDiscover;
50
- destory: () => void;
51
- }
52
- interface ITCPHandlerProps {
53
- ip: string;
54
- mac: string;
55
- productKey: string;
56
- onClose: (ip: any) => void;
57
- onData: (mac: string, data: string) => void;
58
- }
59
- export declare class TCPHandler {
60
- private deviceTCPPort;
61
- private ip;
62
- private productKey;
63
- private mac;
64
- private tcpHandler;
65
- private onData;
66
- private onCloseListener;
67
- constructor({ ip, onClose, mac, productKey, onData }: ITCPHandlerProps);
68
- connect: () => Promise<IResult<any>>;
69
- write: (data: ArrayBuffer) => {
70
- success: boolean;
71
- };
72
- onMessage: (message: any) => void;
73
- onError: () => void;
74
- onClose: () => void;
75
- initListener: () => void;
76
- destory: () => void;
77
- }
78
- export {};
@@ -1,151 +0,0 @@
1
- import { IDevice, IError, IOnDeviceStatusChanged, IDeviceStatusChangedProps, IDeviceRawStatusChangedProps, IOnSocketStatusChanged, IEmptyFn, ICommonObj } from "../types";
2
- interface IRespError {
3
- err?: IError;
4
- }
5
- interface IWriteRes {
6
- success: boolean;
7
- message: string;
8
- }
9
- interface ICommonProps {
10
- appID: string;
11
- token: string;
12
- uid: string;
13
- }
14
- interface IGWSProps extends ICommonProps {
15
- limitSocketNum?: boolean;
16
- }
17
- export default class GizwitsWS {
18
- appID: string;
19
- token: string;
20
- uid: string;
21
- _maxSocketNum: number;
22
- _bindingDevices: {
23
- [did: string]: IDevice;
24
- } | null;
25
- _connections: {
26
- [wsInfo: string]: Connection;
27
- };
28
- _onDeviceStatusChanged?: IOnDeviceStatusChanged;
29
- _onSocketStatusChanged?: IOnSocketStatusChanged;
30
- _onBindingChanged?: IEmptyFn;
31
- constructor({ appID, token, uid, limitSocketNum, }: IGWSProps);
32
- init(): Promise<IError>;
33
- updateToken: ({ token, uid }: {
34
- token: any;
35
- uid: any;
36
- }) => void;
37
- _getDevice: (did: string) => IDevice | IError;
38
- _getConnect: (device: IDevice) => Connection;
39
- _getDeviceAndConnect: (did: string) => [IDevice, Connection] | IError;
40
- connectDevice: (device: IDevice) => {
41
- success: boolean;
42
- errorCode: IError;
43
- } | {
44
- success: boolean;
45
- errorCode?: undefined;
46
- };
47
- connectDevices: (devices: IDevice[]) => {
48
- success: boolean;
49
- errorCode: IError;
50
- } | {
51
- success: boolean;
52
- errorCode?: undefined;
53
- };
54
- disConnectDevice: (device: IDevice) => {
55
- success: boolean;
56
- };
57
- disConnectDevices: (devices: IDevice[]) => {
58
- success: boolean;
59
- };
60
- connect: (did: string) => IError;
61
- send: (did: string, raw: number[]) => IError | Promise<IWriteRes>;
62
- writeData: (device: IDevice, attrs: ICommonObj) => Promise<IWriteRes> | {
63
- success: boolean;
64
- };
65
- write: (did: string, attrs: ICommonObj) => IError | Promise<IWriteRes>;
66
- readStatus: (device: IDevice, names?: string[]) => {
67
- success: boolean;
68
- };
69
- read: (did: string, names?: string[]) => IError | Promise<IWriteRes>;
70
- destory: () => void;
71
- subscribeDeviceStatus: (cb: IOnDeviceStatusChanged) => void;
72
- subscribeBindingChanged: (cb: IEmptyFn) => void;
73
- subscribeSocketStatus: (cb: IOnSocketStatusChanged) => void;
74
- _handleDeviceStatusChanged: IOnDeviceStatusChanged;
75
- _handleBindingChanged: () => void;
76
- _handleSocketStatusChanged: IOnSocketStatusChanged;
77
- _getBindingList: (limit?: number, skip?: number, cacheList?: IDevice[]) => Promise<IDevice[] | IRespError>;
78
- _getWebsocketConnInfo: (device: any) => string;
79
- }
80
- interface IConnectProps extends ICommonProps {
81
- wsInfo: string;
82
- onDeviceStatusChanged?: IOnDeviceStatusChanged;
83
- onBindingChanged?: IEmptyFn;
84
- onSocketStatusChanged?: IOnSocketStatusChanged;
85
- }
86
- export declare class Connection {
87
- ready: boolean;
88
- appID: string;
89
- token: string;
90
- uid: string;
91
- commType: string;
92
- _heartbeatInterval: number;
93
- _keepaliveTime: number;
94
- _loginIntveral: number;
95
- autoSubscribe: boolean;
96
- _wsUrl: string;
97
- _websocket: WechatMiniprogram.SocketTask | null;
98
- _heartbeatTimerId?: any;
99
- _loginFailedTimes: number;
100
- _subDids: Set<string>;
101
- _socketRespHandleMap: {
102
- [cmd: string]: (resp?: any) => void;
103
- };
104
- _onDeviceStatusChanged?: IOnDeviceStatusChanged;
105
- _onBindingChanged?: IEmptyFn;
106
- _onSocketStatusChanged?: IOnSocketStatusChanged;
107
- _waitSends: object[];
108
- _checkConnectTimerId?: any;
109
- constructor({ appID, token, uid, wsInfo, onDeviceStatusChanged, onBindingChanged, onSocketStatusChanged, }: IConnectProps);
110
- destory: () => void;
111
- _networkChange: (res: WechatMiniprogram.OnNetworkStatusChangeListenerResult) => Promise<void>;
112
- _appShow: () => Promise<void>;
113
- _addSubDid: (...dids: any[]) => void;
114
- _removeSubDid: (...dids: any[]) => void;
115
- _connectWS: () => void;
116
- _subDevices: (dids: string[]) => void;
117
- _unSubDevices: (dids: string[]) => void;
118
- _send: (data: object, forced?: boolean) => Promise<IWriteRes>;
119
- close: () => void;
120
- handleClose: (res: {
121
- code: number;
122
- reason: string;
123
- }) => void;
124
- handleOpen: () => void;
125
- handleMessage: ({ data }: {
126
- data: string | ArrayBuffer;
127
- }) => void;
128
- handleError: (err: {
129
- errMsg: string;
130
- }) => void;
131
- _login: () => void;
132
- _tryLoginAgain: () => void;
133
- _startPing: () => void;
134
- _stopPing: () => void;
135
- pongResp: () => void;
136
- _currentSocketStatus: boolean;
137
- _loginResp: (data: any) => void;
138
- _consumeWaitSends: () => void;
139
- _handleSocketStatusChanged: (enabled: boolean) => void;
140
- _subscribeResp: (data: any) => void;
141
- _onlineResp: (data: {
142
- did: string;
143
- online: boolean;
144
- }) => void;
145
- _rawChangedResp: (data: IDeviceRawStatusChangedProps) => void;
146
- _statusChangedResp: (data: IDeviceStatusChangedProps) => void;
147
- _isSub: (did: string) => boolean;
148
- _invalidMsgResp: (data: any) => void;
149
- _bindingChangedResp: (data: any) => void;
150
- }
151
- export {};
@@ -1,3 +0,0 @@
1
- import { IServiceResult } from './types';
2
- declare const openApiRequest: <T>(url: string, options: any, needToken?: boolean) => Promise<IServiceResult<T>>;
3
- export default openApiRequest;
@@ -1,11 +0,0 @@
1
- import { IProductConfigData, IDataPointConfig } from './types';
2
- declare class ProductConfigFileManage {
3
- data: IProductConfigData;
4
- key: string;
5
- init: () => Promise<void>;
6
- getConfigFileMap: Record<string, Promise<IDataPointConfig | null>>;
7
- getConfigFile: (pk: string) => Promise<IDataPointConfig | null>;
8
- getAttrItem: (pk: string, key: string) => Promise<import("./types").IDataPointAttr>;
9
- }
10
- declare const productConfigFileManage: ProductConfigFileManage;
11
- export default productConfigFileManage;
@@ -1,7 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- declare class Bind extends ProtocolBase {
3
- passcode: string;
4
- constructor(data: number[]);
5
- static pack: () => number[];
6
- }
7
- export default Bind;
@@ -1,11 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- declare class DeviceInfo extends ProtocolBase {
3
- moduleSoftVersion: string;
4
- moduleHardVersion: string;
5
- mcuSoftVersion: string;
6
- mcuHardVersion: string;
7
- businessVersion: string;
8
- constructor(data: number[]);
9
- static pack: () => number[];
10
- }
11
- export default DeviceInfo;
@@ -1,17 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- type TDecodeType = 'ASCII' | 'HEX';
3
- declare class DiscoverUDP extends ProtocolBase {
4
- did: string;
5
- mac: string;
6
- productKey: string;
7
- deviceType: number;
8
- apiUrl: string;
9
- protocolVersion: string;
10
- mcuVersion: string;
11
- moduleVersion: string;
12
- constructor(data: number[]);
13
- parseEndChat: (index: any, key: any) => any;
14
- baseParse: (index: any, key: any, type?: TDecodeType) => any;
15
- static pack: () => Uint8Array;
16
- }
17
- export default DiscoverUDP;
@@ -1,5 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- declare class GetDeviceStatus extends ProtocolBase {
3
- static pack: (productKey: string, gwDid?: string, attrNames?: string[]) => Promise<number[]>;
4
- }
5
- export default GetDeviceStatus;
@@ -1,12 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- interface IPackParame {
3
- passcode: string;
4
- }
5
- declare class Login extends ProtocolBase {
6
- result: boolean;
7
- didLength: number;
8
- did: string;
9
- constructor(data: number[]);
10
- static pack: ({ passcode }: IPackParame) => number[];
11
- }
12
- export default Login;
@@ -1,5 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- declare class Ntp extends ProtocolBase {
3
- static pack: () => number[];
4
- }
5
- export default Ntp;
@@ -1,7 +0,0 @@
1
- import ProtocolBase from "../ProtocolBase";
2
- declare class AwaitNoti extends ProtocolBase {
3
- state: number;
4
- constructor(data: number[]);
5
- static pack: (position: number) => number[];
6
- }
7
- export default AwaitNoti;
@@ -1,10 +0,0 @@
1
- import { IOTAType } from "../../types";
2
- import ProtocolBase from "../ProtocolBase";
3
- declare class CheckCanOTA extends ProtocolBase {
4
- type: IOTAType;
5
- state: number;
6
- version: number;
7
- constructor(data: number[]);
8
- static pack: (type: IOTAType) => number[];
9
- }
10
- export default CheckCanOTA;
@@ -1,8 +0,0 @@
1
- import ProtocolBase from "../ProtocolBase";
2
- declare class OTAPackPackage extends ProtocolBase {
3
- packageNum: number;
4
- state: number;
5
- constructor(data: number[]);
6
- static pack: (data: number[], packageNum: number) => number[];
7
- }
8
- export default OTAPackPackage;
@@ -1,8 +0,0 @@
1
- import ProtocolBase from "../ProtocolBase";
2
- type IState = 0 | 1 | 2 | 3 | 4;
3
- declare class OtaComplete extends ProtocolBase {
4
- state: IState;
5
- constructor(data: number[]);
6
- static pack: (state: IState) => number[];
7
- }
8
- export default OtaComplete;
@@ -1,11 +0,0 @@
1
- import ProtocolBase from "../ProtocolBase";
2
- type TState = 0 | 1 | 2 | 3;
3
- declare class PreOTA extends ProtocolBase {
4
- state: TState;
5
- processedLen: number;
6
- processedCrc32: string;
7
- packageMaxLen: number;
8
- constructor(data: number[]);
9
- static pack: (pk: string, softVer: string, md5: string, fileLen: number, crc32: number) => number[];
10
- }
11
- export default PreOTA;
@@ -1,6 +0,0 @@
1
- import ProtocolBase from "../ProtocolBase";
2
- declare class ResetPosition extends ProtocolBase {
3
- constructor(data: number[]);
4
- static pack: (position: number) => number[];
5
- }
6
- export default ResetPosition;
@@ -1,23 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- export declare class RequestSync extends ProtocolBase {
3
- state: number;
4
- len: number;
5
- constructor(data: number[]);
6
- static pack: () => number[];
7
- }
8
- export declare class SyncPackage extends ProtocolBase {
9
- id: number;
10
- timestemp: number;
11
- payloadLen: number;
12
- payload: number[];
13
- constructor(data: number[]);
14
- static pack: (id: number) => number[];
15
- }
16
- export declare class DeletePackage extends ProtocolBase {
17
- static pack: (id: number) => number[];
18
- }
19
- export declare class CancelSync extends ProtocolBase {
20
- state: number;
21
- constructor(data: number[]);
22
- static pack: () => number[];
23
- }
@@ -1,11 +0,0 @@
1
- declare class ProtocolBase {
2
- header: string;
3
- len: number;
4
- flag: number[];
5
- cmd: string;
6
- content: number[];
7
- constructor(data?: number[]);
8
- static decodeLen: (arr: any) => number;
9
- formatP0: (data: any) => void;
10
- }
11
- export default ProtocolBase;
@@ -1,8 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- type IStatus = 0 | 1;
3
- declare class Reset extends ProtocolBase {
4
- status: IStatus;
5
- constructor(data: number[]);
6
- static pack: () => number[];
7
- }
8
- export default Reset;
@@ -1,7 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- type IStatus = 0 | 1;
3
- declare class SetReset extends ProtocolBase {
4
- status: IStatus;
5
- static pack: (status: IStatus) => number[];
6
- }
7
- export default SetReset;
@@ -1,6 +0,0 @@
1
- import ProtocolBase from "./ProtocolBase";
2
- declare class WifiConfig extends ProtocolBase {
3
- constructor(data: number[]);
4
- static pack: (ssid: string, password: string) => Uint8Array;
5
- }
6
- export default WifiConfig;