mini_program_gizwits_sdk 3.6.2 → 3.6.4

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.
@@ -43,6 +43,7 @@ export interface IDevice {
43
43
  did: string;
44
44
  bleWorkStatus?: number;
45
45
  name: string;
46
+ localName: string;
46
47
  isBind: boolean;
47
48
  rootDeviceId?: string;
48
49
  bleDeviceID?: string;
package/index.ts CHANGED
@@ -3,7 +3,6 @@ import gizwitsSdk from './src/sdk';
3
3
  import errorCode from './src/errorCode';
4
4
  import { BleHandle } from './src/handler/ble';
5
5
 
6
- import * as types from './src/types';
7
6
  export { errorCode, BleHandle };
8
- export { types }
9
- export default gizwitsSdk;
7
+ export default gizwitsSdk;
8
+ export * from './src/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mini_program_gizwits_sdk",
3
- "version": "3.6.2",
3
+ "version": "3.6.4",
4
4
  "description": "更新类型",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -202,6 +202,7 @@ export class LanHandle extends EventListener<TLanHandleEvent> {
202
202
  expandData: updateDevice,
203
203
  name: "",
204
204
  isBind: false,
205
+ localName: '',
205
206
  connectType: "NONE",
206
207
  isOnline: false,
207
208
  isLanOnline: true,
@@ -75,6 +75,7 @@ export const getBindingList = async (): Promise<IServiceResult<IDevice[]>> => {
75
75
  mac: item.mac,
76
76
  did: item.did,
77
77
  host: item.host,
78
+ localName: '',
78
79
  port_s: item.port_s,
79
80
  port: item.port,
80
81
  ws_port: item.ws_port,
@@ -55,6 +55,7 @@ export interface IDevice {
55
55
  did: string;
56
56
  bleWorkStatus?: number; // 0 默认状态 1 配网状态
57
57
  name: string;
58
+ localName: string;
58
59
  isBind: boolean;
59
60
  rootDeviceId?: string;
60
61
  bleDeviceID?: string;
package/src/utils.ts CHANGED
@@ -248,7 +248,8 @@ export const BTDevice2GDevice = (
248
248
  isBleOnline: true,
249
249
  isLanOnline: false,
250
250
  isOnline: false,
251
- name: BTDevice.name,
251
+ name: BTDevice.localName,
252
+ localName: BTDevice.localName,
252
253
  isBind: false,
253
254
  bleDeviceID: BTDevice.deviceId,
254
255
  ctime: new Date().getTime(),
@@ -153,6 +153,7 @@ class ApConfig extends ConfigBase {
153
153
  did: item.did,
154
154
  name: '',
155
155
  isBind: false,
156
+ localName: '',
156
157
  connectType: 'NONE',
157
158
  isBleOnline: false,
158
159
  isLanOnline: false,
@@ -244,31 +244,9 @@ class BLEConfig extends ConfigBase {
244
244
  return (
245
245
  !softAPSSIDPrefix ||
246
246
  (device.name && device.name.startsWith(softAPSSIDPrefix))
247
+ || (device.localName && device.localName.startsWith(softAPSSIDPrefix))
247
248
  )
248
249
  }
249
- // isValidBleDevice = (
250
- // bleDevice: WechatMiniprogram.BlueToothDevice,
251
- // softAPSSIDPrefix?: string
252
- // ) => {
253
- // if (!bleDevice || !bleDevice.advertisData) {
254
- // // 无效蓝牙设备或者蓝牙设备广播数据为空,返回失败
255
- // return false;
256
- // }
257
- // const {productKey, mac, bleWorkStatus} = advertisData2PkAndMac(bleDevice.advertisData, this.specialProductKeys)
258
- // if (!this.specialProductKeys.includes(productKey)) {
259
- // // 不在PK列表
260
- // return false;
261
- // }
262
- // // 判断广播包是否可以配网
263
- // if (bleWorkStatus !== 1) return;
264
- // GizLog.debug(`GIZ_SDK: isValidBleDevice mac: ${mac} pk: ${productKey} name: ${bleDevice.name}`)
265
- // GizLog.debug(`GIZ_SDK: softAPSSIDPrefix: ${softAPSSIDPrefix} ismatch : ${bleDevice.name && bleDevice.name.startsWith(softAPSSIDPrefix)}`)
266
- // return (
267
- // !softAPSSIDPrefix ||
268
- // (bleDevice.name && bleDevice.name.startsWith(softAPSSIDPrefix))
269
- // );
270
- // };
271
-
272
250
 
273
251
  enableBluetoothDevicesDescovery = async (): Promise<
274
252
  { success: false; err: IError } | { success: true }
@@ -348,6 +326,7 @@ class BLEConfig extends ConfigBase {
348
326
  productKey: item.product_key,
349
327
  did: item.did,
350
328
  name: '',
329
+ localName: '',
351
330
  isBind: false,
352
331
  connectType: 'NONE',
353
332
  isBleOnline: false,
@@ -100,6 +100,7 @@ class NFCConfig extends ConfigBase {
100
100
  mac: item.mac,
101
101
  productKey: item.product_key,
102
102
  did: item.did,
103
+ localName: '',
103
104
  name: '',
104
105
  isBind: false,
105
106
  connectType: 'NONE',
package/dist/package.json DELETED
@@ -1,55 +0,0 @@
1
- {
2
- "name": "mini_program_gizwits_sdk",
3
- "version": "3.6.2",
4
- "description": "更新类型",
5
- "main": "./dist/index.js",
6
- "scripts": {
7
- "test": "node_modules/mocha/bin/_mocha -r ts-node/register tests/**/*.spec.ts -file ./tests/setup-wx.js -timeout 60s",
8
- "testBle": "node_modules/mocha/bin/_mocha -r ts-node/register tests/utils/randomCode.spec.ts -file ./tests/setup-wx.js -timeout 60s",
9
- "build": "rm -rf ./dist && webpack",
10
- "release": "npm run build && release-it",
11
- "cover": "istanbul cover node_modules/mocha/bin/_mocha -- -r ts-node/register tests/**/*.spec.ts -file ./tests/setup-wx.js -timeout 60s",
12
- "coveralls": "npm run cover -- --report lcovonly && cat ./coverage/lcov.info | coveralls"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/gizwits/mini_program_gizwits_sdk.git"
17
- },
18
- "keywords": [
19
- "gizwits",
20
- "miniprogram",
21
- "sdk"
22
- ],
23
- "devDependencies": {
24
- "@babel/plugin-transform-modules-commonjs": "^7.12.1",
25
- "@release-it/conventional-changelog": "^2.0.0",
26
- "@types/chai": "^4.2.11",
27
- "@types/crypto-js": "^4.0.2",
28
- "@types/mocha": "^7.0.2",
29
- "@types/node": "^12.12.14",
30
- "@types/sinon": "^10.0.6",
31
- "chai": "^4.2.0",
32
- "coveralls": "^3.0.11",
33
- "istanbul": "^1.1.0-alpha.1",
34
- "miniprogram-api-typings": "^3.9.0",
35
- "mocha": "^7.1.1",
36
- "release-it": "^14.2.2",
37
- "sinon": "^9.2.4",
38
- "ts-loader": "^6.2.2",
39
- "ts-node": "^8.8.1",
40
- "typescript": "^4.9.5",
41
- "uglifyjs-webpack-plugin": "^2.2.0",
42
- "webpack": "^4.42.1",
43
- "webpack-bundle-analyzer": "^4.5.0",
44
- "webpack-cli": "^3.3.11"
45
- },
46
- "author": "gizwits",
47
- "license": "ISC",
48
- "bugs": {
49
- "url": "https://github.com/gizwits/mini_program_gizwits_sdk/issues"
50
- },
51
- "homepage": "https://github.com/gizwits/mini_program_gizwits_sdk#readme",
52
- "dependencies": {
53
- "crypto-js": "^4.1.1"
54
- }
55
- }