Brillo: Bluetooth on DragonBoard 410c @ brillo-m10-dev


  • Brillo系统Bluetooth框架


1. bluetoothtbd

2. bluetooth-cli

3. bt-example-hr-server – Heart Rate GATT service example




由于Brillo系统只有native的代码,所以在图中其实只包含Bluetooth Stack与Vendor Extensions这两个部份。另外还包含bluetoothtbd模块,用于配置bluetooth模块,建立GATT service或者GATT client。

  • Bluetooth相关的一些命令

1. 相关的帮助信息:

$ adb shell
# bluetooth-cli                                                                                                                                                                                                   
Fluoride Command-Line Interface

Type "help" to see possible commands.

[FCLI] help

	help			Display this message
	disable			Disable Bluetooth
	enable			Enable Bluetooth
	get-state		Get the current adapter state
	is-enabled		Return if Bluetooth is enabled
	get-local-address	Get the local adapter address
	set-local-name		Set the local adapter name
	get-local-name		Get the local adapter name
	adapter-info		Print adapter properties
	supports-multi-adv	Whether multi-advertisement is currently supported
	register-ble		Register with the Bluetooth Low Energy interface
	unregister-ble		Unregister from the Bluetooth Low Energy interface
	unregister-all-ble	Unregister all clients from the Bluetooth Low Energy interface
	register-gatt		Register with the Bluetooth GATT Client interface
	unregister-gatt		Unregister from the Bluetooth GATT Client interface
	connect-le		Connect to LE device (-h for options)
	disconnect-le		Disconnect LE device (-h for options)
	set-mtu		Set MTU (-h for options)
	start-adv		Start advertising (-h for options)
	stop-adv		Stop advertising
	start-le-scan		Start LE device scan (-h for options)
	stop-le-scan		Stop LE device scan

2. 查看Bluetooth adapter的相关信息:

[FCLI] adapter-info
Adapter Properties: 
	Address: 00:00:00:00:A5:AD
	Multi-Adv. supported: true


3. 作为一个Bluetooth – Central

通过bluetooth-cli提供的start-le-scan, stop-le-scan, connect-le, disconnect-le去扫描、关连相关的ble外设:

[FCLI] start-le-scan
Command status: success
[FCLI] stop-le-scan
Command status: success
[FCLI] start-le-scan -d
Command status: success
Scan result: [FC:CD:6E:4B:8D:24] - RSSI: -57 - Record: 0201060A0947616C61787920413903030D18[FCLI] 
[FCLI] connect-le FC:CD:6E:4B:8D:24
Command status: success
Connection state: [FC:CD:6E:4B:8D:24 connected: true ] - status: 0 - client_id: 5[FCLI]

4. 能否作为一个Bluetooth Perheral呢:

[FCLI] register-ble
Command status: success
Registered BLE client with ID: 4[FCLI]
[FCLI] start-adv -n -t -c
Command status: success
Advertising start status: success


  • 运行sample app – bt-example-hr-server

在system/bt/service/下面有一个bt-example-hr-server的sample app,可以通过它来学习如何开发一个简单的BLE server app。先编译出来push到DragonBoard 410c中看看效果:

$ mmm system/bt/service
$ adb remount
$ adb sync system
$ adb shell bt-example-hr-server
[0321/155621:INFO:server_main.cpp(92)] Starting GATT Heart Rate Service sample
[0321/155621:INFO:heart_rate_server.cpp(228)] Heart Rate server registered - server_if: 4
[0321/155621:INFO:heart_rate_server.cpp(229)] Populating attributes
[0321/155621:INFO:heart_rate_server.cpp(302)] Initiated EndServiceDeclaration request
[0321/155621:INFO:heart_rate_server.cpp(325)] Heart Rate service added
[0321/155621:INFO:server_main.cpp(128)] Heart Rate service started successfully

做完这些之后,你还需要通过bluetooth-cli开启ble adv(start-adv),不然手机没办法扫描到这个ble外设。

手机相关的app可以使用development/samples/browseable/BluetoothLeGatt @ android-5.1.1_r15中的代码。通过这个App,你可以连接ble设备,查看设备所提供的服务(Heart Rate Service):


  • 相关的参考文档:

《Brillo: Bluetooth on DragonBoard 410c @ brillo-m10-dev》有10个想法

      1. Transfer file using bluetooth need Object Push Profile(OPP), currently it seems only support ble Generic Attribute Profile (GATT) which does not support transfer file directly. You may implement your own file transfer protocol。

        1. Then how we can test bluetooth functinality of brillo?
          please can you share me any document about this if availble.

          1. There is an example in the “system/bt/service/example/heart_rate” which will make the bluetooth device acts as a peripheral role( Then you can use the bluetooth-cli command to enable the bluetooth adapter & do advise (adb shell bluetooth-cli),
            [FCLI] enable
            [FCLI] register-ble
            [FCLI] start-adv -n -t -c
            As you can see, this will make the brillo device act as a heart rate monitor device, you can use the standard heart rate monitor app to establish connection.

  1. Since google did not public announce release Brillo system, and I am not sure the Brillo Device Manager is available now on the google Play. The Brillo Device Manager may able to setup the device.
    You can also follow this instructions from to get gcd then setup the brillo device by access http:///privet/v3/setup.

  2. Have you tried run bluetooth-cli on Android devices platform adb command?
    seems that the native app bluetooth-cli not works on LA devices.


电子邮件地址不会被公开。 必填项已用*标注