hunter-open-sdk 1.0.7-beta.1 → 1.0.8-beta.1

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.
@@ -32,22 +32,18 @@ var getMacSn = /*#__PURE__*/function () {
32
32
  return customWebUSB.getDevices();
33
33
  case 4:
34
34
  deviceList = _context.sent;
35
- console.log('deviceList', deviceList);
36
-
37
- // 如果设备没有attachDeviceId 则直接返回
38
- if (!(!attachDeviceId || !deviceList.length)) {
39
- _context.next = 8;
35
+ if (attachDeviceId) {
36
+ _context.next = 7;
40
37
  break;
41
38
  }
42
39
  return _context.abrupt("return");
43
- case 8:
40
+ case 7:
44
41
  // 删选出当前的设备信息 为获取到serialNumber
45
42
  currentDevice = deviceList.filter(function (item) {
46
43
  return item.device.deviceAddress == attachDeviceId;
47
44
  });
48
- console.log('currentDevice', currentDevice);
49
45
  if (currentDevice.length) {
50
- _context.next = 13;
46
+ _context.next = 11;
51
47
  break;
52
48
  }
53
49
  callBack({
@@ -56,7 +52,7 @@ var getMacSn = /*#__PURE__*/function () {
56
52
  message: '获取SN失败'
57
53
  });
58
54
  return _context.abrupt("return");
59
- case 13:
55
+ case 11:
60
56
  // 检查设备是否为支持的三星、华为、荣耀手机品牌
61
57
  deviceInfo = currentDevice[0];
62
58
  productName = ((_deviceInfo$productNa = deviceInfo.productName) === null || _deviceInfo$productNa === void 0 ? void 0 : _deviceInfo$productNa.toLowerCase()) || '';
@@ -65,9 +61,8 @@ var getMacSn = /*#__PURE__*/function () {
65
61
  isSupportedBrand = supportedBrands.some(function (brand) {
66
62
  return productName.includes(brand) || manufacturerName.includes(brand);
67
63
  });
68
- console.log('deviceInfo', deviceInfo, productName, manufacturerName);
69
64
  if (isSupportedBrand) {
70
- _context.next = 22;
65
+ _context.next = 19;
71
66
  break;
72
67
  }
73
68
  callBack({
@@ -76,7 +71,7 @@ var getMacSn = /*#__PURE__*/function () {
76
71
  message: '暂不支持该品牌手机查询SN'
77
72
  });
78
73
  return _context.abrupt("return");
79
- case 22:
74
+ case 19:
80
75
  callBack({
81
76
  code: 0,
82
77
  data: {
@@ -84,7 +79,7 @@ var getMacSn = /*#__PURE__*/function () {
84
79
  },
85
80
  message: '获取SN成功'
86
81
  });
87
- case 23:
82
+ case 20:
88
83
  case "end":
89
84
  return _context.stop();
90
85
  }
@@ -174,6 +169,7 @@ var GetAndroidSn = exports.GetAndroidSn = function GetAndroidSn(params, callBack
174
169
  hadRegisterUsb = true;
175
170
  _usb.usb.on('attach', /*#__PURE__*/function () {
176
171
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(device) {
172
+ var idVendor;
177
173
  return _regenerator.default.wrap(function _callee3$(_context3) {
178
174
  while (1) switch (_context3.prev = _context3.next) {
179
175
  case 0:
@@ -183,7 +179,13 @@ var GetAndroidSn = exports.GetAndroidSn = function GetAndroidSn(params, callBack
183
179
  }
184
180
  return _context3.abrupt("return");
185
181
  case 2:
186
- console.log('attach GetAndroidSn', device);
182
+ idVendor = device.deviceDescriptor.idVendor;
183
+ if (!(idVendor == 1452)) {
184
+ _context3.next = 5;
185
+ break;
186
+ }
187
+ return _context3.abrupt("return");
188
+ case 5:
187
189
  callBack({
188
190
  data: {
189
191
  eventName: 'type_usb_android_device_result',
@@ -191,21 +193,21 @@ var GetAndroidSn = exports.GetAndroidSn = function GetAndroidSn(params, callBack
191
193
  }
192
194
  });
193
195
  if (!(0, _utils.isMac)()) {
194
- _context3.next = 7;
196
+ _context3.next = 9;
195
197
  break;
196
198
  }
197
199
  // mac获取sn
198
200
  getMacSn(device, callBack);
199
201
  return _context3.abrupt("return");
200
- case 7:
202
+ case 9:
201
203
  if (!(0, _utils.isWin)()) {
202
- _context3.next = 10;
204
+ _context3.next = 12;
203
205
  break;
204
206
  }
205
207
  // win获取sn
206
208
  getWinSn(device, callBack);
207
209
  return _context3.abrupt("return");
208
- case 10:
210
+ case 12:
209
211
  case "end":
210
212
  return _context3.stop();
211
213
  }
@@ -11,6 +11,7 @@ var _utils = require("../utils/utils");
11
11
  var _winDriver = require("../events/driver/winDriver");
12
12
  var _utils2 = require("../utils/utils.global");
13
13
  var _deviceHelper = require("../helper/deviceHelper");
14
+ var _utils3 = require("../utils/utils.initDll");
14
15
  var usbmux = require('usbmux');
15
16
  var path = require('path');
16
17
  var request = require("request");
@@ -119,7 +120,7 @@ var writeDllVersion = function writeDllVersion(version) {
119
120
  }
120
121
  console.log('========写入version成功');
121
122
  // 写入成功后 重新初始化dll
122
- HunterInspectionKit();
123
+ (0, _utils3.HunterInspectionKit)();
123
124
  saasCallBack({
124
125
  data: {
125
126
  eventName: 'type_update_result',
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hunter-open-sdk",
3
- "version": "1.0.7-beta.1",
3
+ "version": "1.0.8-beta.1",
4
4
  "description": "采货侠SaaS版本桌面端sdk",
5
5
  "scripts": {
6
6
  "start": "zz dev",