0

so in this question I asked how would I identify a bluetooth device after doing an scan. It seems that only those devices I have connected to show their name, all other devices are shown as unnamed.

So my question is, how do I pair all the unnamed devices using the Ionic Native BLE library? It doesn't matter if I need to do a manual process for each one (since this will be done only once). Thanks in advance.

Multitut
  • 2,089
  • 7
  • 39
  • 63

1 Answers1

0

Using your example, when you scan you get objects like this:

{
  id: "2BD5D5A7-EF50-B4F4-D4FD-9A8413006D4B",
  rssi: -24,
  advertising: {
    kCBAdvDataIsConnectable: true
  },
  name: ""
}

where name is an empty string which is your term unnamed.

You can check if the name is an empty string, take the id value instead to establish BLE connection.

ble.connect("2BD5D5A7-EF50-B4F4-D4FD-9A8413006D4B", connectSuccess, connectFailure);
Huiting
  • 1,368
  • 7
  • 24