bluez

玩转BLE(1)_Eddystone beacon

我的梦境 提交于 2020-05-04 04:44:13
1. 前言 你相信两条命令就可以把自己的破手机变成一个Beacon节点吗?不相信的话就接着往下看吧。 通过前几篇“ 蓝牙协议分析 ”相关的文章,特别是“ 蓝牙协议分析(3)_蓝牙低功耗(BLE)协议栈介绍 ”,相信大家对BLE协议栈已经有了基本的认识。在继续后续的分析之前,我们有必要换个视角,从应用的角度,以“玩”的心态,学习并理解BLE的工作原理,并作为后续分析文章的引子和入口。这就是撰写“玩转BLE”系列文章的缘由。 之所以起名为“玩转”,是因为我不会在这些文章中涉及任何的技术细节,仅仅是描述一些操作步骤,普及一些蓝牙BLE有关的使用场景。 另外,由于Linux平台使用的蓝牙协议栈是Bluez [1] ,Bluez协议栈提供了很多方便、灵活又强大的测试工具(如hcitool、gatttool等)。因此,简单起见,在写“玩转”系列文章的时候,我会尽可能的使用这些测试工具,而不引入复杂的编程手段。从另一个角度看,“玩转”系列文章也是BLE测试的一些步骤总结,方便自己和他人查阅。 本文是“玩转”系列文章的第一篇,以简单的两条hcitool命令,将自己的手机或者开发板变成一个BLE Beacon节点,进而体会BLE技术的简洁和神奇。 2. Eddystone beacon简介 Eddystone beacon是谷歌于2015年7月发布的、开源的、可以多平台使用的

bluetooth在linux应用开发

三世轮回 提交于 2020-04-30 21:07:25
linux 内 Bluetooth 的协议栈为 BlueZ , http://www.bluez.org/ 。 在 4.46 上, BlueZ 实现了对 A2DP Sink 的支持,而之前的版本只支持 A2DP Source 。 主机实现到 HCI 层,底层由蓝牙芯片实现。 HCI 层实现的是蓝牙芯片与主机通讯的方式。目前一般是 串口或者 USB 通讯 。所谓的 USB 也不是真正意义上的 USB 通讯,而是类似与 USB 转串口的方式,即通过驱动模拟 USB 设备实现串口通讯。目前 USB 蓝牙适配器 基本都是这种设备模式。 PC 端实现了 L2CAP, SDP, RFCOMM 协议,以及 USB 转串口的驱动。 Windows XP SP2 操作系统以上版本的都内置了这些协议栈,还有如 WIDCOMM 等公司提供的第三方协议栈。 实际中只需在市场上购买这种蓝牙适配器( USB 接口),然后通过配置内核蓝牙的接口驱动(即上图中的 HCI 层驱动),这样相应的蓝牙协议( linux 官方版本是 bluez )就已经在内核中了,这就相当于内核驱动中已经支持了相应的蓝牙协议( SDP,RFCOMM... ),有了驱动就需要接口库提供给应用程序使用,这里用到的接口库是开源的 bluez ,其实就是要在内核之上移植 bluez 及工具 bluez-utils 。 bluez 分为两部分

linux Bluetooth programming in c

余生颓废 提交于 2020-02-18 05:24:10
问题 I am trying to run a basic code of c in linux[ubuntu] to search bluetooth device, but i am facing some problem. By using command sudo apt-get install bluez , to install required blueZ library it is saying that bluez is already newest version. But error comes that not able to find bluetooth.h and other files in compiling C source code, with gcc -o simplescan simplescan.c -lbluetooth Is there a complete library package, or do I have to download these header files?. I am following this link 回答1:

Bluez 5 - initiate avrcp connection to iPhone from Bluez

