Pārlūkot izejas kodu

2023年9月24日15:20:54

yxb
wq pirms 1 gada
vecāks
revīzija
21eda26138

+ 644
- 1
static/etc/JLObuSDK/JLAlipayBleManager.js
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 46
- 45
static/etc/JLObuSDK/JLObuSDK.js Parādīt failu

@@ -8,11 +8,11 @@ var TAG = " JLObuSdk ";
* @param {*} callBack
*/
export function ScanDevice(nameFlag, timeOut, callBack) {
JLSDK.scanDevice(nameFlag, timeOut,
(res) => {
callBack.call(this, res);
}
)
JLSDK.scanDevice(nameFlag, timeOut,
(res) => {
callBack.call(this, res);
}
)
}
/**
* 停止扫描
@@ -20,11 +20,11 @@ export function ScanDevice(nameFlag, timeOut, callBack) {
*/
export function StopScanDevice(callBack) {

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

}

@@ -36,10 +36,10 @@ export function StopScanDevice(callBack) {
* @param {回调} callBack
*/
export function connectDevice(device, callBack) {
JLSDK.connectDevice(device,
(res) => {
callBack.call(this, res);
})
JLSDK.connectDevice(device,
(res) => {
callBack.call(this, res);
})
}


@@ -50,9 +50,9 @@ export function connectDevice(device, callBack) {
*/
export function disconnectDevice(callBack) {

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

}

@@ -67,9 +67,9 @@ export function disconnectDevice(callBack) {
*/
export function ESAMReset(callBack) {

JLSDK.ESAMRset((res) => {
callBack.call(this, res);
})
JLSDK.ESAMRset((res) => {
callBack.call(this, res);
})
}
/**
* ESAM通道透传
@@ -78,9 +78,9 @@ export function ESAMReset(callBack) {
*/
export function ESAMChannel(data, callBack) {

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

/**
@@ -88,8 +88,8 @@ export function ESAMChannel(data, callBack) {
* @param {cos指令数组} cmdArray
* @param {结果回掉} callBack
*/
export function ESAMChannelArray(cmdArray,callBack){
JLSDK.ESAMChannel_CmdArray(cmdArray,callBack);
export function ESAMChannelArray(cmdArray, callBack) {
JLSDK.ESAMChannel_CmdArray(cmdArray, callBack);
}


@@ -99,9 +99,9 @@ export function ESAMChannelArray(cmdArray,callBack){
*/
export function ICCReset(callBack) {

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


@@ -113,24 +113,25 @@ export function ICCReset(callBack) {
*/
export function ICCChannel(data, callBack) {

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

export function transCmd(cmdArray, cmdtype, callback) {
if (cmdtype == '10') {
JLSDK.ICCChannel_CmdArray(cmdArray, (res) => {
callback.call(this, res);
})
}
if (cmdtype == '20') {
JLSDK.ESAMChannel_CmdArray(cmdArray, (res) => {
callback.call(this, res);
})
}
}

if (cmdtype == '10') {
JLSDK.ICCChannel_CmdArray(cmdArray, (res) => {
console.log('卡:', res)
callback.call(this, res);
})
}
if (cmdtype == '20') {
JLSDK.ESAMChannel_CmdArray(cmdArray, (res) => {
console.log('OBU:', res)
callback.call(this, res);
})
}
}

+ 99
- 1
static/etc/JLObuSDK/onfire.js Parādīt failu

@@ -1 +1,99 @@
!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}});
! 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
}
});

Notiek ielāde…
Atcelt
Saglabāt