简体   繁体   English

iOS蓝牙双模; 同时将BLE(GATT)连接到已连接的BR / EDR(A2DP / HFP)立体声耳机

[英]iOS Bluetooth dual-mode; connect BLE (GATT) to an already connected BR/EDR (A2DP/HFP) stereo headset simultaneously

I'm developing a stereo headset with Bluetooth using the classic profiles (HFP, A2DP, AVRCP) as one would expect Ina stereo headset. 我正在使用经典配置文件(HFP,A2DP,AVRCP)开发带蓝牙的立体声耳机,就像人们期望的Ina立体声耳机一样。 However, I want to deploy a remote control app for iOS, and use it simultaneously to the other classic links, but the dual-mode chipset I'm working with in my design does not behave as I'd expect; 但是,我想为iOS部署一个远程控制应用程序,并将其同时用于其他经典链接,但我在设计中使用的双模芯片组并不像我期望的那样;

The headset is setup as a peripheral, letting the iOS device act as central. 耳机设置为外围设备,让iOS设备充当中心。 As such, the peripheral advertise its BLE services (with my specific 128-bit UUIDs) and all is good. 因此,外围设备通告其BLE服务(使用我特定的128位UUID)并且一切都很好。 I can browse the peripheral from any central, but only when I'm not connected with classic profiles (eg, while not streaming audio). 我可以从任何中心浏览外设,但只有当我没有连接经典配置文件时(例如,不流式传输音频)。

My device does not seem to be able to advertise BLE, while connected with HFP and/or A2DP! 在与HFP和/或A2DP连接时,我的设备似乎无法宣传BLE! However, I have seen demos of the same chipset acting as BLE central, scanning and connecting to other BLE peripherals, while simultaneously streaming audio via A2DP. 但是,我看到同一芯片组的演示充当BLE中心,扫描并连接到其他BLE外设,同时通过A2DP传输音频。 However, in that setup the device was acting as A2DP sink connected to an iPhone, while scanning/connecting via BLE to a third unit acting as BLE peripheral. 但是,在该设置中,设备充当连接到iPhone的A2DP接收器,同时通过BLE扫描/连接到充当BLE外围设备的第三个单元。 Hence, not point-to-point with both Classic and Smart Bluetooth to the same device. 因此,不能将经典和智能蓝牙与同一设备进行点对点。

Is there a dual-mode constraint that one cannot act as peripheral while supporting/connecting to Bluetooth Classic profiles? 是否存在双模式约束,在支持/连接Bluetooth Classic配置文件时,不能充当外设? And that only Central-mode is supported in that case? 那种情况下只支持中央模式吗?

FYI, I'm using CSR's 8670 chipset. 仅供参考,我正在使用CSR的8670芯片组。

UPDATE UPDATE

New answer added. 新的答案补充说。 My apologies for not clarifying/cleaning-up my previous answer until now -- time flies! 我很抱歉直到现在还没有澄清/清理我以前的答案 - 时光飞逝!

Well, after digging down into specs and trying to understand things more clearly, I've found the answers I was looking for, even though I would have preferred to more optimistic answers... ;( 好吧,在深入研究规格并试图更清楚地理解事物后,我找到了我想要的答案,尽管我更喜欢更乐观的答案......;(

Nevertheless, let's get to it; 不过,让我们来看看; the Bluetooth spec for 4.0 (BLE) says that; 蓝牙规范4.0(BLE)说;

Dual-mode gadgets cannot act as BLE peripheral and advertise its presence while still being connectable in "Classic" Bluetooth using BR/EDR. 双模式小工具不能充当BLE外设并宣传其存在,同时仍然可以使用BR / EDR在“经典”蓝牙中连接。

Furthermore, CSR source-code examples for the CSR8670 dual-mode chipset I'm using all behave in the same say; 此外,我使用的CSR8670双模芯片组的CSR源代码示例表现相同; BLE advertisements as peripheral are disabled when any classic BT-link is connected. 当连接任何经典BT链路时,禁用作为外围设备的BLE广告。 Instead, the CSR source code promote that the device should act as the BLE central instead, allowing other BLE peripheral units to advertise and connect to it, all fully doable while streaming audio (acting as A2DP sink). 相反,CSR源代码促进设备应该充当BLE中心,允许其他BLE外围设备通告并连接到它,所有这些都可以在流式传输音频时充当(充当A2DP接收器)。

This does not suite my setup at all since; 这完全不适合我的设置;

  1. BLE centrals consume more power than BLE peripherals, and my device needs to conserve energy BLE中心比BLE外设消耗更多功率,我的设备需要节省能源
  2. The dual-mode "combo"-problem of combining a BR/EDR-device with BLE peripheral functionality just moved to the phone instead, which will not work any better since we cannot expect Apple (or anyone else) to violate the BLE spec. 将BR / EDR设备与BLE外围功能相结合的双模“组合”问题恰好转移到手机上,由于我们不能指望Apple(或其他任何人)违反BLE规范,因此效果不会更好。

