我有一个测试应用程序,它有两个按钮,一个是启动 Wifi 跟踪,一个是停止。当我开始 Wifi 跟踪时,如果范围内有接入点并且不会触发进入事件,所以我不知道自己在围栏中。有没有办法在跟踪开始时通知我我在围栏内?
function startWifiTracking() {
//create the geofences and triggers
var triggers = {
Wifi : {
fc_entry : { type : 'Enter',
areaAccessPoints : [{SSID: 'test', MAC: '12:12:12:12:12:12'}],
callback : entry1,
otherAccessPointsAllowed : true},
fc_exit : { type : 'Exit',
areaAccessPoints : [{SSID: 'test', MAC: '12:12:12:12:12:12'}],
callback : exited1,
otherAccessPointsAllowed : true}
}};
//create the wifi policy for the wifi access points to be monitored
var policy = {
Wifi : {
interval : 3000,
signalStrengthThreshold : 15,
accessPointFilters : [{SSID: 'test', MAC: '*'}]
}};
WL.Device.startAcquisition(policy, triggers, acquisitionFailure);
}
//trigger callbacks for each wifi fence
function entry1() { alert('entered'); }
function exited1() { alert('exited'); }
function acquisitionFailure() {alert('failed');}
$(function() {
$('#btnStart').click( function(){
startWifiTracking();
});
});
$(function() {
$('#btnStop').click( function(){
WL.Device.stopAcquisition();
});
});