Create bond or pair with a device using Bluetooth
This code shows how to create bond or pair with a device using Tizen Web API.
//config.xml for 2.4 and higher
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://tizen.org/privilege/bluetooth"/>
//config.xml 2.3.2 and lower
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://tizen.org/privilege/bluetooth.gap"/>
//main.js
var adapter = tizen.bluetooth.getDefaultAdapter();
function onBondingSuccessCallback(device) {
console.log('A bond is created - name: ' + device.name);
}
function onErrorCallback(e) {
console.log('Cannot create a bond, reason: ' + e.message);
}
/* here '00:05:B5:15:0E:84’ this address will be different for you. You have to find device BL Mac address to make pair with that device. You may find that address using adapter.discoverDevices method. */
adapter.createBonding('00:05:B5:15:0E:84', onBondingSuccessCallback, onErrorCallback);