蓝牙AVCTP协议

转自: 蓝牙音视频控制协议(AVCTP)介绍-CSDN博客

AVDTP Spec下载: A/V Distribution Transport Protocol | Bluetooth® Technology Website

1. AVCTP概念

AVCTP(Audio/Video Control Transport Protocol)协议描述了蓝牙设备间Audio/Video的控制信号交换的格式和机制,它是一个总体的协议,具体的控制信息由其指定的协议(如AVRCP)实现,AVCTP本身只指定控制command和response的总体的格式。

几个重要的点:

(1) AVCTP uses point-to-point signaling over connection-oriented L2CAP channels.

(2) AVCTP shall be able to support both controller and target functionalities at both sides of the connection.

(3) Between two devices, multiple AVCTP connections may exist. Each AVCTP connection has its own L2CAP channel with its unique PSM value. There shall be only one AVCTP connection per PSM per ACL.

(4) Each AVCTP packet shall be transported on a single L2CAP packet.

(5) 不同L2CAP channel上的相同的transaction Label是属于不同的message的。也就是说,两条L2CAP上的packets是没有关系的,不可能属于同一个message。AVCTP整个框架如下:

以上图示我继续做了细化,在整个协议栈的结构如红框:

可以看到AVCTP是基于L2CAP协议的,他有两组PSM,分别如下:

2. AVCTP封包格式

AVCTP封包格式分为两种:

  1. 没有被分隔的(小于L2CAP MTU)
  2. 被分隔的(大于L2CAP MTU)

下面我们来分别介绍下每种的格式

2.1 没有被分隔的AVCTP

Transaction label field: (octet 0, bits 7-4) value is provided by the application.传输标示,由上层提供

Packet_type field:(octet 0, bits 3 and 2) is set to zero to indicate that the command/response message is transmitted in a single L2CAP packet.此部分00b标示没有被分割.

C/R: (octet 0, bit 1) indicates whether the message conveys a command frame (0) or a response frame (1). It is provided by the application.0代表command,1代表response

IPID :bit (octet 0, bit 0) is set in a response message to indicate an invalid profile identifier received in the command message of the same transaction; otherwise this bit is set to zero. In command messages this bit is set to zero.在command中设置为0,在response中设置为0代表正常PID

Profile Identifier (PID): field indicates that the command/response frame is coded according to the rules defined by the identified profile. The value shall be identical to the bits UUID of the service class,此部分填写16bit的UUID,比如AVRCP的UUID 0x110e

后续的Message Infomation就是上层协议的数据

2.2 被分隔的AVCTP

被分隔的的数据包格式一共有三种

我们在这里只介绍两个地方,其他跟没有被分隔的一致:

1)Packet_type:The Packet_Type field (see Section 6.1.2) qualifies each L2CAP packet as either first (Packet_Type=01), continue (Packet_Type=10), or end packet (Packet_Type=11). In the case of a nonfragmented message (see Section 6.1.1), this field (Packet_Type=00) simply indicates

that the message fits into a single packet and the number of  packets is not inserted in the message.

总结下:开始封包是01b,继续封包10b,结束封包是11b

2)Number of AVCTP Packets is present in every start packet (octet 2 ) to indicate the total number of AVCTP packets that belong to the same message. As the start packet is also counted, this value is always greater than 1.

总结下:标示整个分隔封包的数量,包含这个开始封包,所以此封包的个数肯定是大于1的。

示意图如下:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值