noble / bleno

A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals
MIT License
2.12k stars 447 forks source link

Stop advertising after idle ? #406

Open WebberLai opened 6 years ago

WebberLai commented 6 years ago

Hi , I got an issue , I don't know why the ubuntu stop advertising after idle ? I run the script at the ubuntu startup , than I can see the device is advertising but if I check again after a 24hrs , I can't scan any device System still alive , not dead . Do I missing anything to set ???

This is the code I use to advertising

bleno.on('stateChange', function(state) {
  console.log('on -> stateChange: ' + state);

  if (state === 'poweredOn') {
    bleno.startAdvertising('my_service', [myService.uuid]);
  } else {
    bleno.stopAdvertising();
  }
});