浏览代码

2023年9月24日12:50:02

yxb
wq 1年前
父节点
当前提交
7a71a38be9

+ 662
- 666
components/bluetooth/bluetooth.vue
文件差异内容过多而无法显示
查看文件


+ 7
- 1
pages/bluetooth/bluetooth.vue 查看文件

const selectedUrl = "common/selected.png`"; const selectedUrl = "common/selected.png`";
const unSelectedUrl = "common/unselected.png`"; const unSelectedUrl = "common/unselected.png`";
const wjApi = require("../../static/etc/WJAPI/wjBleAPI"); const wjApi = require("../../static/etc/WJAPI/wjBleAPI");
const jlApi = require("../../static/etc/JLAPI/JLObuSDK.js");
const jyApi = require("../../static/etc/JYAPI/GenvictBleUtil.js"); const jyApi = require("../../static/etc/JYAPI/GenvictBleUtil.js");
const jlQZApi = require("../../static/etc/JLQZAPI/JLObuSDK.js"); const jlQZApi = require("../../static/etc/JLQZAPI/JLObuSDK.js");
const atApi = require("../../static/etc/ATAPI/ArtcBleUtil.js"); const atApi = require("../../static/etc/ATAPI/ArtcBleUtil.js");
const tools = require("../../static/etcUtil/tools.js"); const tools = require("../../static/etcUtil/tools.js");
const datas = require("../../static/etcUtil/datas.js"); const datas = require("../../static/etcUtil/datas.js");
const bluetoothUtil = require("../../static/etcUtil/index.js"); const bluetoothUtil = require("../../static/etcUtil/index.js");
let jlApi = require("../../static/etc/JLAPI/JLObuSDK.js"); //聚力SDK
// #ifdef MP-ALIPAY
// 这部分代码将仅在支付宝小程序平台下执行
jlApi = require("../../static/etc/JLObuSDK/JLObuSDK.js");
// 执行支付宝小程序的特定功能
// #endif



