I am attempting to access the Bluetooth API in the Samsung wear IDE for the Gear 2. I have successfully added the WIDLPROCXML definitions from the normal IDE to the Wear IDE and can have access on content assist to all the tizen.bluetooth.xx
functions.
In the Wear IDE on the app.js
file below, the console results undefined when calling the bluetooth.address
function. I am aware that Tizen intentionally is trying to disallow access to Bluetooth to keep their watch only on the Samsung devices, but being an open platform I would like to make my own application communicate with other Bluetooth devices (i.e. iPhone, other radios) etc.
Any advice on how I can get access to the full Bluetooth API would be helpful. I wonder if it has something to do with the Application Control Engine on the Web Run Time vs a config file that can be altered on the device. I know access to Bluetooth is possible as Samsung has their own API for connecting to their galaxy devices.
Below is the sample app and the console output:
var adapter = tizen.bluetooth.getDefaultAdapter();
var deviceCapabilities;
deviceCapabilities = tizen.systeminfo.getCapabilities();
if (deviceCapabilities.bluetooth)
{
console.log("Bluetooth is supported");
}
console.log(adapter.address);
adapter.setPowered(true);
console.log(deviceCapabilities.platformName);
adapter.setPowered(false, successCallback, errorCallback)
Console Output:
js/app.js (9) :Bluetooth is supported js/app.js (12) :undefined js/app.js (16) :Tizen js/app.js (19) :NotSupportedError: Bluetooth turn off is not supported
Any ideas?
In short: you can't.
Bluetooth capabilities are not exposed to JavaScript on wearable profile, so you cannot access them. This is not only matter of ACE or WRT "blocking: your access, at the moment WRT just lacks this capability on wearables.
来源:https://stackoverflow.com/questions/25111725/tizen-samsung-wear-bluetooth-access