实例介绍
【实例简介】edison-bluetooth_331704-002.pdf
【实例截图】
【实例截图】
【核心代码】
Contents 1 Introduction....................................................................................................................................................................... 6 1.1 BlueZ software stack ...................................................................................................................................................................6 1.2 Software reference map ............................................................................................................................................................6 1.3 References........................................................................................................................................................................................ 6 1.4 Terminology .................................................................................................................................................................................... 7 2 Bluetooth* Integration in Linux*.................................................................................................................................... 8 2.1 The bluetoothd daemon............................................................................................................................................................9 2.2 Configuration .................................................................................................................................................................................. 9 2.3 Application interface ................................................................................................................................................................ 10 3 Basic Bluetooth* Operation..........................................................................................................................................11 3.1 Enable and disable Bluetooth* on Intel® Edison ......................................................................................................... 11 3.2 Bluetooth* status control via connman........................................................................................................................... 12 3.3 The bluetoothctl utility............................................................................................................................................................ 13 3.4 Device Identification (DI) profile.......................................................................................................................................... 13 4 Scanning and Connecting Devices ..............................................................................................................................15 4.1 Connecting from a peer device............................................................................................................................................ 17 5 Changing a Bluetooth* MAC address..........................................................................................................................18 6 Bluetooth Profiles on Intel® Edison ............................................................................................................................19 6.1 Bluetooth* Low Energy (BLE) profile................................................................................................................................. 20 6.1.1 Verifying BLE plugin compilation........................................................................................................... 20 6.1.2 Preparing to test Bluetooth* profiles.................................................................................................... 21 6.2 Scan and connect....................................................................................................................................................................... 23 6.2.1 bluetoothctl...................................................................................................................................................... 23 6.2.2 hcitool ................................................................................................................................................................. 24 6.2.3 btmgmt............................................................................................................................................................... 26 6.2.4 Python test scripts......................................................................................................................................... 29 6.2.5 GATTtool............................................................................................................................................................ 30 6.3 Device Identification (DI) profile.......................................................................................................................................... 31 6.3.1 Reading and changing the local device identification .................................................................. 31 6.3.2 Retrieving the peer device’s DI information ...................................................................................... 32 6.4 Human interface device (HID) profile................................................................................................................................ 34 6.5 Personal area networking (PAN) profile .......................................................................................................................... 36 6.5.1 PAN test between Linux* host PC and Intel® Edison device ...................................................... 37 6.5.2 PAN test between two Intel® Edison devices .................................................................................... 41 6.6 Serial port profile (SPP)........................................................................................................................................................... 45 6.6.1 SPP verification using DBUS APIs .......................................................................................................... 46 6.6.2 SPP verification using the RFCOMM tool............................................................................................ 49 6.7 HID over GATT profile (HOGP)............................................................................................................................................. 53 6.8 Heart rate profile (HRP) ........................................................................................................................................................... 55 6.9 Proximity profile (PXP)............................................................................................................................................................. 57 6.9.1 PXP services ..................................................................................................................................................... 57 6.9.2 PXP test.............................................................................................................................................................. 57 6.9.3 Proximity monitor.......................................................................................................................................... 58 6.9.4 Proximity reporter ......................................................................................................................................... 59 6.10 Time profile (TIP)........................................................................................................................................................................ 61 6.11 FTP profile..................................................................................................................................................................................... 62 Intel® Edison February 2015 Bluetooth* Guide Document Number: 331704-002 3 6.11.1 FTP server.......................................................................................................................................................... 63 6.11.2 FTP client........................................................................................................................................................... 66 Figures Figure 1 Intel® Edison to Broadcom BCM43340 connections ...............................................................................................6 Figure 2 The BlueZ package ..................................................................................................................................................................8 Figure 3 Help view of available commands.................................................................................................................................13 Figure 4 Show command .....................................................................................................................................................................14 Figure 5 Modalias change....................................................................................................................................................................14 Figure 6 BLE architecture.....................................................................................................................................................................20 Figure 7 Bluetooth* plugins ................................................................................................................................................................21 Figure 8 The rfkill unblock bluetooth command......................................................................................................................21 Figure 9 The hciconfig hci0 lestates command.........................................................................................................................22 Figure 10 HCI events.................................................................................................................................................................................24 Figure 11 hcitool > hcidump traces ...................................................................................................................................................25 Figure 12 btmgmt > hcidump traces.................................................................................................................................................27 Figure 13 btmgmt > hcidump traces (successful pairings) .....................................................................................................28 Figure 14 The test-discovery Python script...................................................................................................................................29 Figure 15 Show command .....................................................................................................................................................................31 Figure 16 Results from uncommented DeviceID line................................................................................................................32 Figure 17 sdptool tool results ..............................................................................................................................................................32 Figure 18 bluetoothctl tool retrieval results..................................................................................................................................33 Figure 19 Raw data from the event file using the “more” command .................................................................................35 Figure 20 PAN service networking models ....................................................................................................................................36 Figure 21 Linux pairing successful .....................................................................................................................................................38 Figure 22 Editing the bluetooth.conf file.........................................................................................................................................45 Figure 23 Serial port absent before running SPP-loopback.py............................................................................................46 Figure 24 Serial port present after running SPP-loopback.py..............................................................................................46 Figure 25 Search for peer devices......................................................................................................................................................47 Figure 26 Still searching..........................................................................................................................................................................47 Figure 27 Android* screenshots..........................................................................................................................................................48 Figure 28 Connected devices ...............................................................................................................................................................48 Figure 29 Sequence of screenshots showing the user inputs the text SPP application...........................................49 Figure 30 BlueTerm app sending text via SPP..............................................................................................................................51 Figure 31 Minicom window on Linux* PC sending text.............................................................................................................52 Figure 32 Mirrored text in Intel® Edison device’s cat shell window ....................................................................................52 Figure 33 Example event test results from Bluetooth mouse...............................................................................................54 Figure 34 Example heart rate monitor data...................................................................................................................................56 Figure 35 Current time service on Android* device ...................................................................................................................61 Figure 36 Checking obex profiles .......................................................................................................................................................62 Figure 37 Pairing Intel® Edison with Android* peer devices...................................................................................................63 Figure 38 Android* FTP screenshots ................................................................................................................................................64 Figure 39 Send/browse files .................................................................................................................................................................65 Figure 40 Bluetooth* file transfer.......................................................................................................................................................65 Figure 41 Actions available after pairing.........................................................................................................................................66 Figure 42 Actions available....................................................................................................................................................................66 Figure 43 Android* device screenshots ...........................................................................................................................................67
好例子网口号:伸出你的我的手 — 分享!
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论