_name = "前装-万集"; //共用 | _name = "前装-万集"; //共用 | ||||
} else if (name.split("-")[1] == "JY") { | } else if (name.split("-")[1] == "JY") { | ||||
_name = "前装-金溢"; | _name = "前装-金溢"; | ||||
}else if (name.split("-")[1] == "ATS") { | |||||
_name = "前装-埃特斯"; | |||||
} | } | ||||
break; | break; | ||||
case "WJ": | case "WJ": | ||||
switch (prefixName) { | switch (prefixName) { | ||||
case "ETC": | case "ETC": | ||||
console.log("device.name=====", device.name, device.name.includes("KC"), device.name.includes("JY"), device.name.includes("KC") || device.name.includes("K") || device.name.includes("C")) | console.log("device.name=====", device.name, device.name.includes("KC"), device.name.includes("JY"), device.name.includes("KC") || device.name.includes("K") || device.name.includes("C")) | ||||
let obj = "" | |||||
if (device.name.includes("KC") || device.name.includes("K")) { | if (device.name.includes("KC") || device.name.includes("K")) { | ||||
kcApi.connectDevice( | |||||
device, | |||||
function (res) { | |||||
preDevice(res); | |||||
}, | |||||
function (res) { | |||||
listenStatus(res); | |||||
} | |||||
); | |||||
obj=kcApi | |||||
} else if (device.name.includes("JL")) { | } else if (device.name.includes("JL")) { | ||||
jlQZApi.connectDevice( | |||||
device, | |||||
function (res) { | |||||
preDevice(res); | |||||
}, | |||||
function (res) { | |||||
listenStatus(res); | |||||
} | |||||
); | |||||
obj=jlQZApi | |||||
} else if (device.name.includes("WJ")) { | } else if (device.name.includes("WJ")) { | ||||
wjApi9901.connectDevice( | |||||
device, | |||||
function (res) { | |||||
preDevice(res); | |||||
}, | |||||
function (res) { | |||||
listenStatus(res); | |||||
} | |||||
); | |||||
obj=wjApi9901 | |||||
}else if (device.name.includes("ATS")) { | |||||
obj=ArtcBleUtilApi | |||||
} | } | ||||
obj.connectDevice( | |||||
device, | |||||
function (res) { | |||||
preDevice(res); | |||||
}, | |||||
function (res) { | |||||
listenStatus(res); | |||||
} | |||||
); | |||||
// else if (device.name.includes("JY")) { | // else if (device.name.includes("JY")) { | ||||
// console.log("进来了JY",device.name.includes("JY")) | // console.log("进来了JY",device.name.includes("JY")) | ||||
// jyApiEtc.connectDevice( | // jyApiEtc.connectDevice( |
const _0x5cb5=['group','toISOString','clear','\x20[TRACE]\x20','\x20[WARN]\x20','exports','trace','\x20[CUSTOM]\x20','\x20[ERROR]\x20'];const _0x4d4e=function(_0x5cb534,_0x4d4e92){_0x5cb534=_0x5cb534-0x0;let _0x42488b=_0x5cb5[_0x5cb534];return _0x42488b;};const TAG='Artc';const ArtcConsole={'log':function(_0x1b6b8d){console['log'](TAG+'\x20[LOG]\x20'+new Date()['toISOString']()+':\x20'+_0x1b6b8d);},'info':function(_0x208069){console['info'](TAG+'\x20[INFO]\x20'+new Date()['toISOString']()+':\x20'+_0x208069);},'warn':function(_0x13212c){console['warn'](TAG+_0x4d4e('0x4')+new Date()[_0x4d4e('0x1')]()+':\x20'+_0x13212c);},'error':function(_0x2f91f3){console['error'](TAG+_0x4d4e('0x8')+new Date()[_0x4d4e('0x1')]()+':\x20'+_0x2f91f3);},'debug':function(_0x465236){console['debug'](TAG+'\x20[DEBUG]\x20'+new Date()[_0x4d4e('0x1')]()+':\x20'+_0x465236);},'group':function(_0x45a0d3){console[_0x4d4e('0x0')](TAG+'\x20[GROUP]\x20'+new Date()['toISOString']()+':\x20'+_0x45a0d3);},'groupEnd':function(){console['groupEnd']();},'trace':function(){console[_0x4d4e('0x6')](TAG+_0x4d4e('0x3')+new Date()[_0x4d4e('0x1')]());},'clear':function(){console[_0x4d4e('0x2')]();},'custom':function(_0x49341c,_0x53fe2f){console[_0x49341c](TAG+_0x4d4e('0x7')+new Date()[_0x4d4e('0x1')]()+':\x20'+_0x53fe2f);}};module[_0x4d4e('0x5')]=ArtcConsole; |
const _0x1962=['length','toString','advertisData','trim','exports','substring','toLowerCase','toUpperCase','slice','buffer','match','prototype','call','Illegal\x20Format\x20ASCII\x20Code!','TextDecoder','map'];const _0x3330=function(_0x1962b0,_0x3330c1){_0x1962b0=_0x1962b0-0x0;let _0x4e9ede=_0x1962[_0x1962b0];return _0x4e9ede;};var encoding=require('./ArtcGBK.js');var buf2hex=function(_0x5bd4e9){let _0x1a18f2=Array[_0x3330('0xb')]['map']['call'](new Uint8Array(_0x5bd4e9),_0x255802=>('00'+_0x255802[_0x3330('0x1')](0x10))[_0x3330('0x8')](-0x2))['join']('');return _0x1a18f2[_0x3330('0x7')]();};var hex2buf=function(_0x4c4d54){let _0x2ee1f0=new Uint8Array(_0x4c4d54[_0x3330('0xa')](/[\da-f]{2}/gi)[_0x3330('0xf')](function(_0x21bdce){return parseInt(_0x21bdce,0x10);}));return _0x2ee1f0[_0x3330('0x9')];};var numberToHexString=function(_0xadcca3,_0x275e57,_0x4bc3dc){let _0x3f6ee6=_0xadcca3['toString'](0x10);for(let _0x27853e=_0x3f6ee6['length'];_0x27853e<_0x275e57*0x2;_0x27853e++){_0x3f6ee6='0'+_0x3f6ee6;}if(_0x3f6ee6['length']>_0x275e57*0x2){_0x3f6ee6=_0x3f6ee6[_0x3330('0x5')](_0x3f6ee6[_0x3330('0x0')]-_0x275e57*0x2);}if(_0x4bc3dc==![]){let _0xc72b7='';for(let _0x1a27d5=_0x3f6ee6['length']-0x2;_0x1a27d5>=0x0;_0x1a27d5-=0x2){_0xc72b7=_0xc72b7+_0x3f6ee6[_0x3330('0x5')](_0x1a27d5,_0x1a27d5+0x2);}_0x3f6ee6=_0xc72b7;}return _0x3f6ee6['toUpperCase']();};function hexToStr(_0x175b6d,_0x352fc7){var _0x160aeb=_0x175b6d[_0x3330('0x3')]();var _0x289bb3=_0x160aeb['substr'](0x0,0x2)[_0x3330('0x6')]()==='0x'?_0x160aeb['substr'](0x2):_0x160aeb;var _0x430cb7=_0x289bb3['length'];if(_0x430cb7%0x2!==0x0){alert(_0x3330('0xd'));return'';}var _0x429aed;var _0xabfc77=[];for(var _0x214b34=0x0;_0x214b34<_0x430cb7;_0x214b34=_0x214b34+0x2){_0x429aed=parseInt(_0x289bb3['substr'](_0x214b34,0x2),0x10);_0xabfc77['push'](_0x429aed);}var _0x5cbff2=new Uint8Array(_0xabfc77);var _0x819f23=new encoding[(_0x3330('0xe'))](_0x352fc7)['decode'](_0x5cbff2);return _0x819f23;}function hexStringToBufferArray(_0x428696){let _0x304cba=new Uint8Array(_0x428696['match'](/[\da-f]{2}/gi)['map'](function(_0x1886e2){return parseInt(_0x1886e2,0x10);}));return _0x304cba[_0x3330('0x9')];}function bufferArrayToHexString(_0x1a5cca){let _0x31f9ec=Array[_0x3330('0xb')][_0x3330('0xf')]['call'](new Uint8Array(_0x1a5cca),_0x45a569=>('00'+_0x45a569['toString'](0x10))['slice'](-0x2))['join']('');return _0x31f9ec;}function makeTLV(_0x1d428b){let _0x431554='';for(let _0x1cc777=0x0;_0x1cc777<_0x1d428b['length'];_0x1cc777++){let _0x14fe96=''+_0x1d428b[_0x1cc777];_0x431554=_0x431554+numberToHexString(_0x1cc777+0x1,0x1,!![])+numberToHexString(parseInt(_0x14fe96[_0x3330('0x0')]/0x2),0x1,!![])+_0x14fe96;}let _0x531cef=_0x431554['length']/0x2;let _0x1b0f49=_0x531cef[_0x3330('0x1')](0x10);if(_0x1b0f49['length']%0x2!=0x0){_0x1b0f49='0'+_0x1b0f49;}if(_0x531cef>0x80){_0x1b0f49=(0x80+parseInt(_0x1b0f49[_0x3330('0x0')]/0x2))['toString'](0x10)+_0x1b0f49;}return'80'+_0x1b0f49+_0x431554;}function makeTLVWithCondition(_0x44409e,_0x53639b){let _0x588a79='';for(let _0x2b25c1=0x0;_0x2b25c1<_0x44409e[_0x3330('0x0')];_0x2b25c1++){let _0x16f96d=''+_0x44409e[_0x2b25c1];let _0x3daf45=_0x2b25c1+0x1;if(_0x53639b[_0x2b25c1]===![]){_0x3daf45=0x80+_0x3daf45;}_0x588a79=_0x588a79+numberToHexString(_0x3daf45,0x1,!![])+numberToHexString(parseInt(_0x16f96d['length']/0x2),0x1,!![])+_0x16f96d;}let _0x35ccc7=_0x588a79['length']/0x2;let _0x4b3ead=_0x35ccc7[_0x3330('0x1')](0x10);if(_0x4b3ead['length']%0x2!=0x0){_0x4b3ead='0'+_0x4b3ead;}if(_0x35ccc7>0x80){_0x4b3ead=(0x80+parseInt(_0x4b3ead[_0x3330('0x0')]/0x2))[_0x3330('0x1')](0x10)+_0x4b3ead;}return'80'+_0x4b3ead+_0x588a79;}function resolveTLV(_0x508f72){let _0x16f79b=new Array();let _0x38332b=parseInt(_0x508f72[_0x3330('0x5')](0x2,0x4),0x10);let _0x5824af=0x4;if(_0x38332b>0x80){_0x5824af=_0x5824af+(_0x38332b-0x80)*0x2;}let _0x958164=0x1;while(_0x5824af<_0x508f72[_0x3330('0x0')]){let _0x308a5f=parseInt(_0x508f72['substring'](_0x5824af,_0x5824af+0x2),0x10);_0x5824af+=0x2;let _0x5bf58d=parseInt(_0x508f72[_0x3330('0x5')](_0x5824af,_0x5824af+0x2),0x10);_0x5824af+=0x2;let _0x35f4c9=_0x508f72['substring'](_0x5824af,_0x5824af+_0x5bf58d*0x2);_0x16f79b['push'](_0x35f4c9);_0x5824af+=_0x5bf58d*0x2;}return _0x16f79b;}function getBleMac(_0x58837a){let _0x3d4096=Array['prototype'][_0x3330('0xf')][_0x3330('0xc')](new Uint8Array(_0x58837a[_0x3330('0x2')]),_0x3f2b9b=>('00'+_0x3f2b9b['toString'](0x10))[_0x3330('0x8')](-0x2))['join']('');let _0x26527f=_0x3d4096['slice'](0x4);return _0x26527f;}module[_0x3330('0x4')]={'numberToHexString':numberToHexString,'buf2hex':buf2hex,'hex2buf':hex2buf,'hexToStr':hexToStr,'hexStringToBufferArray':hexStringToBufferArray,'bufferArrayToHexString':bufferArrayToHexString,'makeTLV':makeTLV,'makeTLVWithCondition':makeTLVWithCondition,'resolveTLV':resolveTLV,'getBleMac':getBleMac}; |
const _0x3950=['forceDisconnectBleDev','postCommand','getBleDeviceInfo','已断开','透传通道参数错误','onScanResult','exports','DISCONNECT_OK','msg','ETC','BleStatusResult','disconnectBle','data','startScanBleDevice','connectBleDev','code','DISCONNECT_FAIL','执行成功'];const _0x39ed=function(_0x3950c8,_0x39eda8){_0x3950c8=_0x3950c8-0x0;let _0x1bb899=_0x3950[_0x3950c8];return _0x1bb899;};import _0x1ba307,{handshake}from'./ArtcBleUtil';import{ArtcBleStatusCodes,ArtcStatusDescriptions}from'./ReturnStatusCode';function scanBle(_0x245fd2,_0xc82da){_0x1ba307[_0x39ed('0xd')](_0x39ed('0x9'),_0x245fd2,_0x26b59c=>{if(_0x26b59c[_0x39ed('0xf')]===ArtcBleStatusCodes['OK']){_0xc82da[_0x39ed('0x5')](_0x26b59c['data']);}},_0x21cbbe=>{_0xc82da['onIsEnable'](new _0x1ba307['BleStatusResult'](_0x21cbbe[_0x39ed('0xf')],_0x21cbbe[_0x39ed('0x8')]));});}function closBluetooth(_0x4dd7ad){_0x1ba307['stopScanBleDevice'](_0x560813=>{_0x4dd7ad(_0x560813);});}function connectDevice(_0x413b07,_0x2f3547,_0x41bf7f){_0x1ba307[_0x39ed('0xe')](_0x413b07,{'success':_0x4d95c1=>{if(_0x4d95c1['code']===ArtcBleStatusCodes['OK']){_0x2f3547(new _0x1ba307['BleStatusResult'](_0x4d95c1['code'],_0x4d95c1[_0x39ed('0xc')]));_0x41bf7f(new _0x1ba307[(_0x39ed('0xa'))](_0x4d95c1['code'],'已连接'));}else{_0x41bf7f(new _0x1ba307['BleStatusResult'](_0x4d95c1['code'],_0x4d95c1[_0x39ed('0xc')]));}},'fail':_0xb623b8=>{_0x41bf7f(new _0x1ba307['BleStatusResult'](_0xb623b8[_0x39ed('0xf')],_0xb623b8['data']));}});}function disconnectDevice(_0x4f0e5c){_0x1ba307[_0x39ed('0xb')](_0x4b6fe3=>{if(_0x4b6fe3[_0x39ed('0xf')]===ArtcBleStatusCodes[_0x39ed('0x7')]){_0x4f0e5c(new _0x1ba307['BleStatusResult'](_0x4b6fe3['code'],_0x4b6fe3['msg']));}else{_0x4f0e5c(_0x4b6fe3);}});}function transCmd(_0x576528,_0x240f1f,_0x1cd795){let _0x1c0d39=0x1;if(_0x240f1f==='10'){_0x1c0d39=0x0;}else if(_0x240f1f==='20'){_0x1c0d39=0x1;}else{_0x1cd795(new _0x1ba307['BleStatusResult'](ArtcBleStatusCodes['Argument_ERROR'],_0x39ed('0x4')));return;}_0x1ba307[_0x39ed('0x1')](_0x1c0d39,_0x576528,{'success':_0x35259d=>{_0x1cd795(new _0x1ba307['BleStatusResult'](_0x35259d[_0x39ed('0xf')],'执行成功',_0x35259d['data']));},'fail':_0x5a7879=>{_0x1cd795(new _0x1ba307[(_0x39ed('0xa'))](_0x5a7879['code'],_0x5a7879[_0x39ed('0xc')]));}},0xf*0x3e8);}function devCmd(_0x2d97a5,_0x9f7678){if(typeof _0x2d97a5!=='string'&&_0x2d97a5%0x2!==0x0){_0x9f7678(new _0x1ba307[(_0x39ed('0xa'))](ArtcBleStatusCodes['Argument_ERROR'],'指令参数错误'));return;}_0x1ba307[_0x39ed('0x2')](_0x2d97a5,{'success':_0x444ae4=>{_0x9f7678(new _0x1ba307[(_0x39ed('0xa'))](_0x444ae4['code'],_0x39ed('0x11'),_0x444ae4['data']));},'fail':_0x1d9a99=>{_0x9f7678(new _0x1ba307[(_0x39ed('0xa'))](_0x1d9a99[_0x39ed('0xf')],_0x1d9a99['data']));}});}function handshakeETC(_0x655494){_0x1ba307['handshake']({'success':_0x555e5c=>{_0x655494(new _0x1ba307['BleStatusResult'](_0x555e5c[_0x39ed('0xf')],'执行成功',_0x555e5c['data']));},'fail':_0x5481bf=>{_0x655494(new _0x1ba307[(_0x39ed('0xa'))](_0x5481bf['code'],_0x5481bf[_0x39ed('0xc')]));}});}function disconnectDeviceBluetooth(_0xa63955){_0x1ba307['bleConnectionState']({});const _0x5a5c31=setTimeout(()=>{_0xa63955(new _0x1ba307[(_0x39ed('0xa'))](ArtcBleStatusCodes[_0x39ed('0x10')],'断开失败'));},0xc*0x3e8);_0x1ba307[_0x39ed('0x0')](_0x5ab57b=>{if(_0x5ab57b===ArtcBleStatusCodes['DISCONNECT_OK']){clearTimeout(_0x5a5c31);_0xa63955(new _0x1ba307[(_0x39ed('0xa'))](_0x5ab57b,_0x39ed('0x3')));}});}function bleDisconnectStatusListener(_0x554239){_0x1ba307['bleConnectionState'](_0x18e959=>{if(_0x18e959===ArtcBleStatusCodes['DISCONNECT_OK']){_0x554239(new _0x1ba307[(_0x39ed('0xa'))](_0x18e959,'连接断开'));}});}module[_0x39ed('0x6')]={'scanBle':scanBle,'closBluetooth':closBluetooth,'connectDevice':connectDevice,'disconnectDevice':disconnectDevice,'transCmd':transCmd,'disconnectDeviceBluetooth':disconnectDeviceBluetooth,'devCmd':devCmd,'handshakeETC':handshakeETC}; |
const _0x1028=['执行微信蓝牙协议初始化指令','微信包Init失败','设备通道指令响应错误','CTL字段数据异常','BCC校验失败','物理层连接失败','执行微信蓝牙协议确认指令','exports','微信包Auth失败','没有目标特征','蓝牙状态正常','响应数据异常','连接断开','停止蓝牙搜索失败','握手失败','透传通道操作失败','当前蓝牙标签并不是埃特斯厂家','打开蓝牙适配器失败','发送信息超时'];const _0x47bf=function(_0x1028c3,_0x47bf4d){_0x1028c3=_0x1028c3-0x0;let _0x2d17c0=_0x1028[_0x1028c3];return _0x2d17c0;};const ArtcBleStatusCodes={'OK':0x0,'DISCONNECT_OK':0x0,'DISCONNECT_FAIL':0x1,'MakeAuthResponse':0x2,'MakeInitResponse':0x3,'WaitData':0x4,'INIT_API_FAIL':0x3e8,'OPEN_BLE_ADAPTER_FAIL':0x7d1,'PHYSICS_CONNECT_FAIL':0x7d2,'NOT_SERVICE_ID':0x7d3,'NOT_CHARACTERISTICS':0x7d4,'SEND_OVERTIME':0xbb9,'SEND_FAIL':0xbba,'RESPONSE_DATA_PROTOCOL_ERROR':0xbbb,'RESPONSE_DATA_OVER_LENGTH':0xbbc,'WECHAT_PROTOCOL_AUTH_FAIL':0xbbd,'WECHAT_PROTOCOL_INIT_FAIL':0xbbe,'RESPONSE_DATA_STRUCTURE_EXCEPTION':0xbbf,'RESPONSE_DATA_PROTOBUF_EXCEPTION':0xbc0,'RESPONSE_DATA_CTL_EXCEPTION':0xbc1,'RESPONSE_DATA_BCC_CHECKOUT_FAIL':0xbc2,'DEV_IS_NOT_ARTC':0xfa1,'DEV_COMMAND_RESPONSE_DATA_ERROR':0xfa2,'HANDSHAKE_FAIL':0xfa3,'POST_COMMAND_FAIL':0xfa4,'RESET_ESAM_FAIL':0xfa5,'BLE_STATUS_OK':0x0,'BLE_STATUS_OPEN_Adapter_FAIL':0x1,'BLE_STATUS_DevicesDiscovery_FAIL':0x2,'BLE_STATUS_CLOSE_Adapter_FAIL':0x3,'BLE_SCAN_STOP_OK':0x0,'BLE_SCAN_STOP_FAIL':0x1,'Argument_ERROR':0x1389};const ArtcStatusDescriptions={'OK':'成功','DISCONNECT':_0x47bf('0xc'),'MakeAuthResponse':_0x47bf('0x6'),'MakeInitResponse':_0x47bf('0x0'),'WaitData':'等待数据接收','INIT_API_FAIL':'初始化SDK失败','OPEN_BLE_ADAPTER_FAIL':_0x47bf('0x11'),'PHYSICS_CONNECT_FAIL':_0x47bf('0x5'),'NOT_SERVICE_ID':'没有目标服务','NOT_CHARACTERISTICS':_0x47bf('0x9'),'SEND_OVERTIME':_0x47bf('0x12'),'SEND_FAIL':'发送信息失败','RESPONSE_DATA_PROTOCOL_ERROR':'响应数据出错','RESPONSE_DATA_OVER_LENGTH':'响应数据超长','WECHAT_PROTOCOL_AUTH_FAIL':_0x47bf('0x8'),'WECHAT_PROTOCOL_INIT_FAIL':_0x47bf('0x1'),'RESPONSE_DATA_STRUCTURE_EXCEPTION':_0x47bf('0xb'),'RESPONSE_DATA_PROTOBUF_EXCEPTION':'protobuf数据协议长度异常','RESPONSE_DATA_CTL_EXCEPTION':_0x47bf('0x3'),'RESPONSE_DATA_BCC_CHECKOUT_FAIL':_0x47bf('0x4'),'DEV_IS_NOT_ARTC':_0x47bf('0x10'),'DEV_COMMAND_RESPONSE_DATA_ERROR':_0x47bf('0x2'),'HANDSHAKE_FAIL':_0x47bf('0xe'),'POST_COMMAND_FAIL':_0x47bf('0xf'),'RESET_ESAM_FAIL':'复位ESAM失败','BLE_STATUS_OK':_0x47bf('0xa'),'BLE_STATUS_OPEN_Adapter_FAIL':_0x47bf('0x11'),'BLE_STATUS_DevicesDiscovery_FAIL':'开启蓝牙搜索失败','BLE_SCAN_STOP_OK':'蓝牙搜索已停止','BLE_SCAN_STOP_FAIL':_0x47bf('0xd')};module[_0x47bf('0x7')]={'ArtcBleStatusCodes':ArtcBleStatusCodes,'ArtcStatusDescriptions':ArtcStatusDescriptions}; |
const jlQZApi = require("../etc/JLQZAPI/JLObuSDK.js"); | const jlQZApi = require("../etc/JLQZAPI/JLObuSDK.js"); | ||||
let kcApi = require("../etc/kcBle/kcBleAPI.js"); | let kcApi = require("../etc/kcBle/kcBleAPI.js"); | ||||
// let jyApiEtc = require("../etc/JYAPI-ETC/jy-bluetooth-obu-wechatmp.js"); //前装-金溢 | // let jyApiEtc = require("../etc/JYAPI-ETC/jy-bluetooth-obu-wechatmp.js"); //前装-金溢 | ||||
let ArtcBleUtilApi = require("../etc/ArtcBleAPI/ArtcGuiZhouAPI.js");//艾特斯 ETC- 5201 国密 | |||||
import { | import { | ||||
login | login | ||||
} from "../../utils/network/api"; | } from "../../utils/network/api"; | ||||
console.log('断开蓝牙connectPrefixName', getItem('environment'), tdApi, datas.getData("connectPrefixName")) | console.log('断开蓝牙connectPrefixName', getItem('environment'), tdApi, datas.getData("connectPrefixName")) | ||||
switch (connectPrefixName) { | switch (connectPrefixName) { | ||||
case "ETC": | case "ETC": | ||||
let obj = "" | |||||
if (datas.getData("deviceName").includes("KC") || datas.getData("deviceName").includes("K")) { | if (datas.getData("deviceName").includes("KC") || datas.getData("deviceName").includes("K")) { | ||||
kcApi.disconnectDevice(function(res) { | |||||
datas.setData("bluLinkStatus", false); | |||||
datas.setData("connectPrefixName", ""); | |||||
}); | |||||
obj=kcApi | |||||
} else if (datas.getData("deviceName").includes("JL")) { | } else if (datas.getData("deviceName").includes("JL")) { | ||||
jlQZApi.disconnectDevice(function(res) { | |||||
datas.setData("bluLinkStatus", false); | |||||
datas.setData("connectPrefixName", ""); | |||||
}); | |||||
obj=jlQZApi | |||||
} else if (datas.getData("deviceName").includes("WJ")) { | } else if (datas.getData("deviceName").includes("WJ")) { | ||||
wjApi9901.disconnectDevice(function(res) { | |||||
datas.setData("bluLinkStatus", false); | |||||
datas.setData("connectPrefixName", ""); | |||||
}); | |||||
obj=wjApi9901 | |||||
} else if (datas.getData("deviceName").includes("ATS")) { | |||||
obj=ArtcBleUtilApi | |||||
} | } | ||||
obj.disconnectDevice(function(res) { | |||||
datas.setData("bluLinkStatus", false); | |||||
datas.setData("connectPrefixName", ""); | |||||
}); | |||||
// else if (datas.getData("deviceName").includes("JY")) { | // else if (datas.getData("deviceName").includes("JY")) { | ||||
// jyApiEtc.disconnectDevice(function(res) { | // jyApiEtc.disconnectDevice(function(res) { | ||||
// datas.setData("bluLinkStatus", false); | // datas.setData("bluLinkStatus", false); | ||||
// datas.setData("connectPrefixName", ""); | // datas.setData("connectPrefixName", ""); | ||||
// }); | // }); | ||||
// } | // } | ||||
break; | break; | ||||
case "WJ": | case "WJ": | ||||
wjApi.disconnectDevice(function(res) { | wjApi.disconnectDevice(function(res) { | ||||
case "ETC": | case "ETC": | ||||
//-------------deviceName前装-科畅 | //-------------deviceName前装-科畅 | ||||
console.log("datas.-----",datas.getData("deviceName"),datas.getData("deviceName").includes("KC"),datas.getData("deviceName").includes("K")) | console.log("datas.-----",datas.getData("deviceName"),datas.getData("deviceName").includes("KC"),datas.getData("deviceName").includes("K")) | ||||
let obj = "" | |||||
if (datas.getData("deviceName").includes("KC")|| datas.getData("deviceName").includes("K")) { | if (datas.getData("deviceName").includes("KC")|| datas.getData("deviceName").includes("K")) { | ||||
console.log('kc执行内容====', cmdArr, type) | console.log('kc执行内容====', cmdArr, type) | ||||
kcApi.transCmd(cmdArr, type, function(res) { | |||||
console.log('kc执行内容====11111', res) | |||||
if (res.code == 0) { | |||||
func(res.data); | |||||
} else { | |||||
if (callBack != null) { | |||||
callBack(res.msg); | |||||
} else { | |||||
alertF(res.msg); | |||||
} | |||||
} | |||||
}); | |||||
obj=kcApi | |||||
} else if (datas.getData("deviceName").includes("JL")) { | } else if (datas.getData("deviceName").includes("JL")) { | ||||
jlQZApi.transCmd(cmdArr, type, function(res) { | |||||
if (res.code == 0) { | |||||
func(res.data); | |||||
} else { | |||||
if (callBack != null) { | |||||
callBack(res.msg); | |||||
} else { | |||||
alertF(res.msg); | |||||
} | |||||
} | |||||
}); | |||||
obj=jlQZApi | |||||
} else if (datas.getData("deviceName").includes("WJ")) { | } else if (datas.getData("deviceName").includes("WJ")) { | ||||
wjApi9901.transCmd(cmdArr, type, function(res) { | |||||
console.log('WJ执行内容====11111', res) | |||||
if (res.code == 0) { | |||||
func(res.data); | |||||
obj=wjApi9901 | |||||
} else if (datas.getData("deviceName").includes("ATS")) { | |||||
obj=ArtcBleUtilApi | |||||
} | |||||
obj.transCmd(cmdArr, type, function(res) { | |||||
console.log(datas.getData("deviceName")+'执行内容====11111', res) | |||||
if (res.code == 0) { | |||||
func(res.data); | |||||
} else { | |||||
if (callBack != null) { | |||||
callBack(res.msg); | |||||
} else { | } else { | ||||
if (callBack != null) { | |||||
callBack(res.msg); | |||||
} else { | |||||
alertF(res.msg); | |||||
} | |||||
alertF(res.msg); | |||||
} | } | ||||
}); | |||||
} | |||||
} | |||||
}); | |||||
// else if (datas.getData("deviceName").includes("JY")) { | // else if (datas.getData("deviceName").includes("JY")) { | ||||
// jyApiEtc.transCmd(cmdArr, type, function(res) { | // jyApiEtc.transCmd(cmdArr, type, function(res) { | ||||
// console.log('JY执行内容====11111', res) | // console.log('JY执行内容====11111', res) |
} from "@/utils/network/request.js"; | } from "@/utils/network/request.js"; | ||||
import { | import { | ||||
IntegerToHexString, | IntegerToHexString, | ||||
AsciToHexString, | |||||
} from "@/utils/util/fileData.js"; | } from "@/utils/util/fileData.js"; | ||||
import { | import { | ||||
stringToJson | stringToJson |
} from "@/utils/network/request.js"; | } from "@/utils/network/request.js"; | ||||
import { | import { | ||||
IntegerToHexString, | IntegerToHexString, | ||||
AsciToHexString, | |||||
} from "@/utils/util/fileData.js"; | } from "@/utils/util/fileData.js"; | ||||
import { | import { | ||||
stringToJson | stringToJson |
} from "@/subpackage/after-sale/js/publicRequest"; | } from "@/subpackage/after-sale/js/publicRequest"; | ||||
const cmd = require("../../../static/etcUtil/cmdConfig.js"); | const cmd = require("../../../static/etcUtil/cmdConfig.js"); | ||||
import { | import { | ||||
IntegerToHexString, | |||||
AsciToHexString, | |||||
IntegerToHexString | |||||
} from "@/utils/util/fileData.js"; | } from "@/utils/util/fileData.js"; | ||||
import { | import { |
if (str2 == "9000") { | if (str2 == "9000") { | ||||
if (res[1].length > 108) { | if (res[1].length > 108) { | ||||
console.log("res====",res) | console.log("res====",res) | ||||
console.log("进来了",res[1].substring(4, 44),HexToStrig(res[1].substring(4, 44))) | |||||
card.userName = HexToStrig(res[1].substring(4, 44)); //姓名 | card.userName = HexToStrig(res[1].substring(4, 44)); //姓名 | ||||
card.userName = card.userName[0] + '*'.repeat(card.userName.length - 1) | card.userName = card.userName[0] + '*'.repeat(card.userName.length - 1) | ||||
card.idNum = HexToStrig(res[1].substring(44, 108)).replace(/^\d{14}/, | card.idNum = HexToStrig(res[1].substring(44, 108)).replace(/^\d{14}/, |
} from "@/datas/queryKey.js"; | } from "@/datas/queryKey.js"; | ||||
import { | import { | ||||
IntegerToHexString, | IntegerToHexString, | ||||
AsciToHexString, | |||||
} from "@/utils/util/fileData.js"; | } from "@/utils/util/fileData.js"; | ||||
import { | import { | ||||
stringToJson | stringToJson |
} | } | ||||
return str; | return str; | ||||
} | } | ||||
export function AsciToHexString(strAsci, nLen) { | |||||
let s = String(strAsci); | |||||
let encoder = new TextEncoder("UTF-8"); | |||||
// let encoder = new TextEncoder("gbk"); | |||||
// let bytes = encode(str, 'gbk'); | |||||
let bytes = encoder.encode(s); | |||||
let strResult = HexToString(bytes); | |||||
let strLen = strResult.length; | |||||
if (strLen >= nLen) { | |||||
strResult = strResult.substring(0, nLen); | |||||
} else { | |||||
let nAddLen = nLen - strLen; | |||||
for (let i = 0; i < nAddLen; i++) { | |||||
strResult += "0"; | |||||
} | |||||
} | |||||
return strResult; | |||||
} | |||||
// export function AsciToHexString(strAsci, nLen) { | |||||
// let s = String(strAsci); | |||||
// let encoder = new TextEncoder("UTF-8"); | |||||
// let bytes = encoder.encode(s); | |||||
// let strResult = HexToString(bytes); | |||||
// let strLen = strResult.length; | |||||
// if (strLen >= nLen) { | |||||
// strResult = strResult.substring(0, nLen); | |||||
// } else { | |||||
// let nAddLen = nLen - strLen; | |||||
// for (let i = 0; i < nAddLen; i++) { | |||||
// strResult += "0"; | |||||
// } | |||||
// } | |||||
// return strResult; | |||||
// } | |||||
const DIGITS_UPPER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', | const DIGITS_UPPER = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', | ||||
'E', 'F' | 'E', 'F' |