const state = reactive({ const state = reactive({
fee: "", fee: "",

+ 1
- 0
static/etc/JLObuSDK/JLAlipayBleManager.js
文件差异内容过多而无法显示
查看文件


+ 1
- 0
static/etc/JLObuSDK/JLConfig.js 查看文件

var appVersion="1.0.0";export var area_config={protocol_version:1310,};export function ICCResetCmd(){switch(area_config.protocol_version){case 1310:return'A2';break;case 1320:return'A2';break;case 1312:return'A2';break;case 1330:return"A801";break}}export function ICCChannelCmd(){switch(area_config.protocol_version){case 1310:return'A3';break;case 1320:return'A3';break;case 1312:return'A3';break;case 1330:return"A3";break}}export function ESAMResetCmd(){switch(area_config.protocol_version){case 1310:return'AA';break;case 1320:return'A8';break;case 1312:return'A2';break;case 1330:return"A803";break}}export function ESAMChannelCmd(){switch(area_config.protocol_version){case 1310:return'AC';break;case 1320:return'A4';break;case 1312:return'A8';break;case 1330:return"A7";break}}export function ObuAuthCmd(){switch(area_config.protocol_version){case 1310:return'FF';break;case 1320:return'A9';break;case 1312:return'FF';break}}export function deviceInfo(){switch(area_config.protocol_version){case 1310:return'FF';break;case 1320:return'AA';break;case 1312:return'FF';break}}export function NewPipe(){switch(area_config.protocol_version){case 1310:return'FF';break;case 1320:return'AD';break;case 1312:return'FF';break}}export function ActState(){switch(area_config.protocol_version){case 1310:return'FF';break;case 1320:return'AC';break;case 1312:return'FF';break}}export function checkPower(){switch(area_config.protocol_version){case 1330:return'A5';break}}export function ResetFlag(){return'JLReset'}export function ChannelFlag(){return'JLChannel'}export function Auth(){return'JLAuth'}export function ActStateFlag(){return'JLActState'}export function NewPipFlag(){return'JLNewPip'}export function DeviceInfo(){return'JLDeviceInfo'}export function successCode(){return 0}export function errorCode(){return 10020}export function timeOutCode(){return 10102}export function cardNoExists(){return 10103}export function bleSuccessCode(){return 0}export function bleErrorCode(){return 10101}export function bleAvailableCode(){return 10104}export function cosErrorCode(){return 100100}export var message={api:'',status:'',sendCmd:[],reciveCmd:[]};export function DevResult(type,objc){var code='';var err_msg='';var res=null;var msg='';if(objc.code==successCode()){err_msg='执行成功';message.reciveCmd.push(objc.data);switch(type){case 0:{var data=objc.data;var sw=data.substr(data.length-4,4);if(sw=='9000'){message.status='00';code=successCode();data=objc.data.substr(0,data.length-4);err_msg='操作成功';msg=''}else{message.status='01';code=cosErrorCode();data=null;err_msg='COS指令错误';msg=sw}}break;case 1:{message.status='00';code=objc.code;err_msg=objc.msg;data=objc.data.substr(4,objc.data.length-4);msg=crsateMessage()}break;case 2:{message.status='00';console.log('判断obuInfo:'+objc.data);code=objc.code;err_msg=objc.msg;data=objc.data.substr(6,objc.data.length-6);msg=crsateMessage()}break;case 3:{message.status='00';console.log('认证数据:'+objc.data);code=objc.code;err_msg=objc.msg;data=objc.data.substr(8,2);msg=crsateMessage()}break;default:break}return{code:code,err_msg:err_msg,data:data,msg:crsateMessage()}}else{message.status='01';return{code:objc.code,err_msg:objc.msg,data:null,msg:crsateMessage()}}}function crsateMessage(){var messageInfo=message.api+"|"+message.sendCmd+"|"+message.status+"|"+message.reciveCmd;return messageInfo}

+ 1
- 0
static/etc/JLObuSDK/JLDeviceWechat+33Protocol.js
文件差异内容过多而无法显示
查看文件


+ 124
- 0
static/etc/JLObuSDK/JLObuSDK.js 查看文件

var JLSDK = require('./JLDeviceWechat+33Protocol.js');
var Analysis = require('./JLObuWecha33UnPackt.js');
var config = require('./JLConfig.js');
var TAG = " JLObuSdk ";
/**
* 扫描设备
* @param {需要查询的设备名称或部分名称} nameFlag
* @param {*} callBack
*/
export function ScanDevice(nameFlag, timeOut, callBack) {
JLSDK.scanDevice(nameFlag, timeOut,
(res) => {
callBack.call(this, res);
}
)
}
/**
* 停止扫描
* @param {回调} callBack
*/
export function StopScanDevice(callBack) {

JLSDK.stopScanDevice(
(res) => {
callBack.call(this, res);
}
);

}



/**
* 连接设备
* @param {设备对象} device
* @param {回调} callBack
*/
export function connectDevice(device, callBack) {
JLSDK.connectDevice(device,
(res) => {
callBack.call(this, res);
})
}



/**
* 断开连接
* @param {回调} callBack
*/
export function disconnectDevice(callBack) {

JLSDK.disConnectDevice((res) => {
callBack.call(this, res);
})

}






/**
* ESAM复位
* @param {回调方法} callBack
*/
export function ESAMReset(callBack) {

JLSDK.ESAMRset((res) => {
callBack.call(this, res);
})
}
/**
* ESAM通道透传
* @param {透传数据} data
* @param {回调方法} callBack
*/
export function ESAMChannel(data, callBack) {

JLSDK.ESAMChannel(data, (res) => {
callBack.call(this, res);
})
}

/**
* ESAM通道透传(数组)
* @param {cos指令数组} cmdArray
* @param {结果回掉} callBack
*/
export function ESAMChannelArray(cmdArray,callBack){
JLSDK.ESAMChannel_CmdArray(cmdArray,callBack);
}


/**
* ICC复位
* @param {回调方法} callBack
*/
export function ICCReset(callBack) {

JLSDK.ICCReset((res) => {
callBack.call(this, res);
})
}



/**
* ICC通道透传
* @param {透传数据} data
* @param {回调方法} callBack
*/
export function ICCChannel(data, callBack) {

JLSDK.ICCChannel(data, (res) => {
callBack.call(this, res);
})
}
export function ICCChannelArray(cmdArray,callBack){
JLSDK.ICCChannel_CmdArray(cmdArray,callBack);
}



+ 1
- 0
static/etc/JLObuSDK/JLObuWecha33UnPackt.js
文件差异内容过多而无法显示
查看文件


+ 1
- 0
static/etc/JLObuSDK/JLObuWechat33Pack.js
文件差异内容过多而无法显示
查看文件


+ 1
- 0
static/etc/JLObuSDK/dataTool.js 查看文件

function strToHexCharCode(str){if(str==="")return"";var hexCharCode=[];for(var i=0;i<str.length;i++){hexCharCode.push((str.charCodeAt(i)).toString(16))}return hexCharCode.join("").toUpperCase()}function bccCheck(data){var bcc='';for(var a=0;a<data.length/2;a++){bcc^=parseInt(data.substring(2*a,2*a+2),16)}if(bcc.length==1){bcc='0'+bcc}return tenToHex(bcc,2).toUpperCase()}function tenToHex(num,len,boo){var hex=num.toString(16);var zero='';for(var a=0;a<len-hex.length;a++){zero+='0'}var ret='';if(boo){if(hex.length%2==0){}else{hex='0'+hex;zero=zero.substring(1)}ret=hex+zero}else if(!boo){ret=zero+hex}return ret.toUpperCase()}function hexToString(str){var trimedStr=str.trim();var rawStr=trimedStr.substr(0,2).toLowerCase()==="0x"?trimedStr.substr(2):trimedStr;var len=rawStr.length;if(len%2!==0){alert("Illegal Format ASCII Code!");return""}var curCharCode;var resultStr=[];for(var i=0;i<len;i=i+2){curCharCode=parseInt(rawStr.substr(i,2),16);resultStr.push(String.fromCharCode(curCharCode))}return resultStr.join("").toUpperCase()}function encodeUtf8(text){const code=encodeURIComponent(text);const bytes=[];for(var i=0;i<code.length;i++){const c=code.charAt(i);if(c==='%'){const hex=code.charAt(i+1)+code.charAt(i+2);const hexVal=parseInt(hex,16);bytes.push(hexVal);i+=2}else bytes.push(c.charCodeAt(0))}return bytes}function hexToTen(sixteen){var ten=parseInt(sixteen,16);return ten}function str2utf8(str){var code;var utf="";for(var i=0;i<str.length;i++){code=str.charCodeAt(i);if(code<0x0080){utf+=str.charAt(i)}else if(code<0x0800){utf+=String.fromCharCode(0xC0|((code>>6)&0x1F));utf+=String.fromCharCode(0x80|((code>>0)&0x3F))}else if(code<0x10000){utf+=String.fromCharCode(0xE0|((code>>12)&0x0F));utf+=String.fromCharCode(0x80|((code>>6)&0x3F));utf+=String.fromCharCode(0x80|((code>>0)&0x3F))}else{throw"不是UCS-2字符集";}}return utf}function hexTobin(str){str=str.toUpperCase();let hex_array=[{key:0,val:"0000"},{key:1,val:"0001"},{key:2,val:"0010"},{key:3,val:"0011"},{key:4,val:"0100"},{key:5,val:"0101"},{key:6,val:"0110"},{key:7,val:"0111"},{key:8,val:"1000"},{key:9,val:"1001"},{key:'A',val:"1010"},{key:'B',val:"1011"},{key:'C',val:"1100"},{key:'D',val:"1101"},{key:'E',val:"1110"},{key:'F',val:"1111"}];let value="";for(let i=0;i<str.length;i++){for(let j=0;j<hex_array.length;j++){if(str.charAt(i)==hex_array[j].key){value=value.concat(hex_array[j].val);break}}}return value}function binTohex(str){let hex_array=[{key:0,val:"0000"},{key:1,val:"0001"},{key:2,val:"0010"},{key:3,val:"0011"},{key:4,val:"0100"},{key:5,val:"0101"},{key:6,val:"0110"},{key:7,val:"0111"},{key:8,val:"1000"},{key:9,val:"1001"},{key:'a',val:"1010"},{key:'b',val:"1011"},{key:'c',val:"1100"},{key:'d',val:"1101"},{key:'e',val:"1110"},{key:'f',val:"1111"}];let value='';let list=[];if(str.length%4!==0){let a="0000";let b=a.substring(0,4-str.length%4);str=b.concat(str)}while(str.length>4){list.push(str.substring(0,4));str=str.substring(4)}list.push(str);for(let i=0;i<list.length;i++){for(let j=0;j<hex_array.length;j++){if(list[i]==hex_array[j].val){value=value.concat(hex_array[j].key);break}}}return value}function strToBuffer(cmd){let buffer=new ArrayBuffer(cmd.length/2);let dataView=new Uint8Array(buffer);for(var a=0;a<cmd.length/2;a++){dataView[a]='0x'+cmd.substring(2*a,2*a+2)}return buffer}function bufferTohex(buffer){var hexArr=Array.prototype.map.call(new Uint8Array(buffer),function(bit){return('00'+bit.toString(16)).slice(-2)});return hexArr.join('')}function isEmpty(data){if(data.length==0||data==null||data=='undefined'){return true}return false}module.exports={encodeUtf8:encodeUtf8,tenToHex:tenToHex,hexToTen:hexToTen,bccCheck:bccCheck,hexToString:hexToString,strToHexCharCode:strToHexCharCode,str2utf8:str2utf8,hexTobin:hexTobin,binTohex:binTohex,isEmpty:isEmpty,strToBuffer:strToBuffer,bufferTohex:bufferTohex}

+ 1
- 0
static/etc/JLObuSDK/onfire.js 查看文件

!function(root,factory){if(typeof module==='object'&&module.exports)module.exports=factory();else root.onfire=factory()}(typeof window!=='undefined'?window:this,function(){var __onfireEvents={},__cnt=0,string_str='string',function_str='function',hasOwnKey=Function.call.bind(Object.hasOwnProperty),slice=Function.call.bind(Array.prototype.slice);function _bind(eventName,callback,is_one,context){if(typeof eventName!==string_str||typeof callback!==function_str){throw new Error('args: '+string_str+', '+function_str+'');}if(!hasOwnKey(__onfireEvents,eventName)){__onfireEvents[eventName]={}}__onfireEvents[eventName][++__cnt]=[callback,is_one,context];return[eventName,__cnt]}function _each(obj,callback){for(var key in obj){if(hasOwnKey(obj,key))callback(key,obj[key])}}function on(eventName,callback,context){return _bind(eventName,callback,0,context)}function one(eventName,callback,context){return _bind(eventName,callback,1,context)}function _fire_func(eventName,args){if(hasOwnKey(__onfireEvents,eventName)){_each(__onfireEvents[eventName],function(key,item){item[0].apply(item[2],args);if(item[1])delete __onfireEvents[eventName][key]})}}function fire(eventName){var args=slice(arguments,1);setTimeout(function(){_fire_func(eventName,args)})}function fireSync(eventName){_fire_func(eventName,slice(arguments,1))}function un(event){var eventName,key,r=false,type=typeof event;if(type===string_str){if(hasOwnKey(__onfireEvents,event)){delete __onfireEvents[event];return true}return false}else if(type==='object'){eventName=event[0];key=event[1];if(hasOwnKey(__onfireEvents,eventName)&&hasOwnKey(__onfireEvents[eventName],key)){delete __onfireEvents[eventName][key];return true}return false}else if(type===function_str){_each(__onfireEvents,function(key_1,item_1){_each(item_1,function(key_2,item_2){if(item_2[0]===event){delete __onfireEvents[key_1][key_2];r=true}})});return r}return true}function clear(){__onfireEvents={}}return{on:on,one:one,un:un,fire:fire,fireSync:fireSync,clear:clear}});

正在加载...
取消
保存