当前位置:网站首页>Bluetooth development (8) -- avdtp connection process
Bluetooth development (8) -- avdtp connection process
2022-06-11 00:09:00 【yuanyun_ elber】
At the end of the previous chapter , We see a avdtp Of l2cap channel It's set up , Next avdtp You can start walking .
Avdtp The document of is another 140 A multi page behemoth , There are still a lot of things to see .
Avdtp yes a2dp(advanced audio distribution protocol) The basic agreement of , Generally speaking ,avdtp Of l2cap channel It is necessary to establish two , Here we first establish the first , That is to say signal channel( This is the same as l2cap Of signal channel So close , Broadly , It can be said that signal channel The function of the is to control ), Then there is another one stream channel, As the name suggests, it is used to transmit code stream .
Let's take a look avdtp signal Connection process , Actually sum l2cap The connection process of is quite similar ,l2cap It is the equipment of both parties that must determine the other party cid, Then configure it , After friendly negotiation , Establishing a connection .
Avdtp There is one sep The concept of ,stream end point, Each device is virtualized with several sep( It's usually 1 individual ), Every sep To distribute independently seid, Be similar to l2cap Of cid, It's just sep、seid It's a preset , and cid It is dynamically allocated during connection .
When connecting , First, through discover The command found several peer devices sep, Every sep The type of media (audio?video?multi?), Let's say , The local sep It's a audio sink( Audio playback device , For example, speakers ), distant sep It's a audio source( Sound source equipment , For example, mobile phones ), So these two sep You can connect .
Here's the picture , Send this discover The command is actually two bytes , But two bytes are taken in bits , Contains a lot of information , for instance transaction,packet type It's a single,message type yes command wait , Let's not talk about this . Insert a sentence , there packet type Subcontracting is also supported , except single outside , also start ,continue,end package , Is it very similar to l2cap The subcontracting mechanism of ? But it's basically useless here ,signal channel Your bag is usually very small .

Then the remote end replied , The other party has 6 individual sep, Every sep The types of audio src, You can take a look at each sep There are distributive opposites seid Of .

Next get capability and set configuration The process is similar to l2cap Configuration process , First INT End ( launch avdtp The party connected is called INT) towards ACP End ( Accept avdtp One side of the connection ) send out get capability command:

Then the other party replies with support codec Information , Including the encoding format is sbc( bluetooth sink It is an option that must be supported by default ), Sampling rate 、 Compression ratio, etc , It's all about audio .

INT End receipt ACP After the end information , And local capablity Perform an operation with ,( Usually the upper floor profile To do it ), Then proceed to the final configuration

Received the following message ACP After receiving the configured message , The configuration process is complete .

Next , To get into stream establishment The stage of .
First ,INT send out stream OPEN command

When you receive a reply , Enter key operations , We can build stream channel 了 , It's called transport session,avdtp Stipulated tranport session It's not just stream channel, There may be recovery channel and report channel, Although the latter two are not commonly used , Let's just cut in .Report channel As the name suggests, it is used for reporting , The report includes some statistical information 、 Time alignment 、 Channel quality, etc , To help the upper software have a better strategy for error recovery .
Recovery channel And error correction , Bluetooth transmission is reliable , It can also be said to be unreliable .
Reliable because it has ARQ Retransmission mechanism , Unreliable because this retransmission is not unlimited , Especially for acl Link , There is one flush timeout Of , We mentioned it before l2cap Configuration process , Speaking of MTU This option , I want to mention flush timeout This option , If this option is set , Then it means that there is an upper limit to the emphasis on transmission , When the upper limit is exceeded , If retransmission has not been successful , The package will be removed . Error correction code provided by Bluetooth itself FEC Functional limitation , therefore avdtp There is one recovery channel Further provide error correction function .
Idle time , establish stream channel And establish signal channel It's the same thing ,l2cap channel A set of processes established .

When stream channel When it's set up , as long as signal channel issue start command , It means playing music , Can be in stream channel Up pass stream Code stream , Follow another set RTP The format of (real-time transport protocol), I won't repeat . Here's the picture , This is a bag stream data , Contains 7 frame , Probably 20 many ms The data of .

In the middle of the song , You can also pause 、 Reconfiguration, etc , through signal channel Issue the corresponding command suspend、reconfigure wait .
The basic process is like the following figure :

The format is too complicated , We are not going to analyze them one by one ,spec All of them have , I just picked up the outline . In the next chapter, we will further analyze the code .
边栏推荐
- [new version] new pseudo personal homepage v2.0- starze V Club
- Four ways to add names to threads in the thread pool
- LabVIEW performs a serial loopback test
- 【无标题】
- LabVIEW programming specification
- After deepin20 menu startup option, the self-test indicates that iwlwwifi is stopped
- 【Pygame合集】滴~穿越童年游戏指南 请查收:这里面有你玩过的游戏嘛?(附五款源码自取)
- 安全生产月,黄埔开展燃气安全进商铺宣传活动
- 【Pygame小游戏】Chrome上的小恐龙竟可以用代码玩儿了?它看起来很好玩儿的样子~
- LabVIEW phase locked loop (PLL)
猜你喜欢

LabVIEW phase locked loop (PLL)

【AI出牌器】第一次见这么“刺激”的斗地主,胜率高的关键因素竟是......

vtk.js中vtp下载

csdn每日一练——有序表的折半查找
![[pyGame games] tank battle, how many childhood games do you remember?](/img/30/951fdbb944e026701af08c0c068cd8.png)
[pyGame games] tank battle, how many childhood games do you remember?

LabVIEW get IMAQ get last event coordinates

From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time

【Pygame小游戏】别找了,休闲游戏专题来了丨泡泡龙小程序——休闲游戏研发推荐

From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time

From the perspective of Confucius Temple IP crossover, we can see how the six walnuts become "butterflies" for the second time
随机推荐
【Turtle表白合集】“海底月是天上月,眼前人是心上人。”余生多喜乐,长平安~(附3款源码)
上海炒股开户是安全的吗?
Error report of curl import postman
In the month of safety production, Huangpu launched a publicity campaign for gas safety in shops
归并排序
vtk. VTP download in JS
[pyGame] can the little dinosaur on chrome be played with code? It looks like fun~
[pyGame] stir up your brain and play the "24 o'clock" idea together ~ (awesome)
curl导入postman报错小记
IGBT and third generation semiconductor SiC double pulse test scheme
[pyGame games] interesting puzzle game: how many hamsters can you play? (source code attached)
[pyGame] this "groundhog" game is going to be popular (come on, come on)
Difference between oscilloscope and spectrum analyzer
Is it safe for changtou school to open an account? Is it reliable?
【Pygame小游戏】首月破亿下载 一款高度融合了「超休闲游戏特性」的佳作~
第一章 总论-会计基础
Typecho blog site wide deployment of Tencent cloud CDN tutorial - Xingze V Club
都说验证码是爬虫中的一道坎,看我只用五行代码就突破它。
Wireshake introduction learning notes
[auto reply or remind assistant] Mom doesn't have to worry about me missing messages any more (10 Line Code Series)