Instead, the recommended approach is let my stereo headset skip BLE entirely and use GATT over BR/EDR instead, also known as advertising via "vanilla", which makes sense really; 相反,推荐的方法是让我的立体声耳机完全跳过BLE并使用GATT而不是BR / EDR,也称为“香草”广告,这真的很有意义; I mean, I already have an ACL-link setup between two devices, why should I need to kick any sort of discovery mechanism? 我的意思是,我已经在两个设备之间建立了ACL链接,为什么我需要启动任何类型的发现机制?

Again, the Bluetooth SIG comes in handy; 同样,蓝牙SIG也派上用场了;

https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx https://developer.bluetooth.org/TechnologyOverview/Pages/GATT.aspx

GATT and ATT are not transport specific and can be used in both BR/EDR and LE. GATT和ATT不是特定于运输的,可用于BR / EDR和LE。 However, GATT and ATT are mandatory to implement in LE since it is used for discovering services 但是,GATT和ATT必须在LE中实施,因为它用于发现服务

So, the SIG says "yes" to using BR/EDR as transport for GATT, but the question then instead becomes; 因此,SIG对于使用BR / EDR作为GATT的传输表示“是”,但问题则变为; how can I then get access to that connected BR/EDR device from within my iOS-app, where the typical scenario is to use CBCentral to scan, discover and connect to a CBPeripheral? 我怎么能那么从我的IOS的应用程序,其中典型的场景是使用CBCentral进行扫描,发现并连接到一个CBPeripheral内可以访问连接 BR / EDR设备? The answer is simple; 答案很简单; you cannot, since iOS 7.0 does not (yet?) support GATT for BR/EDR; 你不能,因为iOS 7.0没有(但是?)支持GATT for BR / EDR;

https://www.bluetooth.org/tpg/showDeclaration.cfm?3A000A5A005C5344535D5414403B0C0D0E2405022413010E57503F202A5A72 https://www.bluetooth.org/tpg/showDeclaration.cfm?3A000A5A005C5344535D5414403B0C0D0E2405022413010E57503F202A5A72

So, to sum things up; 所以,总结一下; if you want to have a peer-to-peer setup between two dual-mode Bluetooth devices, using BOTH Bluetooth Classic profiles AND Bluetooth Smart services/characteristics, you should use GATT over BR/EDR, which is no-go for Apple-devices, but might be supported by Android (don't know, will port app to Android eventually though, but regardless it's not a big deal for Android since worst-case will imply a fallback to SPP and a simple byte-protocol to do the work that I need to get done). 如果你想在两个双模蓝牙设备之间建立点对点设置,使用BOTH蓝牙经典配置文件和蓝牙智能服务/特性,你应该使用GATT over BR / EDR,这对Apple设备来说是不行的,但可能会得到Android的支持(不知道,最终会将应用程序移植到Android上,但不管它对Android来说不是什么大不了,因为最糟糕的情况将意味着回退到SPP和简单的字节协议来完成工作我需要完成)

That's that. 就是这样。 Hope that I've helped someone ;) /Markus 希望我帮助过某人;)/ Markus

You learn as long as you live, I suppose, and this question's answer is NOT that it's not supported which I claimed earlier (based on what I thought I knew). 我想,只要你活着,你就会学到,这个问题的答案并不是我之前所声称的不支持(基于我认为我所知道的)。

The short and clean answer to dual-mode and headset development on CSR-chipsets is simply that it was a constraint in the CSR bluetooth stack on earlier SDKs. 对CSR芯片组进行双模式和耳机开发的简短而干净的答案就是它在早期SDK上的CSR蓝牙堆栈中的限制。

The Bluetooth SIG has never not supported dual-mode acting as Peripheral while being connected via classic links to the same device. Bluetooth SIG从未通过经典链路连接到同一设备,从未支持双模作为外设。 On the contrary, it clearly spec. 相反,它明确规范。 how such interoperability should be carried out -- but that doesn't always mean that all BT-stack implementations out there are capable of such functionality. 应该如何进行这种互操作性 - 但这并不总是意味着所有BT-stack实现都具备这种功能。

Hence; 因此, Using the latest devtools and the latest Bluetooth firmwares/stacks from CSR has resolved all issues and dual-mode is now fully, and actually quite nicely I might add, supported on the CSR8670/75 chipsets. 使用最新的devtools和CSR的最新蓝牙固件/堆栈已经解决了所有问题,双模现在已经完全,而且实际上我可以添加,很好地支持CSR8670 / 75芯片组。

I am also using the CSR8670 device. 我也在使用CSR8670设备。 It have it working. 它有效。 Both a BLE peripheral and audio. BLE外设和音频。

You need to be using ADK 4.0.0 by CSR. 您需要使用CSR的ADK 4.0.0。

Bluetooth 4.1 and Bluetooth 4.0 are different. 蓝牙4.1和蓝牙4.0是不同的。 For what you said about Bluetooth 4.0 is correct, but your chip can do Bluetooth 4.1. 对于你所说的蓝牙4.0是正确的,但你的芯片可以做蓝牙4.1。

4.1 allows such connections. 4.1允许这样的连接。

I also added "Dual mode" flags to the advertising packet. 我还在广告包中添加了“双模式”标志。

There are a few conditions, such as a connection Interval of at least 90 miliseconds highly recommended so you dont mess with the audio. 有一些条件,例如强烈推荐的连接间隔至少90毫秒,所以你不要乱用音频。

Good luck! 祝好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM