I am referring the above link to scan devices with service-1800 only.I am passing the service uuid-1800 .But the function does not return any error nor any device.And if I am specifying an empty array ,I am getting list of devices.Since i dont want all the devices to occur I am passing the service 1800 to filter only this device.
I am using ble plugin central by ionic framework.
Ble.startscanwithoptions([SERVICE],reportDuplicates:false,) return nothing.
export const SERVICE="1800";
scan()
{
this.ble.startScanWithOptions([SERVICE],{reportDuplicates:false}).subscribe(
device=>this.onDeviceDiscovered(device),
error=>this.scanError(error));
setTimeout(this.setStatus.bind(this,10000,'Scan complete')
}
onDeviceDiscovered(device) {
console.log('Discovered ' + JSON.stringify(device, null, 2));
this.ngZone.run(() => {
this.devices.push(device);
});
}
scanError(error) {
this.setStatus('Error ' + error);
let toast = this.toastCtrl.create({
message: 'Error scanning for Bluetooth low energy devices',
position: 'middle',
duration: 5000
});
toast.present();
}
When I am running startscanwithoptions(,reportDuplicates:false)… without any service,I am getting all the devices and also while connect I can see the service 1800 under the pheriperal json data.
Has anyone ever worked on this ? Tried passing a specific service to be scanned via bluetooth device.
Any help/pointers will be great help