徘徊边缘 提交于 2020-01-23 02:55:31
问题 Bluez 5.28 Goal - Control iOS track skip, and initiate connection from Bluez programmatically. Do not want a2dp. Everything works fine if I initiate connection from iPhone/iPad (go to BT settings, click on Pi device), which I want to avoid and not have to fiddle with the phone. (car setup with Pi). I have control, track metadata, etc. Doing a connect xx:xx:xx:xx:xx:xx in bluetoothctl yields: a2dp-source profile connect failed for 6C:70:9F:7E:EF:A8: Protocol not available Ok. It needs

Raspberry iBeacon not detecting

半城伤御伤魂 提交于 2020-01-20 19:55:09
问题 I recently was trying to configure ibeacon on a BLE dongle (cambridge silicon radio) on a raspberry pi. Reference: http://developer.radiusnetworks.com/2013/10/09/how-to-make-an-ibeacon-out-of-a-raspberry-pi.html I get this message : HCI Command: ogf 0x08, ocf 0x0008, plen 44 1E 02 01 1A 1A FF 4C 00 02 15 E2 C5 6D B5 DF FB 48 D2 B0 60 D0 F5 A7 10 96 E0 00 00 00 00 C9 00 00 00 00 00 00 00 00 00 00 00 00 00 > HCI Event: 0x0e plen 4 01 08 20 12 And the app does not even locate the beacon. Though

Automate Bluetooth Pairing/Trusting in Bluez5

痴心易碎 提交于 2020-01-16 03:29:04
问题 I've been working on making my RPi 2 function like a car bluetooth receiver and all is well, except I have no idea how I could automate the pairing of bluetooth devices in Bluez5. In the past I would've used the bluetooth agent and a simple script, but that seems to have gone out the window with the move from 4 -> 5. The nature of the setup means I have no kb/mouse on the RPi once its in the car, so it needs to be a fully automated setup where anyone can scan for the RPi, and if the probably

QtBlueTooth not functional on Linux

与世无争的帅哥 提交于 2020-01-07 03:36:05
问题 I'm developing an embedded application with bluetooth LE function enabled using Qt 5.7. The device I'm developing are meant to act as peripheral role, it can broadcast advertising packets and let smartphones to connect to. The target board are running with Ubuntu Linux 14.04, with bluez version 5.43 (the latest) Since Qt documentation says "In Qt 5.7, additional API supporting the peripheral role was added as a Technology Preview, with the backend only implemented for Linux/BlueZ." So, I

Reading Thermometer Data with Bluez Bluetooth Low Energy

六眼飞鱼酱① 提交于 2020-01-05 06:42:54
问题 I was wondering if there anyone willing to guide me a bit. I am trying to read the temperature of a Bluetooth thermometer using gatttool, but I don't know how to work with the indicate property. I am able to connect to the device, get the device name, etc., but it has proven to be more challenging to get the actual temperature data. Does any one have an idea? Also if you have more questions for me, let me know. 回答1: Assuming that your device uses the adopted thermometer profile, then you want

How to get Disconnect Event from GATT Server on Bluez/Linux

杀马特。学长 韩版系。学妹 提交于 2020-01-02 10:25:32
问题 Environment: Bluez 5.14, Linux 3.1, USB Plugable BLE radio, TI BLE keyfob (CC2541 dev kit) Linux Device <---hci----> USB BLE Radio We enabled key press events on TI keyfob using gatttool and started to listen for events gatttool -b [hardware ID] --char-write-req -a [handle] -n [value] --listen (gatttool -b 90:59:AF:09:E1:5D --char-write-req -a 0x0048 -n 0100 --listen) Pressing buttons on the keyfob and see these events Notification handle = 0x0047 value: 02 Notification handle = 0x0047 value:

How to rebuild bluez

懵懂的女人 提交于 2020-01-01 18:16:11
问题 How can I rebuild bluez? Is it possible? Lets just say I want to change something in avctp.c for example. I download the latest bluez release from their website and make the change I need to make. Now, how do I get the changes to be effective; i.e. what do I need to do to rebuild bluetoothd? Note: I am using Ubuntu 12.04 回答1: The quickest way to do this is just to remake the whole bluez package with the following commands: ./configure make make install After that, you can run the configured