您尚未登录。

楼主 #1 2018-05-03 21:10:08

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

一个非常牛叉的蓝牙协议栈 ---- btstack

移植到ESP32说明(依赖ESP-IDF):
https://github.com/bluekitchen/btstack/tree/master/port/esp32

一个蓝牙2.0 A2DP发送端,可以连接小米蓝牙音箱:
https://github.com/bluekitchen/btstack/blob/master/example/a2dp_source_demo.c

需要把源码里面这行:

static const char * device_addr_string = "00:21:3C:AC:F7:38";

里面的mac地址改为你的蓝牙喇叭地址.

QQ20180503210619.png

使用方法:

b      - AVDTP Source create connection to addr E8:07:BF:1C:43:74
B      - AVDTP Source disconnect
c      - AVRCP Target create connection to addr E8:07:BF:1C:43:74
C      - AVRCP Target disconnect
x      - start streaming sine
z      - start streaming 'nao-deceased by disease'
p      - pause streaming





离线

楼主 #2 2018-05-03 21:10:43

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

乐鑫ESP32 官方开发板 + 小米蓝牙喇叭测试成功!





离线

楼主 #3 2018-05-03 21:10:52

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

一开始我用的是乐鑫官方 esp-idf 的 master 分支(只有master分支才有 a2dp source,相当于替代手机),

连接小米蓝牙喇叭没有问题, 连上之后全是噪音。

想想也正常,代码里面根本就没有找到发送音乐的地方, 我也是醉了。





离线

楼主 #4 2018-05-03 21:10:56

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

占坑





离线

楼主 #5 2018-05-03 21:11:00

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

占坑





离线

#6 2018-05-04 07:49:51

www220
会员
注册时间: 2018-02-09
已发帖子: 46
积分: 46

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

晕神就是厉害

离线

#7 2018-05-22 19:51:57

时光の梦
会员
注册时间: 2018-05-22
已发帖子: 1
积分: 1

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

请问有linux平台下使用bluez播放音频文件到蓝牙耳机的示例代码或者资料吗?

离线

楼主 #8 2018-05-22 20:32:16

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

强烈不建议在嵌入式环境用 bluez

建议用 btstack, 商业使用请付费。
https://whycan.cn/t_1133.html#p5588





离线

#9 2018-09-27 15:09:30

WM_CH
会员
注册时间: 2018-08-18
已发帖子: 38
积分: 83

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

晕哥 说:

强烈不建议在嵌入式环境用 bluez

建议用 btstack, 商业使用请付费。
https://whycan.cn/t_1133.html#p5588


晕哥,请问怎么把BTstack移植到嵌入式平台啊,比如海思3516这个。
我看了官方文档,都是一些流行的板卡,树莓派什么的,就是没有教大家怎么自己动手移植。。。
希望指导一下小弟。。。

最近编辑记录 WM_CH (2018-09-27 15:10:21)

离线

楼主 #10 2018-09-27 15:23:28

晕哥
管理员
注册时间: 2017-09-06
已发帖子: 9,342
积分: 9202

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

当时没有系统写步奏, 现在已经不太记得了,你搜索一下站内贴.

https://whycan.cn/t_1133_1.html#p5270





离线

#11 2023-12-26 21:56:18

memory
会员
注册时间: 2021-08-11
已发帖子: 442
积分: 418

Re: 一个非常牛叉的蓝牙协议栈 ---- btstack

led_counter   一个无蓝牙的定时器演示程序
gap_inquiry   搜索附近的经典蓝牙设备
gatt_browser 搜索第一个BLE设备并获取信息
spp_and_gatt_counter spp和gatt同时工作


gatt_counter  可以接受手机调试软件发过来的数据









• Hello World example:
– led counter: Hello World - Blinking an LED without Bluetooth.
• GAP examples:
– gap inquiry: GAP Classic Inquiry.
– gap link keys: GAP Link Key Management (Classic).
• Low Energy examples:
– gap le advertisements: GAP LE Advertisements Scanner.
– gatt browser: GATT Client - Discover Primary Services.
– gatt counter: GATT Server - Heartbeat Counter over GATT.
– gatt streamer server: Performance - Stream Data over GATT (Server).
– gatt battery query: GATT Battery Service Client.
– gatt device information query: GATT Device Information Service
Client.
– gatt heart rate client: GATT Heart Rate Sensor Client .
– nordic spp le counter: LE Nordic SPP-like Heartbeat Server .
– nordic spp le streamer: LE Nordic SPP-like Streamer Server .
– ublox spp le counter: LE u-blox SPP-like Heartbeat Server.
– sm pairing central: LE Central - Test Pairing Methods.
– sm pairing peripheral: LE Peripheral - Test Pairing Methods.
– le credit based flow control mode client: LE Credit-Based Flow-Control
Mode Client - Send Data over L2CAP.
– le credit based flow control mode server: LE Credit-Based Flow-Control
Mode Server - Receive data over L2CAP.
– att delayed response: LE Peripheral - Delayed Response.
– ancs client demo: LE ANCS Client - Apple Notification Service.
– le mitm: LE Man-in-the-Middle Tool.
• Performance examples:
– le streamer client: Performance - Stream Data over GATT (Client).
– gatt streamer server: Performance - Stream Data over GATT (Server).
– le credit based flow control mode client: LE Credit-Based Flow-Control
Mode Client - Send Data over L2CAP.
– le credit based flow control mode server: LE Credit-Based Flow-Control
Mode Server - Receive data over L2CAP.
– spp streamer client: Performance - Stream Data over SPP (Client).
– spp streamer: Performance - Stream Data over SPP (Server).
• Audio examples:
– a2dp sink demo: A2DP Sink - Receive Audio Stream and Control
Playback.
– a2dp source demo: A2DP Source - Stream Audio and Control Volume.
– avrcp browsing client: AVRCP Browsing - Browse Media Players
and Media Information.
– hfp ag demo: HFP AG - Audio Gateway.
– hfp hf demo: HFP HF - Hands-Free.
– hsp ag demo: HSP AG - Audio Gateway
– hsp hs demo: HSP HS - Headset.
– sine player: Audio Driver - Play Sine .
– mod player: Audio Driver - Play 80’s MOD Song.
– audio duplex: Audio Driver - Forward Audio from Source to Sink.
• SPP Server examples:
– spp counter: SPP Server - Heartbeat Counter over RFCOMM.
– spp flowcontrol: SPP Server - RFCOMM Flow Control.
• Networking examples:
– pan lwip http server: PAN - lwIP HTTP and DHCP Server .
– panu demo: BNEP/PANU (Linux only).
• HID examples:
– hid keyboard demo: HID Keyboard Classic.
– hid mouse demo: HID Mouse Classic.
– hid host demo: HID Host Classic.
– hog keyboard demo: HID Keyboard LE.
– hog mouse demo: HID Mouse LE.
– hog boot host demo: HID Boot Host LE.
• Dual Mode examples:
– spp and gatt counter: Dual Mode - SPP and LE Counter.
– gatt streamer server: Performance - Stream Data over GATT (Server).
• SDP Queries examples:
– sdp general query: SDP Client - Query Remote SDP Records.
– sdp rfcomm query: SDP Client - Query RFCOMM SDP record.
– sdp bnep query: SDP Client - Query BNEP SDP record.
• Phone Book Access example:
– pbap client demo: PBAP Client - Get Contacts from Phonebook
Server.
• Testing example:
– dut mode classic: Testing - Enable Device Under Test (DUT) Mode
for Classic.

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn