### Bluetooth

Raspberry Pi Bluetooth
B4J Instructions
http://www.b4x.com/android/forum/threads/iot-rpi-raspberry-pi-bluetooth-tutorial.60214/#content
Raspberry Pi Organisation Instructions
https://www.raspberrypi.org/learning/robo-butler/bluetooth-setup/
After Installation Hint
Hint if Error "Can not open SDP session"
If after installation, the error below during executing of the B4J application occurs
javax.bluetooth.ServiceRegistrationException: Can not open SDP session. [2] No such file or directory
then following steps worked in my test environment to resolve:
Login as: pi
Check Bluetooth Devices
lsusb
Result Example:
Bus 001 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 005: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 004: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Scan for Bluetooth Devices
This requires the hcitool.
hcitool scan
Result Example:
Scanning ...
2C:D0:5A:54:B6:D1 RWBL
Turn Bluetooth ON
sudo service bluetooth start
Turn Bluetooth OFF
sudo service bluetooth stop
Edit bluetooth.service if not started properly
sudo nano /lib/systemd/system/bluetooth.service
Look for ExecStart=/usr/libexec/bluetooth/bluetoothd. Put -C at the end of this line and save.
Check if Bluetooth Service is running
ps -ef | grep bluetooth
Result Example:
root 534 1 0 09:59 ? 00:00:00 /usr/lib/bluetooth/bluetoothd -C
Run
sudo sdptool browse local
If this does not work, then reboot and run again.
Result Example:
Browsing FF:FF:FF:00:00:00 ...
Service RecHandle: 0x10000
Service Class ID List:
"PnP Information" (0x1200)
Profile Descriptor List:
"PnP Information" (0x1200)
Version: 0x0103
Browsing FF:FF:FF:00:00:00 ...
Service Search failed: Invalid argument
Service Name: Generic Access Profile
Service Provider: BlueZ
Service RecHandle: 0x10001
Service Class ID List:
"Generic Access" (0x1800)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 31
"ATT" (0x0007)
uint16: 0x0001
uint16: 0x0008
Service Name: Generic Attribute Profile
Service Provider: BlueZ
Service RecHandle: 0x10002
Service Class ID List:
"Generic Attribute" (0x1801)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 31
"ATT" (0x0007)
uint16: 0x0010
uint16: 0x0010
Service Name: AVRCP CT
Service RecHandle: 0x10003
Service Class ID List:
"AV Remote" (0x110e)
"AV Remote Controller" (0x110f)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x0103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0105
Service Name: AVRCP TG
Service RecHandle: 0x10004
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x0103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0104

Changed: 2018-03-26 13:05, Category: Raspberry Pi, File: T6C234M1708.htm, ID: 1708