mini_program_gizwits_sdk 3.7.2-kuka → 3.7.2

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 (138) hide show
  1. package/README.md +237 -23
  2. package/{index.ts → dist/index.d.ts} +3 -3
  3. package/dist/index.js +6 -4
  4. package/dist/src/crc/calculators/crc16modbus.d.ts +2 -0
  5. package/dist/src/crc/calculators/crc32.d.ts +2 -0
  6. package/dist/src/crc/crc16modbus.d.ts +7 -0
  7. package/dist/src/crc/crc32.d.ts +7 -0
  8. package/dist/src/crc/create_buffer.d.ts +4 -0
  9. package/dist/src/crc/define_crc.d.ts +7 -0
  10. package/dist/src/crc/index.d.ts +19 -0
  11. package/{src/crc/types.ts → dist/src/crc/types.d.ts} +1 -1
  12. package/dist/src/handler/EventListener.d.ts +9 -0
  13. package/dist/src/handler/ble.d.ts +130 -0
  14. package/dist/src/handler/lan.d.ts +79 -0
  15. package/dist/src/handler/socket.d.ts +161 -0
  16. package/dist/src/protocol/Bind.d.ts +7 -0
  17. package/dist/src/protocol/DeviceInfo.d.ts +11 -0
  18. package/dist/src/protocol/DiscoverUDP.d.ts +17 -0
  19. package/dist/src/protocol/GetDeviceStatus.d.ts +5 -0
  20. package/dist/src/protocol/Login.d.ts +12 -0
  21. package/dist/src/protocol/Ntp.d.ts +5 -0
  22. package/dist/src/protocol/OTA/AwaitNoti.d.ts +7 -0
  23. package/dist/src/protocol/OTA/CheckCanOTA.d.ts +10 -0
  24. package/dist/src/protocol/OTA/OTAPackPackage.d.ts +8 -0
  25. package/dist/src/protocol/OTA/OtaComplete.d.ts +8 -0
  26. package/dist/src/protocol/OTA/PreOTA.d.ts +11 -0
  27. package/dist/src/protocol/OTA/ResetPosition.d.ts +6 -0
  28. package/dist/src/protocol/OTAStatus.d.ts +4 -0
  29. package/dist/src/protocol/OffLineData.d.ts +23 -0
  30. package/dist/src/protocol/ProtocolBase.d.ts +12 -0
  31. package/dist/src/protocol/Reset.d.ts +8 -0
  32. package/dist/src/protocol/SetReset.d.ts +7 -0
  33. package/dist/src/protocol/TransparentData.d.ts +12 -0
  34. package/dist/src/protocol/WifiConfig.d.ts +11 -0
  35. package/dist/src/protocol/dataPoint.d.ts +34 -0
  36. package/dist/src/protocol/tool.d.ts +14 -0
  37. package/dist/src/sdk.d.ts +158 -0
  38. package/dist/src/services/devices.d.ts +52 -0
  39. package/dist/src/services/login.d.ts +4 -0
  40. package/dist/src/services/monitor.d.ts +12 -0
  41. package/dist/src/services/ota.d.ts +7 -0
  42. package/dist/src/services/tool.d.ts +4 -0
  43. package/dist/src/services/uploadP0.d.ts +14 -0
  44. package/dist/src/types/index.d.ts +414 -0
  45. package/dist/src/types/otaStatus.d.ts +72 -0
  46. package/dist/src/utils/GizLog.d.ts +18 -0
  47. package/dist/src/utils/bleConfigLog.d.ts +11 -0
  48. package/dist/src/utils/connectedBssid.d.ts +6 -0
  49. package/dist/src/utils/errorCode.d.ts +3 -0
  50. package/dist/src/utils/globalData.d.ts +2 -0
  51. package/dist/src/utils/openApiRequest.d.ts +27 -0
  52. package/dist/src/utils/productConfigFileManage.d.ts +15 -0
  53. package/dist/src/utils/randomCode.d.ts +3 -0
  54. package/dist/src/utils/request.d.ts +1 -0
  55. package/dist/src/utils/sentry.d.ts +2 -0
  56. package/dist/src/utils/sleep.d.ts +2 -0
  57. package/dist/src/utils/utils.d.ts +55 -0
  58. package/dist/src/utils/wechatApi.d.ts +24 -0
  59. package/dist/src/utils/wifiConfigLogReport.d.ts +28 -0
  60. package/dist/src/wifiConfig/ConfigBase.d.ts +30 -0
  61. package/dist/src/wifiConfig/ap.d.ts +11 -0
  62. package/dist/src/wifiConfig/ble.d.ts +43 -0
  63. package/dist/src/wifiConfig/nfc/disposeData.d.ts +2 -0
  64. package/dist/src/wifiConfig/nfc/formatData.d.ts +3 -0
  65. package/dist/src/wifiConfig/nfc/formatSSID.d.ts +6 -0
  66. package/dist/src/wifiConfig/nfc/index.d.ts +22 -0
  67. package/dist/src/wifiConfig/nfc/isIncludedCH.d.ts +1 -0
  68. package/dist/src/wifiConfig/nfc/nfcAConnect.d.ts +6 -0
  69. package/dist/src/wifiConfig/nfc/nfcATransceive.d.ts +5 -0
  70. package/dist/src/wifiConfig/nfc/ssIDToASC.d.ts +1 -0
  71. package/dist/src/wifiConfig/nfc/stringToGbk.d.ts +1 -0
  72. package/dist/src/wifiConfig/nfc/transceive.wx.d.ts +2 -0
  73. package/dist/src/wifiConfig/nfc/types.d.ts +15 -0
  74. package/docs/ble-bssid.md +38 -0
  75. package/docs/ota-status.md +139 -0
  76. package/global.d.ts +3 -19
  77. package/package.json +13 -6
  78. package/.istanbul.yml +0 -4
  79. package/.travis.yml +0 -23
  80. package/.vscode/launch.json +0 -19
  81. package/.vscode/settings.json +0 -3
  82. package/src/GizLog.ts +0 -51
  83. package/src/aepApi/aepApiRequest.ts +0 -61
  84. package/src/crc/calculators/crc16modbus.ts +0 -36
  85. package/src/crc/calculators/crc32.ts +0 -47
  86. package/src/crc/crc16modbus.ts +0 -3
  87. package/src/crc/crc32.ts +0 -4
  88. package/src/crc/create_buffer.ts +0 -7
  89. package/src/crc/define_crc.ts +0 -9
  90. package/src/crc/index.ts +0 -10
  91. package/src/crc/package.json +0 -3
  92. package/src/errorCode.ts +0 -84
  93. package/src/global.d.ts +0 -53
  94. package/src/globalData.ts +0 -9
  95. package/src/handler/EventListener.ts +0 -44
  96. package/src/handler/ble.ts +0 -1485
  97. package/src/handler/lan.ts +0 -409
  98. package/src/handler/socket.ts +0 -625
  99. package/src/openApiRequest.ts +0 -62
  100. package/src/productConfigFileManage.ts +0 -58
  101. package/src/protocol/Bind.ts +0 -22
  102. package/src/protocol/DeviceInfo.ts +0 -36
  103. package/src/protocol/DiscoverUDP.ts +0 -80
  104. package/src/protocol/GetDeviceStatus.ts +0 -63
  105. package/src/protocol/Login.ts +0 -43
  106. package/src/protocol/Ntp.ts +0 -13
  107. package/src/protocol/OTA/AwaitNoti.ts +0 -14
  108. package/src/protocol/OTA/CheckCanOTA.ts +0 -23
  109. package/src/protocol/OTA/OTAPackPackage.ts +0 -36
  110. package/src/protocol/OTA/OtaComplete.ts +0 -17
  111. package/src/protocol/OTA/PreOTA.ts +0 -47
  112. package/src/protocol/OTA/ResetPosition.ts +0 -14
  113. package/src/protocol/OffLineData.ts +0 -81
  114. package/src/protocol/ProtocolBase.ts +0 -54
  115. package/src/protocol/Reset.ts +0 -15
  116. package/src/protocol/SetReset.ts +0 -11
  117. package/src/protocol/WifiConfig.ts +0 -42
  118. package/src/protocol/dataPoint.ts +0 -769
  119. package/src/protocol/thirdProtocol/YunZhiMianBleProtocolBase.ts +0 -39
  120. package/src/protocol/tool.ts +0 -147
  121. package/src/randomCode.ts +0 -36
  122. package/src/request.ts +0 -22
  123. package/src/sdk.ts +0 -1472
  124. package/src/sentry.ts +0 -55
  125. package/src/services/devices.ts +0 -309
  126. package/src/services/login.ts +0 -15
  127. package/src/services/ota.ts +0 -30
  128. package/src/services/tool.ts +0 -10
  129. package/src/services/uploadP0.ts +0 -56
  130. package/src/sleep.ts +0 -2
  131. package/src/types/index.ts +0 -48
  132. package/src/utils.ts +0 -419
  133. package/src/wechatApi.ts +0 -268
  134. package/src/wifiConfig/ConfigBase.ts +0 -185
  135. package/src/wifiConfig/ap.ts +0 -192
  136. package/src/wifiConfig/ble.ts +0 -436
  137. package/src/wifiConfig/ble_ailCloud.ts +0 -554
  138. package/yarn-error.log +0 -6901
