The host processor on the Intel® Edison development board is connected to a Broadcom* BCM43340 combo chip via UART (uart0 mapped to /dev/MFD0) as transport layer and uses additional GPIOs to handle power (on, reset, etc.), OOB (out-of-band) signaling for UART to support low power mode.
BlueZ, an open source project, is the official Linux* Bluetooth* protocol stack. The BlueZ stack sources divide into components in both the kernel and user spaces. The main component is the Bluetooth daemon.
Bluetooth* controllers are handled in Linux* via interfaces accessible by the rfkill
and hci
utilities (rfkill
, hcidump
, hciconfig
, hcitools
, etc.). In this tutorial we are using rfkill.
Before you can perform any Bluetooth operations, connect to the Intel® Edison device via ssh
and call rfkill
to unblock the Broadcom* BCM43340 chip. Once Bluetooth is enabled, rfkill
will usually list the available interfaces. You can also use the rfkill
list command to show them.
- Check the status of Bluetooth:
root@edison0:~# rfkill list
0: phy0: wlan
Soft blocked: no
Hard blocked: no
1: brcmfmac-wifi: wlan
Soft blocked: no
Hard blocked: no
2: bcm43xx Bluetooth: bluetooth
Soft blocked: yes
Hard blocked: no
root@edison0:~#
- Enable Bluetooth:
root@edison0:~# rfkill unblock bluetooth
root@edison0:~# rfkill list
0: phy0: wlan
Soft blocked: no
Hard blocked: no
1: brcmfmac-wifi: wlan
Soft blocked: no
Hard blocked: no
2: bcm43xx Bluetooth: bluetooth
Soft blocked: no
Hard blocked: no
4: hci0: bluetooth
Soft blocked: no
Hard blocked: no
root@edison0:~#
Bluetooth command line utilityThis command line utility can be used to perform basic Bluetooth* operation, such as:
- Start or stop discovery
- Register an agent
- Scan devices
- Pair and connect a device
- Set Bluetooth devices as trusted or untrusted
bluetoothctl will start BlueZ command line utility, when inside the BlueZ command line utility you will see [bluetooth]# at the beginning of each line.
root@edison0:~# bluetoothctl
[NEW] Controller 98:4F:EE:03:7B:B3 edison0 [default]
...
[bluetooth]# discoverable on
Changing discoverable on succeeded
[CHG] Controller 98:4F:EE:03:7B:B3 Discoverable: yes
...
[bluetooth]# agent DisplayYesNo
Agent registered
...
[bluetooth]# default-agent
Default agent request successful
...
[bluetooth]# scan on
Discovery started
[CHG] Controller 98:4F:EE:03:7B:B3 Discovering: yes
[CHG] Device 54:E4:BD:7A:36:A0 RSSI: -70
...
[bluetooth]# trust 54:E4:BD:7A:36:A0
...
[bluetooth]# exit
root@edison0:~#
Bluetooth DaemonBy default the Bluetooth daemon will load and initialize all built-in plugins, but it is also possible to directly enable or disable a set of plugins with the – plugin and – noplugin command line options. When you disable a plugin, the corresponding profile won’t be available, which means that no application will be able to register and advertise this service. You can do this on an Intel® Edison device by modifying the systemd file for BlueZ (/etc/systemd/system/bluetooth.target.wants/bluetooth.service
) and adding command line arguments in ExecStart.
root@edison0:~# systemctl stop bluetooth
root@edison0:~# systemctl status bluetooth
root@edison0:~# systemctl start bluetooth
Object Exchange (OBEX)OBEX is a transfer protocol that defines data objects and a communication protocol two devices can use to exchange those objects. OBEX uses a client-server model and is independent of the transport mechanism and transport API. A Bluetooth enabled device wanting to set up an OBEX communication session with another device is considered to be the client device. The OBEX protocol also defines a folder-listing object, which is used to browse the contents of folders on remote device. RFCOMM is used as the main transport layer for OBEX.
OBEX enables applications to work over the Bluetooth technology protocol stack as well as the IrDA stack. For Bluetooth enabled devices, only connection-oriented OBEX is supported. Three application profiles have been developed using OBEX which include SYNC, FTP and OPP.
root@edison0:~# systemctl stop obex
root@edison0:~# systemctl status obex
root@edison0:~# systemctl start obex
Android App - Bluetooth file transferFor testing the FTP server, we are using Bluetooth File Transfer application from Google Store. It's free and easy to use.
Comments