-1

I have been able to access the default bluetooth adapter using var adapter = tizen.bluetooth.getDefaultAdapter(); and it works fine as far as now. But when I use var adapter = tizen.bluetooth.getLEAdapter(); for low energy bluetooth adapter I'm not getting the required bluetooth adapter object, i.e, they do not have any parameters like name, mac address as in the case of default adapter. And when I invoke the adapter.startScan() function of LEAdapter it does not return any results. I assume all the latest smartphones support the low energy adapter as well.

I have included the following previlages in the manifest.

<tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/> <tizen:privilege name="http://tizen.org/privilege/bluetooth.admin"/> <tizen:privilege name="http://tizen.org/privilege/bluetooth.spp"/> <tizen:privilege name="http://tizen.org/privilege/bluetooth.health"/>

What am I doing wrong here?

Aldrin Joe Mathew
  • 472
  • 1
  • 4
  • 13

1 Answers1

1

getLEAdapter() Gets the default Low Energy Bluetooth adapter. You may try to Catch the exception:

try
{
   var adapter = tizen.bluetooth.getLEAdapter();
}
catch (err)
{
   console.log(err.name + ": " + err.message);
}

Exceptions: WebAPIException thrown from getLEAdapter()

SecurityError, if the application does not have the privilege to call this method.

NotSupportedError, if the feature is not supported.

UnknownError, if any other error occurs.

To check if this method is supported or not, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.le").

try
{
   /* Checks if a device supports bluetooth API */
   var bluetooth = tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.le");
   console.log(" Bluetooth = " + bluetooth);
}
catch (error)
{
   console.log("Error name: " + error.name + ", message: " + error.message);

}

Resource Links to see: BluetoothManager::getLEAdapter

SystemInfo::getCapability

Yasin shihab
  • 382
  • 1
  • 5