ble.scan()frow网络工作者

问题描述:

你能帮助我吗?如何从Web Workers开始使用蓝牙(cordova-ble-central)?ble.scan()frow网络工作者

ble.scan([],5,function(device){postMessage(device.name)},function(error){});

我希望这对你的作品....

var devices=[]; 
     ble.startScan([], 
      function(peripheral) 
      { 
       devices.push(peripheral); 
      }, 
      function(error) 
      { 
       console.log(error); 
      }); 

     setTimeout(ble.stopScan, 1500, 
      function() 
      {      
       console.log("scan stopped.) 
      }, 
      function() 
      { 
       console.log("stopScan failed"); 
      }