@@ -1,36 +0,0 @@
1
- // Generated by `./pycrc.py --algorithm=table-driven --model=crc-16-modbus --generate=c`
2
- let TABLE: any = [
3
- 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601, 0x06c0, 0x0780, 0xc741,
4
- 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,
5
- 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941,
6
- 0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41,
7
- 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341,
8
- 0x1100, 0xd1c1, 0xd081, 0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240,
9
- 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00, 0xfcc1, 0xfd81, 0x3d40,
10
- 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840,
11
- 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41,
12
- 0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640,
13
- 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141,
14
- 0x6300, 0xa3c1, 0xa281, 0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
15
- 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01, 0x6ac0, 0x6b80, 0xab41,
16
- 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41,
17
- 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541,
18
- 0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041,
19
- 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741,
20
- 0x5500, 0x95c1, 0x9481, 0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40,
21
- 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801, 0x48c0, 0x4980, 0x8941,
22
- 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41,
23
- 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341,
24
- 0x4100, 0x81c1, 0x8081, 0x4040,
25
- ];
26
- if (typeof Int32Array !== 'undefined') {
27
- TABLE = new Int32Array(TABLE);
28
- }
29
- const crc16modbus = (current, previous) => {
30
- let crc = typeof previous !== 'undefined' ? ~~previous : 0xffff;
31
- for (let index = 0; index < current.length; index++) {
32
- crc = (TABLE[(crc ^ current[index]) & 0xff] ^ (crc >> 8)) & 0xffff;
33
- }
34
- return crc;
35
- };
36
- export default crc16modbus;
@@ -1,47 +0,0 @@
1
- // Generated by `./pycrc.py --algorithm=table-driven --model=crc-32 --generate=c`
2
- let TABLE: any = [
3
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
4
- 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
5
- 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
6
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
7
- 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
8
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
9
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
10
- 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
11
- 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
12
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
13
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
14
- 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
15
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
16
- 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
17
- 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
18
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
19
- 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
20
- 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
21
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
22
- 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
23
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
24
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
25
- 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
26
- 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
27
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
28
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
29
- 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
30
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
31
- 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
32
- 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
33
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
34
- 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
35
- ];
36
- if (typeof Int32Array !== 'undefined') {
37
- TABLE = new Int32Array(TABLE);
38
- }
39
- const crc32 = (current, previous) => {
40
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
41
- let crc = previous === 0 ? 0 : ~~previous ^ -1;
42
- for (let index = 0; index < current.length; index++) {
43
- crc = TABLE[(crc ^ current[index]) & 0xff] ^ (crc >>> 8);
44
- }
45
- return crc ^ -1;
46
- };
47
- export default crc32;
@@ -1,3 +0,0 @@
1
- import crc16modbus from './calculators/crc16modbus';
2
- import defineCrc from './define_crc';
3
- export default defineCrc('crc-16-modbus', crc16modbus);
package/src/crc/crc32.ts DELETED
@@ -1,4 +0,0 @@
1
- import crc32 from './calculators/crc32';
2
- import defineCrc from './define_crc';
3
- export default defineCrc(
4
- 'crc-32', crc32);
@@ -1,7 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable no-prototype-builtins */
3
- import { Buffer } from 'buffer';
4
- import { BufferInput } from './types';
5
-
6
- const createBuffer = (value: BufferInput, encoding?: BufferEncoding) => Buffer.from(value as any, encoding);
7
- export default createBuffer;
@@ -1,9 +0,0 @@
1
- import createBuffer from './create_buffer';
2
- import { CRCCalculator } from './types'
3
- export default function defineCrc(model: string, calculator: CRCCalculator<Uint8Array>) {
4
- const result = (value: any, previous?: any) => calculator(createBuffer(value), previous) >>> 0;
5
- result.signed = (value: any, previous?: any) => calculator(createBuffer(value), previous);
6
- result.unsigned = result;
7
- result.model = model;
8
- return result;
9
- }
package/src/crc/index.ts DELETED
@@ -1,10 +0,0 @@
1
-
2
- import crc16modbus from './crc16modbus';
3
- import crc32 from './crc32';
4
-
5
- export { crc16modbus };
6
- export { crc32 };
7
- export default {
8
- crc16modbus,
9
- crc32,
10
- };
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/src/errorCode.ts DELETED
@@ -1,84 +0,0 @@
1
- interface IErrorCode {
2
- [key: string]: IError;
3
- }
4
-
5
- const errorCode: IErrorCode = {
6
- GIZ_OPENAPI_DEVICE_NOT_BOUND: {
7
- errorCode: 9017,
8
- errorMessage: 'not bind',
9
- },
10
- GIZ_SDK_HTTP_REQUEST_FAILED: {
11
- errorCode: 8099,
12
- errorMessage: '网络请求失败',
13
- },
14
- GIZ_SDK_DEVICE_NO_RESPONSE: {
15
- errorCode: 8030,
16
- errorMessage: '设备未响应',
17
- },
18
- GIZ_SDK_SDK_NOT_INITIALIZED: {
19
- errorCode: 8300,
20
- errorMessage: 'not init',
21
- },
22
- CONFIG_TIME_OUT: {
23
- errorCode: 8023,
24
- errorMessage: 'Config Timeout',
25
- },
26
- WECHAT_ERROR: {
27
- errorCode: 10000,
28
- errorMessage: 'wechat error',
29
- },
30
- GIZ_SDK_ONBOARDING_STOPPED: {
31
- errorCode: 8318,
32
- errorMessage: '配网中断',
33
- },
34
- GIZ_SDK_DEVICE_CONFIG_IS_RUNNING: {
35
- errorCode: 8022,
36
- errorMessage: '配置正在进行中',
37
- },
38
- GIZ_OPENAPI_TOKEN_INVALID: {
39
- errorCode: 9004,
40
- errorMessage: 'token 失效',
41
- },
42
- GIZ_SDK_BIND_DEVICE_FAILED: {
43
- errorCode: 8039,
44
- errorMessage: '设备绑定失败',
45
- },
46
- GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON: {
47
- errorCode: 8281,
48
- errorMessage: '蓝牙未启用',
49
- },
50
- GIZ_SDK_OTHERWISE: {
51
- errorCode: 8100,
52
- errorMessage: '',
53
- },
54
- GIZ_SDK_DEVICE_NOT_SUBSCRIBED: {
55
- errorCode: 8029,
56
- errorMessage: '设备还未订阅',
57
- },
58
- GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY: {
59
- errorCode: 8250,
60
- errorMessage: '产品类型不在指定范围内',
61
- },
62
- GIZ_SDK_LOG_LEVEL_INVALID: {
63
- errorCode: 8009,
64
- errorMessage: '产品类型不在指定范围内',
65
- },
66
- GIZ_SDK_OTA_DEVICE_NOT_SUPPORT: {
67
- errorCode: 8360,
68
- errorMessage: '设备不支持手机OTA升级',
69
- },
70
- GIZ_SDK_OTA_DEVICE_BUSY_IN_UPGRADE: {
71
- errorCode: 8354,
72
- errorMessage: '设备忙,固件正在升级',
73
- },
74
- GIZ_SDK_OTA_FIRMWARE_DOWNLOAD_FAILED: {
75
- errorCode: 8353,
76
- errorMessage: '固件下载失败',
77
- },
78
- GIZ_SDK_OTA_FIRMWARE_TYPE_NOT_MATCH: {
79
- errorCode: 8361,
80
- errorMessage: '蓝牙OTA设备返回的固件类型与当前要升级的固件类型不匹配',
81
- },
82
- };
83
-
84
- export default errorCode;
package/src/global.d.ts DELETED
@@ -1,53 +0,0 @@
1
- interface IError {
2
- errorCode: number;
3
- errorMessage?: string;
4
- }
5
-
6
- interface ICommonObj {
7
- [key: string]: any
8
- }
9
-
10
- interface IDeviceStatusChangedProps {
11
- did: string;
12
- attrs: ICommonObj;
13
- }
14
-
15
- interface IDeviceRawStatusChangedProps {
16
- did: string;
17
- raw: Uint8Array;
18
- }
19
-
20
- interface IOnDeviceStatusChanged {
21
- (data: IDeviceStatusChangedProps | IDeviceRawStatusChangedProps): void;
22
- }
23
-
24
- interface IOnSocketStatusChanged {
25
- (dids: string[], enabled: boolean): void;
26
- }
27
-
28
- interface IEmptyFn {
29
- (): void;
30
- }
31
-
32
- interface IDevice {
33
- mac: string;
34
- productKey: string;
35
- did: string;
36
- bleWorkStatus?: number; // 0 默认状态 1 配网状态
37
- name: string;
38
- isBind: boolean;
39
- rootDeviceId?: string;
40
- bleDeviceID?: string;
41
- remark?: string;
42
- passcode?: string;
43
- connectType: TConnectType;
44
- isOnline: boolean; // 代表大循环在线
45
- isLanOnline: boolean; // 代表小循环在线
46
- isBleOnline: boolean; // 代表蓝牙在线
47
- host?: string;
48
- wss_port?: number;
49
- ctime?: number;
50
- RSSI?: number; // 蓝牙信号强度
51
- }
52
-
53
- type TConnectType = 'BLE' | 'BLE_BROADCAST' | 'LAN' | 'WAN' | 'NONE';
package/src/globalData.ts DELETED
@@ -1,9 +0,0 @@
1
- const globalData: any = {};
2
-
3
- export function setGlobalData(key: any, value: any) {
4
- globalData[key] = value;
5
- }
6
-
7
- export function getGlobalData(key: any) {
8
- return globalData[key];
9
- }
@@ -1,44 +0,0 @@
1
- export default class EventListener<T> {
2
- public listenerMap: any = {};
3
- public addEventListener = async <K extends keyof T>(
4
- type: K,
5
- func: T[K]
6
- ) => {
7
- if (!this.listenerMap[type]) {
8
- // 创建一个新的
9
- this.listenerMap[type] = [];
10
- }
11
-
12
- if (this.listenerMap[type].indexOf(func) === -1) {
13
- this.listenerMap[type].push(func);
14
- }
15
- return {
16
- success: true,
17
- };
18
- }
19
-
20
- /**
21
- * 移除事件监听
22
- * @param type 事件监听名称,详见下表
23
- * @param func 事件监听回调
24
- * @returns
25
- */
26
- public removeEventListener = <K extends keyof T>(
27
- type: K,
28
- func: T[K]
29
- ) => {
30
- if (this.listenerMap[type]) {
31
- const index = this.listenerMap[type].indexOf(func);
32
- if (index !== -1) {
33
- // 删除数组中的这一行
34
- this.listenerMap[type].splice(index, 1);
35
- return {
36
- success: true,
37
- };
38
- }
39
- }
40
- return {
41
- success: false,
42
- };
43
- };
44
- }