Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. const _0x221b = ['uuid', '发送ICC指令成功', 'statusCode', 'stopBluetoothDevicesDiscovery', 'prototype', 'onIsEnable',
  2. 'devices', 'push', '无效参数', 'writeBLECharacteristicValue', 'concat', 'onBLEConnectionStateChange', 'exports',
  3. 'buffer', 'getBLEDeviceServices', '发送蓝牙指令超时', 'closeBluetoothAdapter', '发送蓝牙指令返回数据异常', '开始接收:', 'substring',
  4. 'code', '发送数据失败', 'disconnectSuccess->', 'connected', 'data', 'success', 'slice', '已断连', 'fail',
  5. 'dataFrameTransboundary', 'cmdtype->', 'fe01', 'deviceList', 'padStart', 'msg', '连接成功,握手成功',
  6. 'noTargetServiceId', 'cmdtype->未连接设备', 'name', 'shift', 'match', '发送esam指令超时', '发送ICC指令超时', 'errMsg', '1800',
  7. 'createBLEConnection', '卡片复位失败', '2712', '0a0012', '发送数据失败:', '发送esam指令成功', '卡片复位返回数据异常', '包数据:', 'successCode',
  8. 'startBluetoothDevicesDiscovery', 'localName', '开始重发', 'offBLEConnectionStateChange', 'log', 'toString',
  9. '未连接设备', 'deviceId', '数据长度越界', '0000FEC8-0000-1000-8000-00805F9B34FB', 'deviceId->', '断开连接成功', 'map',
  10. 'characteristics', 'length'
  11. ];
  12. const _0xdbaa = function(_0x221bee, _0xdbaa49) {
  13. _0x221bee = _0x221bee - 0x0;
  14. let _0x5ce86a = _0x221b[_0x221bee];
  15. return _0x5ce86a;
  16. };
  17. module[_0xdbaa('0xc')] = {
  18. 'scanBle': scanBle,
  19. 'closBluetooth': closBluetooth,
  20. 'connectDevice': connectDevice,
  21. 'disconnectDevice': disconnectDevice,
  22. 'transCmd': transData,
  23. 'disconnectDeviceBluetooth': disconnectDeviceBluetooth,
  24. 'resetICC': sendA9Command
  25. };
  26. var deviceList = [];
  27. var onIsEnable = toResObject(0x0, '蓝牙状态正常');
  28. var scanBleTimer;
  29. function toResObject(_0x4a4039, _0x190e2d) {
  30. return {
  31. 'code': _0x4a4039,
  32. 'msg': _0x190e2d
  33. };
  34. }
  35. function scanBle(_0x286cc3, _0x1822a2) {
  36. this['deviceList'] = [];
  37. this['onIsEnable'] = toResObject(0x0, '蓝牙状态正常');
  38. scanBleTimer = setTimeout(() => {
  39. wx[_0xdbaa('0x3')]();
  40. _0x1822a2(this[_0xdbaa('0x20')], this[_0xdbaa('0x5')]);
  41. }, _0x286cc3);
  42. wx['openBluetoothAdapter']({
  43. 'success': _0x44cd82 => {
  44. wx[_0xdbaa('0x36')]({
  45. 'allowDuplicatesKey': !![],
  46. 'interval': 0x64,
  47. 'success': _0x53a754 => {
  48. wx['onBluetoothDeviceFound'](_0x23d4d3 => {
  49. for (let _0x491211 = 0x0; _0x491211 < _0x23d4d3[_0xdbaa('0x6')][
  50. 'length'
  51. ]; _0x491211++) {
  52. let _0x1bacde = ![];
  53. if (_0x23d4d3[_0xdbaa('0x6')][_0x491211]['localName'] ==
  54. undefined || _0x23d4d3[_0xdbaa('0x6')][_0x491211][
  55. 'localName'
  56. ] == '' || _0x23d4d3[_0xdbaa('0x6')][_0x491211][
  57. 'localName'
  58. ] == '<Undefined>') {
  59. continue;
  60. }
  61. for (let _0x41572c = 0x0; _0x41572c < this[_0xdbaa('0x20')][
  62. 'length'
  63. ]; _0x41572c++) {
  64. if (_0x23d4d3[_0xdbaa('0x6')][_0x491211][_0xdbaa(
  65. '0x3d')] == this['deviceList'][_0x41572c][
  66. 'deviceId'
  67. ]) {
  68. _0x1bacde = !![];
  69. continue;
  70. }
  71. }
  72. if (_0x1bacde == ![]) {
  73. let _0x47fc85 = {};
  74. _0x47fc85[_0xdbaa('0x26')] = _0x23d4d3[_0xdbaa('0x6')][
  75. _0x491211
  76. ][_0xdbaa('0x37')];
  77. _0x47fc85[_0xdbaa('0x3d')] = _0x23d4d3[_0xdbaa('0x6')][
  78. _0x491211
  79. ][_0xdbaa('0x3d')];
  80. _0x47fc85['RSSI'] = _0x23d4d3[_0xdbaa('0x6')][_0x491211]
  81. ['RSSI'];
  82. this[_0xdbaa('0x20')][_0xdbaa('0x7')](_0x47fc85);
  83. }
  84. }
  85. });
  86. },
  87. 'fail': _0x4008b5 => {
  88. this['deviceList'] = [];
  89. this['onIsEnable'] = toResObject(-0x1, _0x4008b5['errMsg']);
  90. clearTimeout(scanBleTimer);
  91. _0x1822a2(this[_0xdbaa('0x20')], this[_0xdbaa('0x5')]);
  92. }
  93. });
  94. },
  95. 'fail': _0x11a554 => {
  96. this['deviceList'] = [];
  97. this[_0xdbaa('0x5')] = toResObject(-0x1, _0x11a554[_0xdbaa('0x2b')]);
  98. clearTimeout(scanBleTimer);
  99. _0x1822a2(this['deviceList'], this[_0xdbaa('0x5')]);
  100. }
  101. });
  102. }
  103. function closBluetooth(_0xd6e914) {
  104. clearTimeout(scanBleTimer);
  105. wx['stopBluetoothDevicesDiscovery']({
  106. 'success': _0x1184b0 => {
  107. _0xd6e914(toResObject(0x0, '蓝牙搜索已停止'));
  108. },
  109. 'fail': _0x356306 => {
  110. _0xd6e914(toResObject(-0x1, _0x356306[_0xdbaa('0x2b')]));
  111. }
  112. });
  113. }
  114. function connectDevice(_0x33721e, _0x179971, _0x2860fa) {
  115. wx[_0xdbaa('0xb')](_0x1e1e1a => {
  116. if (_0x1e1e1a[_0xdbaa('0x17')]) {
  117. _0x2860fa(toResObject(0x0, '已连接'));
  118. } else {
  119. _0x2860fa(toResObject(-0x1, '未连接'));
  120. }
  121. });
  122. connectAndInit(_0x33721e, {
  123. 'success': _0x5afa0f => {
  124. if (_0x5afa0f['code'] == 0x3e8 || _0x5afa0f[_0xdbaa('0x2')] == 0x3e8) {
  125. _0x179971(toResObject(0x0, '连接成功'));
  126. }
  127. },
  128. 'fail': _0x39efbe => {
  129. _0x179971(toResObject(-0x1, _0x39efbe[_0xdbaa('0x22')]));
  130. }
  131. }, 0x1f40);
  132. }
  133. function disconnectDevice(_0x4a9821) {
  134. disconnectBleDevice({
  135. 'success': _0x51f5e4 => {
  136. this['connectDeviceId'] = undefined;
  137. _0x4a9821(toResObject(0x0, '已断连'));
  138. wx['offBLEConnectionStateChange']();
  139. wx[_0xdbaa('0x10')]();
  140. },
  141. 'fail': _0x109b28 => {
  142. _0x4a9821(toResObject(-0x1, _0x109b28['msg']));
  143. wx['offBLEConnectionStateChange']();
  144. wx['closeBluetoothAdapter']();
  145. }
  146. });
  147. }
  148. function transData(_0xf2c818, _0x30d48e, _0x40aa35) {
  149. if (connectDeviceId == undefined) {
  150. let _0x13ba14 = toResObject(-0x1, _0xdbaa('0x3c'));
  151. _0x13ba14[_0xdbaa('0x18')] = undefined;
  152. _0x40aa35(_0x13ba14);
  153. console['log'](_0xdbaa('0x25'), _0x30d48e);
  154. return;
  155. }
  156. console[_0xdbaa('0x3a')](_0xdbaa('0x1e'), _0x30d48e);
  157. if (_0x30d48e == '10') {
  158. sendAndReceive(0x0, _0xf2c818, {
  159. 'success': _0x56226b => {
  160. let _0x4634c0 = toResObject(0x0, '执行成功');
  161. _0x4634c0[_0xdbaa('0x18')] = _0x56226b[_0xdbaa('0x18')];
  162. _0x40aa35(_0x4634c0);
  163. },
  164. 'fail': _0x1c746c => {
  165. let _0x424cbb = toResObject(-0x1, _0x1c746c[_0xdbaa('0x22')]);
  166. _0x424cbb[_0xdbaa('0x18')] = undefined;
  167. _0x40aa35(_0x424cbb);
  168. }
  169. }, 0xfa0);
  170. }
  171. if (_0x30d48e == '20') {
  172. sendAndReceive(0x1, _0xf2c818, {
  173. 'success': _0x12b874 => {
  174. let _0x28926e = toResObject(0x0, '执行成功');
  175. _0x28926e[_0xdbaa('0x18')] = _0x12b874['data'];
  176. _0x40aa35(_0x28926e);
  177. },
  178. 'fail': _0x2f9951 => {
  179. let _0x334d91 = toResObject(-0x1, _0x2f9951['msg']);
  180. _0x334d91[_0xdbaa('0x18')] = undefined;
  181. _0x40aa35(_0x334d91);
  182. }
  183. }, 0xfa0);
  184. }
  185. }
  186. function disconnectDeviceBluetooth(_0x2c9dfb) {
  187. sendA5Command('C3', {
  188. 'success': _0x202a3a => {
  189. _0x2c9dfb(toResObject(0x0, _0xdbaa('0x1b')));
  190. wx[_0xdbaa('0x39')]();
  191. wx[_0xdbaa('0x10')]();
  192. },
  193. 'fail': _0x351a4b => {
  194. _0x2c9dfb(toResObject(0x0, _0xdbaa('0x1b')));
  195. wx[_0xdbaa('0x39')]();
  196. wx[_0xdbaa('0x10')]();
  197. }
  198. }, 0xfa0);
  199. }
  200. const codeEnum = {
  201. 'successCode': 0x3e8,
  202. 'failureCode': 0x1,
  203. 'stopScanFailure': 0x2,
  204. 'creatConnectionFailure': 0x3,
  205. 'getServiceFailure': 0x4,
  206. 'noTargetServiceId': 0x5,
  207. 'getCharacteristicsFailure': 0x6,
  208. 'noTargetCharacteristic': 0x7,
  209. 'monitorNotificationFailure': 0x8,
  210. 'authResponseFailure': 0x9,
  211. 'initResponseFailure': 0xa,
  212. 'initDeviceFailure': 0xb,
  213. 'dataFrameTransboundary': 0xc,
  214. 'notPassBccCheck': 0xd,
  215. 'sendDataFailure': 0xe,
  216. 'paraError': 0xf,
  217. 'timeout': 0x64
  218. };
  219. const FUNCTION = 'function';
  220. const serviceUUID = '0000FEE7-0000-1000-8000-00805F9B34FB';
  221. const writeUUID = '0000FEC7-0000-1000-8000-00805F9B34FB';
  222. const readUUID = _0xdbaa('0x3f');
  223. const connectTime = 0x14 * 0x3e8;
  224. const startA2Time = 0xf0;
  225. const waitA2ResponseTime = 0x3e8;
  226. var haveFoundDevice = new Array();
  227. var connectDeviceId;
  228. var connectCallback;
  229. var connectTimer;
  230. var transTimer;
  231. var frame = '';
  232. var frameLen = 0x0;
  233. var frames = new Array();
  234. var framesLen = 0x0;
  235. var dataHandlerCallback;
  236. var sendBufferArray = new Array();
  237. var cmds = new Array();
  238. var sendIndex;
  239. var resendCount = 0x3;
  240. function toObject(_0x2a8196, _0xcef0ec, _0x4b69d4) {
  241. return {
  242. 'code': _0x2a8196,
  243. 'data': _0xcef0ec,
  244. 'msg': _0x4b69d4
  245. };
  246. }
  247. function startConnectBle() {
  248. wx[_0xdbaa('0x2d')]({
  249. 'deviceId': connectDeviceId,
  250. 'success': function(_0x344335) {
  251. startGetAndCheckService();
  252. },
  253. 'fail': function(_0x408275) {
  254. if (typeof connectTimer != undefined) {
  255. clearTimeout(connectTimer);
  256. }
  257. typeof connectCallback[_0xdbaa('0x1c')] == FUNCTION && connectCallback[_0xdbaa('0x1c')](
  258. toObject(0xfa0, undefined, _0x408275[_0xdbaa('0x2b')]));
  259. }
  260. });
  261. }
  262. function startGetAndCheckService() {
  263. wx[_0xdbaa('0xe')]({
  264. 'deviceId': connectDeviceId,
  265. 'success': function(_0x5b2630) {
  266. let _0x1480df = ![];
  267. for (let _0x33eba0 = 0x0; _0x33eba0 < _0x5b2630['services']['length']; _0x33eba0++) {
  268. let _0x56a201 = _0x5b2630['services'][_0x33eba0][_0xdbaa('0x0')];
  269. if (_0x56a201 == serviceUUID) {
  270. _0x1480df = !![];
  271. break;
  272. }
  273. }
  274. if (_0x1480df == !![]) {
  275. startGetAndCheckCharacterisitc();
  276. } else {
  277. if (typeof connectTimer != undefined) {
  278. clearTimeout(connectTimer);
  279. }
  280. typeof connectCallback[_0xdbaa('0x1c')] == FUNCTION && connectCallback['fail'](toObject(
  281. codeEnum[_0xdbaa('0x24')], undefined, _0xdbaa('0x24')));
  282. }
  283. },
  284. 'fail': function(_0x13c868) {
  285. if (typeof connectTimer != undefined) {
  286. clearTimeout(connectTimer);
  287. }
  288. typeof connectCallback[_0xdbaa('0x1c')] == FUNCTION && connectCallback['fail'](toObject(0xfa0,
  289. undefined, _0x13c868[_0xdbaa('0x2b')]));
  290. }
  291. });
  292. }
  293. function startGetAndCheckCharacterisitc() {
  294. wx['getBLEDeviceCharacteristics']({
  295. 'deviceId': connectDeviceId,
  296. 'serviceId': serviceUUID,
  297. 'success': function(_0x470d0a) {
  298. let _0x1fe81f = ![];
  299. let _0x11e288 = ![];
  300. for (let _0xebad80 = 0x0; _0xebad80 < _0x470d0a['characteristics'][_0xdbaa(
  301. '0x44')]; _0xebad80++) {
  302. let _0x359431 = _0x470d0a[_0xdbaa('0x43')][_0xebad80][_0xdbaa('0x0')];
  303. if (_0x359431 == readUUID) {
  304. _0x1fe81f = !![];
  305. } else if (_0x359431 == writeUUID) {
  306. _0x11e288 = !![];
  307. }
  308. if (_0x1fe81f == !![] && _0x11e288 == !![]) {
  309. break;
  310. }
  311. }
  312. if (_0x1fe81f == !![] && _0x11e288 == !![]) {
  313. monitorNotification();
  314. } else {
  315. if (typeof connectTimer != undefined) {
  316. clearTimeout(connectTimer);
  317. }
  318. typeof connectCallback['fail'] == FUNCTION && connectCallback[_0xdbaa('0x1c')](toObject(
  319. 0xfa0, undefined, 'noTargetCharacteristic'));
  320. }
  321. },
  322. 'fail': function(_0x58e8ac) {
  323. if (typeof connectTimer != undefined) {
  324. clearTimeout(connectTimer);
  325. }
  326. typeof connectCallback[_0xdbaa('0x1c')] == FUNCTION && connectCallback['fail'](toObject(0xfa0,
  327. undefined, _0x58e8ac[_0xdbaa('0x2b')]));
  328. }
  329. });
  330. }
  331. function monitorNotification() {
  332. wx['notifyBLECharacteristicValueChange']({
  333. 'deviceId': connectDeviceId,
  334. 'serviceId': serviceUUID,
  335. 'characteristicId': readUUID,
  336. 'state': !![],
  337. 'success': function(_0x8fb946) {
  338. if (typeof connectTimer != undefined) {
  339. clearTimeout(connectTimer);
  340. }
  341. setTimeout(() => {
  342. typeof connectCallback['success'] == FUNCTION && connectCallback['success'](
  343. toObject(codeEnum['successCode'], undefined, _0xdbaa('0x23')));
  344. }, 0x3e8);
  345. },
  346. 'fail': function() {
  347. if (typeof connectTimer != undefined) {
  348. clearTimeout(connectTimer);
  349. }
  350. typeof connectCallback['fail'] == FUNCTION && connectCallback['fail'](toObject(0xfa0, undefined,
  351. 'monitorNotificationFailure'));
  352. }
  353. });
  354. wx['onBLECharacteristicValueChange'](function(_0x28c56f) {
  355. if (_0x28c56f['deviceId'] = connectDeviceId && _0x28c56f['serviceId'] == serviceUUID && _0x28c56f[
  356. 'characteristicId'] == readUUID) {
  357. analyticData(_0x28c56f['value']);
  358. }
  359. });
  360. }
  361. var sendDataCount = 0x1;
  362. function analyticData(_0x81bc09) {
  363. let _0x33a038 = bufferArrayToHexString(_0x81bc09);
  364. if (_0x33a038[_0xdbaa('0x44')] == 0x28 && _0x33a038[_0xdbaa('0x1a')](0x0, 0x4) == _0xdbaa('0x1f')) {
  365. console[_0xdbaa('0x3a')](_0xdbaa('0x12'));
  366. sendDataCount = 0x0;
  367. }
  368. sendDataCount++;
  369. console[_0xdbaa('0x3a')]('第', sendDataCount, _0xdbaa('0x34'), _0x33a038);
  370. if (frame['length'] == 0x0) {
  371. frameLen = parseInt(_0x33a038[_0xdbaa('0x1a')](0x4, 0x8), 0x10) * 0x2;
  372. }
  373. frame += _0x33a038;
  374. if (frame['slice'](0x0, 0x4) != _0xdbaa('0x1f')) {
  375. frame = '';
  376. frameLen = 0x0;
  377. } else if (frame[_0xdbaa('0x44')] > frameLen) {
  378. frame = '';
  379. frameLen = 0x0;
  380. typeof dataHandlerCallback == FUNCTION && dataHandlerCallback(toObject(codeEnum[_0xdbaa('0x1d')], '', _0xdbaa(
  381. '0x3e')));
  382. } else if (frame[_0xdbaa('0x44')] == frameLen) {
  383. let _0x27b94d = frame[_0xdbaa('0x1a')](0x8, 0xc);
  384. if (_0x27b94d === _0xdbaa('0x2f')) {
  385. let _0x4d0d94 = frame[_0xdbaa('0x1a')](0x10);
  386. let _0x560f44 = _0x4d0d94[_0xdbaa('0x1a')](0x8, -0x6);
  387. frame = '';
  388. frameLen = 0x0;
  389. if (frames['length'] == 0x0) {
  390. let _0x189057 = parseInt(_0x560f44[_0xdbaa('0x1a')](0x4, 0x6), 0x10);
  391. framesLen = _0x189057 - 0x80 + 0x1;
  392. }
  393. frames['push'](_0x560f44);
  394. if (frames['length'] == framesLen) {
  395. let _0x563253 = !![];
  396. for (let _0x256751 = 0x0; _0x256751 < frames[_0xdbaa('0x44')]; _0x256751++) {
  397. let _0x2e116f = frames[_0x256751];
  398. let _0x1837ea = 0x0;
  399. for (let _0x37b89e = 0x1; _0x37b89e < parseInt(_0x2e116f['length'] / 0x2) - 0x1; _0x37b89e++) {
  400. let _0x72566f = parseInt(_0x2e116f[_0xdbaa('0x1a')](_0x37b89e * 0x2, (_0x37b89e + 0x1) * 0x2),
  401. 0x10);
  402. _0x1837ea ^= _0x72566f;
  403. }
  404. if (_0x1837ea != parseInt(_0x2e116f[_0xdbaa('0x1a')](-0x2), 0x10)) {
  405. _0x563253 = ![];
  406. break;
  407. }
  408. }
  409. if (_0x563253 == ![]) {
  410. frames = new Array();
  411. framesLen = 0x0;
  412. typeof dataHandlerCallback == FUNCTION && dataHandlerCallback(toObject(codeEnum['notPassBccCheck'],
  413. '', 'bcc校验不通过'));
  414. } else {
  415. let _0x52c7b9 = '';
  416. for (let _0x7bedb = 0x0; _0x7bedb < frames[_0xdbaa('0x44')]; _0x7bedb++) {
  417. let _0x58d038 = frames[_0x7bedb];
  418. _0x52c7b9 += _0x58d038[_0xdbaa('0x1a')](0x8, -0x2);
  419. }
  420. frames = new Array();
  421. framesLen = 0x0;
  422. typeof dataHandlerCallback == FUNCTION && dataHandlerCallback(toObject(codeEnum['successCode'],
  423. _0x52c7b9, '成功'));
  424. }
  425. }
  426. } else {
  427. console[_0xdbaa('0x3a')]('提示数据');
  428. frame = '';
  429. frameLen = 0x0;
  430. }
  431. }
  432. }
  433. function connectAndInit(_0x5c5db4, _0x38a451, _0x50526d) {
  434. connectDeviceId = _0x5c5db4[_0xdbaa('0x3d')];
  435. const _0x6cb3dd = connectDeviceId;
  436. console['log'](_0xdbaa('0x40'), _0x6cb3dd);
  437. if (_0x6cb3dd != 'undefined' && _0x6cb3dd != '') {
  438. wx['closeBLEConnection']({
  439. 'deviceId': _0x6cb3dd,
  440. 'success'(_0x1eca68) {
  441. console['log'](_0xdbaa('0x16'), _0x1eca68);
  442. },
  443. 'fail'(_0x2a8299) {
  444. console[_0xdbaa('0x3a')]('disconnectFail->', _0x2a8299);
  445. }
  446. });
  447. }
  448. connectDeviceId = _0x5c5db4[_0xdbaa('0x3d')];
  449. connectCallback = _0x38a451;
  450. if (typeof connectTimer != undefined) {
  451. clearTimeout(connectTimer);
  452. }
  453. connectTimer = setTimeout(() => {
  454. typeof connectCallback[_0xdbaa('0x1c')] == FUNCTION && connectCallback['fail'](toObject(0x7d2,
  455. undefined, '连接超时'));
  456. }, _0x50526d);
  457. startConnectBle();
  458. }
  459. function disconnectBleDevice(_0x17d8ce) {
  460. const _0x1e4bc6 = String(connectDeviceId);
  461. wx['closeBLEConnection']({
  462. 'deviceId': _0x1e4bc6,
  463. 'success'(_0x294a83) {
  464. typeof _0x17d8ce['success'] == FUNCTION && _0x17d8ce['success'](toObject(codeEnum[_0xdbaa('0x35')],
  465. _0x294a83, _0xdbaa('0x41')));
  466. },
  467. 'fail'(_0x1742ab) {
  468. typeof _0x17d8ce['fail'] == FUNCTION && _0x17d8ce[_0xdbaa('0x1c')](toObject(0xfa0, _0x1742ab,
  469. '断开连接失败'));
  470. }
  471. });
  472. }
  473. function sendAndReceive(_0x110528, _0x5e89f4, _0x1e49be, _0x4908cb) {
  474. let _0x1f8566 = ![];
  475. let _0x427250 = setTimeout(() => {
  476. typeof _0x1e49be[_0xdbaa('0x1c')] == FUNCTION && _0x1e49be[_0xdbaa('0x1c')](toObject(0x7d2, undefined,
  477. _0x110528 == 0x0 ? '发送ICC指令超时' : _0xdbaa('0x29')));
  478. }, _0x4908cb);
  479. transCmd(_0x110528, _0x5e89f4, {
  480. 'success': _0x3cc671 => {
  481. clearTimeout(_0x427250);
  482. typeof _0x1e49be['success'] == FUNCTION && _0x1e49be[_0xdbaa('0x19')](_0x3cc671);
  483. },
  484. 'fail': _0x4b7ca2 => {
  485. if (_0x4b7ca2['code'] == 0x7d0 && _0x1f8566 == ![]) {
  486. console['log'](_0xdbaa('0x38'));
  487. _0x1f8566 = !![];
  488. transCmd(_0x110528, _0x5e89f4, {
  489. 'success': _0x5707f6 => {
  490. clearTimeout(_0x427250);
  491. typeof _0x1e49be['success'] == FUNCTION && _0x1e49be['success'](
  492. _0x5707f6);
  493. },
  494. 'fail': _0x7ea0e2 => {
  495. clearTimeout(_0x427250);
  496. typeof _0x1e49be[_0xdbaa('0x1c')] == FUNCTION && _0x1e49be[_0xdbaa(
  497. '0x1c')](_0x7ea0e2);
  498. }
  499. }, 0x7d0);
  500. } else {
  501. clearTimeout(_0x427250);
  502. typeof _0x1e49be[_0xdbaa('0x1c')] == FUNCTION && _0x1e49be[_0xdbaa('0x1c')](_0x4b7ca2);
  503. }
  504. }
  505. }, 0x7d0);
  506. }
  507. function transCmd(_0x5a39f8, _0x3e8f43, _0x555f5d, _0x458940) {
  508. if (_0x5a39f8 != 0x0 && _0x5a39f8 != 0x1 && _0x5a39f8 != 0x2) {
  509. typeof _0x555f5d[_0xdbaa('0x1c')] == FUNCTION && _0x555f5d['fail'](toObject(0xfa0, undefined, 'type\x20错误'));
  510. return;
  511. }
  512. if (typeof transTimer != undefined) {
  513. clearTimeout(transTimer);
  514. }
  515. transTimer = setTimeout(() => {
  516. typeof _0x555f5d[_0xdbaa('0x1c')] == FUNCTION && _0x555f5d['fail'](toObject(0x7d2, undefined,
  517. _0x5a39f8 == 0x0 ? '发送ICC指令超时' : _0xdbaa('0x29')));
  518. }, _0x458940);
  519. cmds = _0x3e8f43['slice']();
  520. var _0x181c19 = new Array();
  521. var _0x47708a;
  522. var _0x4a4158;
  523. for (var _0x562067 = 0x0; _0x562067 < _0x3e8f43['length']; _0x562067++) {
  524. if (_0x562067 == 0x0) {
  525. _0x47708a = cmds[_0xdbaa('0x27')]();
  526. _0x4a4158 = promise(_0x47708a, _0x5a39f8);
  527. }
  528. _0x4a4158 = _0x4a4158['then'](_0x5b30d4 => {
  529. if (typeof transTimer != undefined) {
  530. clearTimeout(transTimer);
  531. }
  532. if (_0x5b30d4 === undefined) {
  533. return;
  534. }
  535. _0x181c19['push'](_0x5b30d4);
  536. if (cmds['length'] > 0x0) {
  537. transTimer = setTimeout(() => {
  538. typeof _0x555f5d[_0xdbaa('0x1c')] == FUNCTION && _0x555f5d['fail'](toObject(0x7d2,
  539. undefined, _0x5a39f8 == 0x0 ? _0xdbaa('0x2a') : '发送esam指令超时'));
  540. }, _0x458940);
  541. _0x47708a = cmds[_0xdbaa('0x27')]();
  542. return promise(_0x47708a, _0x5a39f8);
  543. }
  544. typeof _0x555f5d['success'] == FUNCTION && _0x555f5d['success'](toObject(codeEnum[_0xdbaa('0x35')],
  545. _0x181c19, _0x5a39f8 == 0x0 ? _0xdbaa('0x1') : _0xdbaa('0x32')));
  546. }, (_0x50f5ee, _0x791fff) => {
  547. if (_0x50f5ee != undefined) {
  548. if (typeof transTimer != undefined) {
  549. clearTimeout(transTimer);
  550. }
  551. typeof _0x555f5d['fail'] == FUNCTION && _0x555f5d[_0xdbaa('0x1c')](toObject(0xfa0, _0x181c19,
  552. _0x47708a + _0x50f5ee));
  553. }
  554. });
  555. }
  556. }
  557. function promise(_0x24ae76, _0x84d67c) {
  558. return new Promise((_0xbfca21, _0x37740f) => {
  559. if (_0x84d67c === 0x0) {
  560. var _0x50d360 = makeA3SendData('00', makeTLV([_0x24ae76]));
  561. } else {
  562. var _0x50d360 = makeACSendData('00', makeTLV([_0x24ae76]));
  563. }
  564. sendDataToDevice(_0x50d360, _0x307c84 => {
  565. if (_0x307c84[_0xdbaa('0x14')] === codeEnum[_0xdbaa('0x35')]) {
  566. if (_0x307c84['data']['slice'](0x2, 0x4) === '00' || _0x307c84['data']['slice'](0x2,
  567. 0x4) === 'cf') {
  568. let _0x2aa53b = _0x307c84[_0xdbaa('0x18')][_0xdbaa('0x1a')](0xa);
  569. let _0xc33b5 = resolveTLV(_0x307c84['data']['slice'](0xa));
  570. if (_0xc33b5[_0xdbaa('0x44')] == 0x1) {
  571. _0xbfca21(_0xc33b5[0x0]);
  572. } else {
  573. _0x37740f('数据返回错误');
  574. }
  575. } else {
  576. let _0x294462 = _0x307c84['data'][_0xdbaa('0x1a')](0xa);
  577. let _0x100afb = resolveTLV(_0x307c84[_0xdbaa('0x18')]['slice'](0xa));
  578. _0x37740f('错误码:' + _0x100afb[_0x100afb['length'] - 0x1]['slice'](-0x4));
  579. }
  580. } else {
  581. _0x37740f(_0x307c84[_0xdbaa('0x22')]);
  582. }
  583. });
  584. });
  585. }
  586. function sendDataToDevice(_0x4d4da7, _0x262979) {
  587. dataHandlerCallback = _0x262979;
  588. sendBufferArray = new Array()[_0xdbaa('0xa')](_0x4d4da7);
  589. sendIndex = 0x0;
  590. frame = '';
  591. frameLen = 0x0;
  592. frames = new Array();
  593. framesLen = 0x0;
  594. console['log']('开始发送:');
  595. runningSendData();
  596. }
  597. function runningSendData() {
  598. let _0x29f9c6 = sendBufferArray[sendIndex];
  599. let _0x560439 = bufferArrayToHexString(_0x29f9c6);
  600. console['log']('第', sendIndex + 0x1, _0xdbaa('0x34'), _0x560439);
  601. wx[_0xdbaa('0x9')]({
  602. 'deviceId': connectDeviceId,
  603. 'serviceId': serviceUUID,
  604. 'characteristicId': writeUUID,
  605. 'value': _0x29f9c6,
  606. 'success': function(_0x2f1c3c) {
  607. sendIndex++;
  608. resendCount = 0x3;
  609. if (sendIndex < sendBufferArray['length']) {
  610. runningSendData();
  611. }
  612. },
  613. 'fail': function(_0x177d36) {
  614. if (resendCount > 0x0) {
  615. resendCount--;
  616. setTimeout(() => {
  617. console['log']('第' + (0x3 - resendCount) + '次重发');
  618. runningSendData();
  619. }, 0xc8);
  620. } else {
  621. typeof dataHandlerCallback == FUNCTION && dataHandlerCallback(toObject(codeEnum[
  622. 'sendDataFailure'], '', _0xdbaa('0x31') + _0x177d36['errMsg']));
  623. }
  624. }
  625. });
  626. }
  627. function sendA5Command(_0x2af7a9, _0x1d6ff7, _0x3a565b) {
  628. var _0x5e3a62 = setTimeout(() => {
  629. typeof _0x1d6ff7[_0xdbaa('0x1c')] == FUNCTION && _0x1d6ff7[_0xdbaa('0x1c')](toObject(0x7d2, undefined,
  630. _0xdbaa('0xf')));
  631. }, _0x3a565b);
  632. var _0x46493e = makeA5SendData(_0x2af7a9);
  633. sendDataToDevice(_0x46493e, _0x5c480e => {
  634. if (_0x5e3a62 != undefined) {
  635. clearTimeout(_0x5e3a62);
  636. }
  637. if (_0x5c480e[_0xdbaa('0x14')] === codeEnum[_0xdbaa('0x35')]) {
  638. if (_0x5c480e[_0xdbaa('0x18')]['slice'](0x0, 0x2) == 'b5' && _0x5c480e['data'][_0xdbaa('0x1a')](0x2,
  639. 0x4) == '00') {
  640. let _0x2ab972 = parseInt(_0x5c480e['data'][_0xdbaa('0x1a')](0x4, 0x6), 0x10);
  641. typeof _0x1d6ff7['success'] == FUNCTION && _0x1d6ff7['success'](toObject(codeEnum[_0xdbaa(
  642. '0x35')], _0x5c480e['data']['slice'](0x6, 0x6 + _0x2ab972 * 0x2), '成功'));
  643. } else {
  644. typeof _0x1d6ff7['fail'] == FUNCTION && _0x1d6ff7[_0xdbaa('0x1c')](toObject(0xfa0, _0x5c480e[
  645. 'data'], _0xdbaa('0x11')));
  646. }
  647. } else {
  648. typeof _0x1d6ff7[_0xdbaa('0x1c')] == FUNCTION && _0x1d6ff7[_0xdbaa('0x1c')](toObject(0xfa0,
  649. undefined, _0xdbaa('0x15')));
  650. }
  651. });
  652. }
  653. function openOrCloseAerial(_0x40f5d6, _0x37f2d4, _0x451391, _0x4c2faa) {
  654. if (_0x40f5d6 != 0x1 && _0x40f5d6 != 0x2 && _0x40f5d6 != 0x3 && _0x40f5d6 != 0x4) {
  655. typeof _0x451391['fail'] == FUNCTION && _0x451391[_0xdbaa('0x1c')](toObject(0xfa0, undefined, _0xdbaa('0x8')));
  656. } else {
  657. var _0x564530 = setTimeout(() => {
  658. typeof _0x451391[_0xdbaa('0x1c')] == FUNCTION && _0x451391['fail'](toObject(0x7d2, undefined,
  659. '打开/关闭5.8G指令超时'));
  660. }, _0x4c2faa);
  661. let _0x472d65 = _0x37f2d4;
  662. if (_0x37f2d4 < 0x0) {
  663. _0x472d65 = 0x0;
  664. }
  665. if (_0x37f2d4 > 0x12c) {
  666. _0x472d65 = 0x12c;
  667. }
  668. let _0x297ab6 = 'C7' + parseInt(_0x40f5d6)['toString'](0x10)[_0xdbaa('0x21')](0x2, '0');
  669. if (_0x40f5d6 == 0x2) {
  670. _0x297ab6 += parseInt(_0x472d65)[_0xdbaa('0x3b')](0x10)['padStart'](0x4, '0');
  671. }
  672. var _0x4c7439 = makeA5SendData(_0x297ab6);
  673. sendDataToDevice(_0x4c7439, _0x3d8cdb => {
  674. if (_0x564530 != undefined) {
  675. clearTimeout(_0x564530);
  676. }
  677. if (_0x3d8cdb['code'] === codeEnum[_0xdbaa('0x35')]) {
  678. if (_0x3d8cdb['data'][_0xdbaa('0x1a')](0x0, 0x2) == 'b5' && _0x3d8cdb[_0xdbaa('0x18')]['slice'](
  679. 0x2, 0x4) == '00') {
  680. let _0x28bf0e = parseInt(_0x3d8cdb['data'][_0xdbaa('0x1a')](0x4, 0x6), 0x10);
  681. typeof _0x451391['success'] == FUNCTION && _0x451391['success'](toObject(codeEnum[_0xdbaa(
  682. '0x35')], _0x3d8cdb[_0xdbaa('0x18')][_0xdbaa('0x1a')](0x6, 0x6 + _0x28bf0e *
  683. 0x2), '成功'));
  684. } else {
  685. typeof _0x451391['fail'] == FUNCTION && _0x451391['fail'](toObject(0xfa0, _0x3d8cdb[_0xdbaa(
  686. '0x18')], _0xdbaa('0x11')));
  687. }
  688. } else {
  689. typeof _0x451391[_0xdbaa('0x1c')] == FUNCTION && _0x451391['fail'](toObject(0xfa0, undefined,
  690. '打开/关闭5.8G失败'));
  691. }
  692. });
  693. }
  694. }
  695. function sendA9Command(_0x365ba9, _0x40c12c) {
  696. var _0x587b3c = setTimeout(() => {
  697. typeof _0x365ba9[_0xdbaa('0x1c')] == FUNCTION && _0x365ba9[_0xdbaa('0x1c')](toObject(0x7d2, undefined,
  698. '卡片复位超时'));
  699. }, _0x40c12c);
  700. var _0x5134c0 = makeA9SendData('00');
  701. sendDataToDevice(_0x5134c0, _0xa8dfb9 => {
  702. if (_0x587b3c != undefined) {
  703. clearTimeout(_0x587b3c);
  704. }
  705. if (_0xa8dfb9[_0xdbaa('0x14')] === codeEnum['successCode']) {
  706. if (_0xa8dfb9['data']['slice'](0x0, 0x2) == 'b9' && _0xa8dfb9[_0xdbaa('0x18')][_0xdbaa('0x1a')](0x2,
  707. 0x4) == '00') {
  708. let _0x236cf6 = parseInt(_0xa8dfb9[_0xdbaa('0x18')]['slice'](0x4, 0x6), 0x10);
  709. typeof _0x365ba9[_0xdbaa('0x19')] == FUNCTION && _0x365ba9['success'](toObject(codeEnum[
  710. 'successCode'], _0xa8dfb9[_0xdbaa('0x18')]['slice'](0x6, 0x6 + _0x236cf6 * 0x2),
  711. '成功'));
  712. } else {
  713. typeof _0x365ba9[_0xdbaa('0x1c')] == FUNCTION && _0x365ba9[_0xdbaa('0x1c')](toObject(0xfa0,
  714. _0xa8dfb9['data'], _0xdbaa('0x33')));
  715. }
  716. } else {
  717. typeof _0x365ba9['fail'] == FUNCTION && _0x365ba9['fail'](toObject(0xfa0, undefined, _0xdbaa(
  718. '0x2e')));
  719. }
  720. });
  721. }
  722. const frame_Len = 0x32 * 0x2;
  723. const send_Len = 0x14 * 0x2;
  724. const ST = '33';
  725. const pre_Proto = _0xdbaa('0x30');
  726. const end_Proto = _0xdbaa('0x2c');
  727. const bMagic = 'fe';
  728. const bVer = '01';
  729. const bCmdId = '7531';
  730. var SEQ = 0x3;
  731. function makeFrame(_0x2a2c7b) {
  732. let _0x2964c8 = parseInt(_0x2a2c7b[_0xdbaa('0x44')] / frame_Len);
  733. let _0xe34cea = _0x2a2c7b[_0xdbaa('0x44')] % frame_Len;
  734. let _0x1af1e4 = new Array();
  735. for (let _0x229e92 = 0x0; _0x229e92 < _0x2964c8; _0x229e92++) {
  736. _0x1af1e4[_0xdbaa('0x7')](_0x2a2c7b[_0xdbaa('0x1a')](_0x229e92 * frame_Len, (_0x229e92 + 0x1) * frame_Len));
  737. }
  738. if (_0xe34cea > 0x0) {
  739. _0x1af1e4[_0xdbaa('0x7')](_0x2a2c7b['slice'](-_0xe34cea));
  740. }
  741. let _0x5d2a25 = new Array();
  742. for (let _0x13860c = 0x0; _0x13860c < _0x1af1e4['length']; _0x13860c++) {
  743. let _0x1ff86c = _0x1af1e4[_0x13860c];
  744. let _0x430530 = numberToHexString(_0x13860c + 0x1, 0x1, !![]);
  745. let _0x27a37e = '';
  746. if (_0x13860c == 0x0) {
  747. _0x27a37e = numberToHexString(0x80 + _0x1af1e4[_0xdbaa('0x44')] - 0x1, 0x1, !![]);
  748. } else {
  749. _0x27a37e = numberToHexString(_0x1af1e4[_0xdbaa('0x44')] - _0x13860c - 0x1, 0x1, !![]);
  750. }
  751. let _0x391d6c = numberToHexString(parseInt(_0x1ff86c[_0xdbaa('0x44')] / 0x2), 0x1, !![]);
  752. let _0x40aa72 = ST + _0x430530 + _0x27a37e + _0x391d6c + _0x1ff86c;
  753. let _0x53fcd9 = 0x0;
  754. for (let _0x395d1a = 0x1; _0x395d1a < parseInt(_0x40aa72['length'] / 0x2); _0x395d1a++) {
  755. let _0x3ea4c0 = parseInt(_0x40aa72['slice'](_0x395d1a * 0x2, (_0x395d1a + 0x1) * 0x2), 0x10);
  756. _0x53fcd9 = _0x53fcd9 ^ _0x3ea4c0;
  757. }
  758. _0x40aa72 += numberToHexString(_0x53fcd9, 0x1, !![]);
  759. _0x5d2a25[_0xdbaa('0x7')](_0x40aa72);
  760. }
  761. let _0x40387a = new Array();
  762. for (let _0x25293d = 0x0; _0x25293d < _0x5d2a25[_0xdbaa('0x44')]; _0x25293d++) {
  763. let _0x2a26d4 = _0x5d2a25[_0x25293d];
  764. let _0x402715 = numberToHexString(parseInt(_0x2a26d4['length'] / 0x2), 0x1, !![]);
  765. let _0x80b5a1 = pre_Proto + _0x402715 + _0x2a26d4 + end_Proto;
  766. _0x40387a[_0xdbaa('0x7')](_0x80b5a1);
  767. }
  768. let _0x5143d4 = new Array();
  769. for (let _0x264a59 = 0x0; _0x264a59 < _0x40387a[_0xdbaa('0x44')]; _0x264a59++) {
  770. let _0xbc2ce5 = _0x40387a[_0x264a59];
  771. let _0x3c40cf = numberToHexString(parseInt(_0xbc2ce5['length'] / 0x2) + 0x8, 0x2, !![]);
  772. let _0x1b89ff = numberToHexString(SEQ, 0x2, !![]);
  773. let _0x2ad2c8 = bMagic + bVer + _0x3c40cf + bCmdId + _0x1b89ff + _0xbc2ce5;
  774. _0x5143d4[_0xdbaa('0x7')](_0x2ad2c8);
  775. }
  776. SEQ++;
  777. if (SEQ > 0xf) {
  778. SEQ = 0x1;
  779. }
  780. let _0x461a7b = new Array();
  781. for (let _0xe28229 = 0x0; _0xe28229 < _0x5143d4['length']; _0xe28229++) {
  782. let _0x44ffca = _0x5143d4[_0xe28229];
  783. let _0x20750e = parseInt(_0x44ffca['length'] / send_Len);
  784. let _0x27c4e6 = _0x44ffca['length'] % send_Len;
  785. for (let _0x22183c = 0x0; _0x22183c < _0x20750e; _0x22183c++) {
  786. let _0x451f31 = _0x44ffca['slice'](_0x22183c * send_Len, (_0x22183c + 0x1) * send_Len);
  787. _0x461a7b['push'](hexStringToBufferArray(_0x451f31));
  788. }
  789. if (_0x27c4e6 > 0x0) {
  790. let _0x27cd63 = _0x44ffca['slice'](-_0x27c4e6);
  791. _0x461a7b['push'](hexStringToBufferArray(_0x27cd63));
  792. }
  793. }
  794. return _0x461a7b;
  795. }
  796. function makeA3SendData(_0xc88ab7, _0x5bd73d) {
  797. let _0x3f0364 = 'a3' + _0xc88ab7;
  798. let _0x42c12f = numberToHexString(parseInt(_0x5bd73d['length'] / 0x2), 0x2, ![]);
  799. _0x3f0364 += _0x42c12f;
  800. _0x3f0364 += _0x5bd73d;
  801. return makeFrame(_0x3f0364);
  802. }
  803. function makeA7SendData(_0xc5fc95, _0x224e5b) {
  804. let _0x3e99ed = 'a7' + _0xc5fc95;
  805. let _0x549e70 = numberToHexString(parseInt(_0x224e5b['length'] / 0x2), 0x2, ![]);
  806. _0x3e99ed += _0x549e70;
  807. _0x3e99ed += _0x224e5b;
  808. return makeFrame(_0x3e99ed);
  809. }
  810. function makeACSendData(_0x4a0b65, _0x24aee) {
  811. let _0x23e0ab = 'ac' + _0x4a0b65;
  812. let _0x4d2e97 = numberToHexString(parseInt(_0x24aee[_0xdbaa('0x44')] / 0x2), 0x2, ![]);
  813. _0x23e0ab += _0x4d2e97;
  814. _0x23e0ab += _0x24aee;
  815. return makeFrame(_0x23e0ab);
  816. }
  817. function numberToHexString(_0x1ca28c, _0x49cb0b, _0x1befcb) {
  818. let _0x594c49 = _0x1ca28c[_0xdbaa('0x3b')](0x10);
  819. for (let _0x20d709 = _0x594c49['length']; _0x20d709 < _0x49cb0b * 0x2; _0x20d709++) {
  820. _0x594c49 = '0' + _0x594c49;
  821. }
  822. if (_0x594c49[_0xdbaa('0x44')] > _0x49cb0b * 0x2) {
  823. _0x594c49 = _0x594c49['substring'](_0x594c49['length'] - _0x49cb0b * 0x2);
  824. }
  825. if (_0x1befcb == ![]) {
  826. let _0x3cc91b = '';
  827. for (let _0x270ccf = _0x594c49[_0xdbaa('0x44')] - 0x2; _0x270ccf >= 0x0; _0x270ccf -= 0x2) {
  828. _0x3cc91b = _0x3cc91b + _0x594c49[_0xdbaa('0x13')](_0x270ccf, _0x270ccf + 0x2);
  829. }
  830. _0x594c49 = _0x3cc91b;
  831. }
  832. return _0x594c49;
  833. }
  834. function hexStringToBufferArray(_0x48d905) {
  835. let _0x43c9d9 = new Uint8Array(_0x48d905[_0xdbaa('0x28')](/[0-9a-f]{2}/gi)[_0xdbaa('0x42')](function(_0x474769) {
  836. return parseInt(_0x474769, 0x10);
  837. }));
  838. return _0x43c9d9[_0xdbaa('0xd')];
  839. }
  840. function bufferArrayToHexString(_0x25e6b9) {
  841. let _0x2acc66 = Array[_0xdbaa('0x4')]['map']['call'](new Uint8Array(_0x25e6b9), _0x5bee07 => ('00' + _0x5bee07[
  842. 'toString'](0x10))[_0xdbaa('0x1a')](-0x2))['join']('');
  843. return _0x2acc66;
  844. }
  845. function makeTLVBak(_0x591774) {
  846. let _0x2eec7f = '';
  847. for (let _0x19568d = 0x0; _0x19568d < _0x591774[_0xdbaa('0x44')]; _0x19568d++) {
  848. _0x2eec7f += (_0x19568d + 0x1)[_0xdbaa('0x3b')](0x10)['padStart'](0x2, '0') + (_0x591774[_0x19568d]['length'] /
  849. 0x2)[_0xdbaa('0x3b')](0x10)[_0xdbaa('0x21')](0x2, '0') + _0x591774[_0x19568d];
  850. }
  851. return '80' + (_0x2eec7f[_0xdbaa('0x44')] / 0x2)['toString'](0x10)[_0xdbaa('0x21')](0x2, '0') + _0x2eec7f;
  852. }
  853. function makeTLV(_0x192f4e) {
  854. let _0xbbf774 = '';
  855. for (let _0x5d5862 = 0x0; _0x5d5862 < _0x192f4e['length']; _0x5d5862++) {
  856. let _0x541ee8 = '' + _0x192f4e[_0x5d5862];
  857. _0xbbf774 = _0xbbf774 + numberToHexString(_0x5d5862 + 0x1, 0x1, !![]) + numberToHexString(parseInt(_0x541ee8[
  858. 'length'] / 0x2), 0x1, !![]) + _0x541ee8;
  859. }
  860. let _0x365434 = _0xbbf774[_0xdbaa('0x44')] / 0x2;
  861. let _0x5431e7 = _0x365434['toString'](0x10);
  862. if (_0x5431e7['length'] % 0x2 != 0x0) {
  863. _0x5431e7 = '0' + _0x5431e7;
  864. }
  865. if (_0x365434 > 0x80) {
  866. _0x5431e7 = (0x80 + parseInt(_0x5431e7[_0xdbaa('0x44')] / 0x2))[_0xdbaa('0x3b')](0x10) + _0x5431e7;
  867. }
  868. return '80' + _0x5431e7 + _0xbbf774;
  869. }
  870. function resolveTLV(_0x3dfd3c) {
  871. let _0x130972 = new Array();
  872. let _0x31ce63 = parseInt(_0x3dfd3c['substring'](0x2, 0x4), 0x10);
  873. let _0x86449f = 0x4;
  874. if (_0x31ce63 > 0x80) {
  875. _0x86449f = _0x86449f + (_0x31ce63 - 0x80) * 0x2;
  876. }
  877. let _0x1d7f5 = 0x1;
  878. while (_0x86449f < _0x3dfd3c[_0xdbaa('0x44')]) {
  879. let _0x2b1a7c = parseInt(_0x3dfd3c[_0xdbaa('0x13')](_0x86449f, _0x86449f + 0x2), 0x10);
  880. _0x86449f += 0x2;
  881. let _0x47215f = parseInt(_0x3dfd3c['substring'](_0x86449f, _0x86449f + 0x2), 0x10);
  882. _0x86449f += 0x2;
  883. let _0x55279b = _0x3dfd3c[_0xdbaa('0x13')](_0x86449f, _0x86449f + _0x47215f * 0x2);
  884. _0x130972[_0xdbaa('0x7')](_0x55279b);
  885. _0x86449f += _0x47215f * 0x2;
  886. }
  887. return _0x130972;
  888. }
  889. function makeA5SendData(_0x563955) {
  890. let _0x3e7ee7 = 'a5';
  891. let _0x3a3e5c = Number(parseInt(_0x563955[_0xdbaa('0x44')] / 0x2))[_0xdbaa('0x3b')](0x10)['padStart'](0x2, '0');
  892. _0x3e7ee7 += _0x3a3e5c;
  893. _0x3e7ee7 += _0x563955;
  894. return makeFrame(_0x3e7ee7);
  895. }
  896. function makeA9SendData(_0x221624) {
  897. let _0x4dc3d7 = 'a9';
  898. let _0x1f7102 = Number(parseInt(_0x221624['length'] / 0x2))[_0xdbaa('0x3b')](0x10)[_0xdbaa('0x21')](0x2, '0');
  899. _0x4dc3d7 += _0x1f7102;
  900. _0x4dc3d7 += _0x221624;
  901. return makeFrame(_0x4dc3d7);
  902. }