/**
* @name: ibeacon工具扫描类
* @author: XXXX
* @time: 2019年03月24日
*/
var majorArray = new Array();
//打开ibeacon
function startDiscovery() {
//扫描指定UUID的iBeacon设备
plus.ibeacon.startBeaconDiscovery({
uuids: ["fda50693-a4e2-4fb1-afcf-c6eb07647825"]
});
plus.ibeacon.onBeaconUpdate(function(result) {
majorArray = new Array();
if(result.beacons && result.beacons.length > 0) {
var beacons = result.beacons;
for(var i in beacons) {
majorArray.push(beacons[i].major);
}
}
});
}
//关闭ibeacon
function stopDiscovery() {
plus.ibeacon.stopBeaconDiscovery({});
}