Connecting to a Smartphone with Bluetooth and Making Phone Calls

From Tizen Wiki
Jump to: navigation, search

Step by step tutorial how to pair and connect with Bluetooth a device with Tizen:Common to a smartphone, and after that to make a phone call using Bluetooth Hands-Free Profile (HFP).

Making a phone call from Raspberry Pi 2 connected with Samsung Z1 over Bluetooth
Making a phone call from Raspberry Pi 2 connected with Samsung Z1 over Bluetooth

Required hardware

  • Device with Tizen:Common such as MinnowMax, Intel NUC, HummingBoard, RaspberryPi 2, etc.
  • Bluetooth USB dongle (compatible with GNU/Linux distributions)
  • Smartphone with Bluetooth capabilities (tested on Samsung Z1 with Tizen 2.3 and Samsung Note 3 Neo with Android 4.4.2)

Installing utilities

Python packages, bluez5, ofono, and ofono-test are required to pair Tizen:Common device with a smartphone and to make a phone call. Bluez5 is included by default in Tizen:Common but you need to install the other packages.

Using Tizen on Yocto images

Edit local.conf and append the following line to build and include the required utilities:

IMAGE_INSTALL_append = " ofono ofono-test "

Using GBS images

Run the following commands as root:

zypper install ofono ofono-test

Bluetooth device pairing

Follow the step by step instructions to connect device with Tizen:Common (or another Tizen 3 profile) to a smartphone over Bluetooth:

  • Turn on Bluetooth on the smartphone and make it visible for other devices
  • Plug the Bluetooth USB dongle into the device with Tizen:Common

Verify that the Bluetooth USB dongle is detected:

hciconfig -a
  • Bring up the Bluetooth USB dongle:
rfkill unblock bluetooth
hciconfig hci0 up
  • Start bluetoothctl:
bluetoothctl
  • Power on the Bluetooth controller:
[bluetooth]# power on
  • Enable the agent and set it as default:
[bluetooth]# agent on
[bluetooth]# default-agent
  • Set the Bluetooth controller as discoverable for 3 minutes and pairable:
[bluetooth]# discoverable on
[bluetooth]# pairable on
  • Scan for other device to retrieve the smartphone:
[bluetooth]# scan on
  • Find out the MAC address of the smartphone:
[bluetooth]# devices
  • Pair with the smartphone:
[bluetooth]# pair smartphone_mac_address
  • Enter 4 digit PIN if prompted. Enter the same PIN on the smartphone.
[agent]PIN code: ####
  • Allow the service authorization if requested.
[agent]Authorize service service_uuid (yes/no): yes
  • Trust the smartphone:
[bluetooth]# trust smartphone_mac_address
  • Connect to the smartphone:
[bluetooth]# connect smarphone_mac_address
  • Verify that the smartphone is successfully connected and display information about it with the following command:
[bluetooth]# info smarphone_mac_address
  • The device has been successfully paired with the smartphone and you now can exit bluetoothctrl:
[bluetooth]# quit

Making phone calls

After pairing the device with Tizen:Common (or another Tizen 3 profile) to a smartphone you can initiate phone calls from the device using a python script provided by ofono:

  • Login as root
  • Replace phone_number with the corresponding number that you would like to dial and execute the following command:
/usr/lib/ofono/test/dial-number phone_number


See also

Bluetooth