蓝牙4.0的LM层说明

1.概念

The Link Manager Protocol (LMP) is used to control and negotiate all aspects of the operation of the Bluetooth connection between two devices. This includes the set-up and control of logical transports and logical links, and for control of physical links.简单的说,就是控制basebandc层的Logical transports和Logical links的:
蓝牙4.0的LM层说明
注意:LMP的msg在ACL-C上传输。另外,LMP 的SMG不含有任何的错误检测。
 
2.Packet Format
LMP的SDU有两种形式,使用ACL-C的DM1格式:
蓝牙4.0的LM层说明
LMP的msg以transaction的形式进行传输,拥有重要参数transaction ID:
0:master发起transaction
1:slaver发起transaction
同一组对话有相同的transaction ID。
 
3.LMP MSGs
定义了四种General response messages:
蓝牙4.0的LM层说明
一些限制:
LMP MSGs不能超过DM1的17byte的packet长度(因为在ACL-C上创术嘛);
所有LM的MSGs都是固定长度(park状态下的广播除外)。
 
4.DEVICE FEATURES
蓝牙Device定义了诸多的Device Feature,LMP传输MSG时,必须确定双方是否支持这些Feature。具体参考SPec的465-470.用Feature Mask来表示是否支持某些device feature。定义如下(只是一部分):
蓝牙4.0的LM层说明
蓝牙4.0的LM层说明


5. LMP的Rules
这段讲述一些LMP应用的规则。下图是LMP连接建立的过程:
蓝牙4.0的LM层说明

一些LMP上常用的PDU:
蓝牙4.0的LM层说明
蓝牙4.0的LM层说明

蓝牙4.0的LM层说明

蓝牙4.0的LM层说明

蓝牙4.0的LM层说明
这里不一一叙述,还有很多常用的PDU,参考Spec。
 
6.INFORMATIONAL REQUESTS
用来获取对方设备的相关信息。
(1)Timing Accuracy
蓝牙4.0的LM层说明
(2)Clock Offset
蓝牙4.0的LM层说明

(3)LMP version
蓝牙4.0的LM层说明
(4)Supported Features
蓝牙4.0的LM层说明

(5)Name Request
蓝牙4.0的LM层说明

7.MODES OF OPERATION
LMP的模式(connection、park、sniff等)的转换过程。
(1)Hold Mode
蓝牙4.0的LM层说明
Master Forces Hold Mode:
蓝牙4.0的LM层说明
Slave Forces Hold Mode:
蓝牙4.0的LM层说明
Master or Slave requests Hold Mode:
蓝牙4.0的LM层说明

其余sniff、park等都是相似的过程。
 
8.LOGICAL TRANSPORTS
    When a connection is first established between two devices the connection consists of the default ACL logical links: ACL-C (for LMP messages) and ACLU (for L2CAP data.) One or more synchronous logical transports (SCO or eSCO) may then be added. A new logical transport shall not be created if itwould cause all slots to be allocated to reserved slots on secondary LT_ADDRs.
SCO Logical Transport
蓝牙4.0的LM层说明
SCO packet支持语音编码格式PCM和CVSD。Tsco, Dsco and a flag决定SCO周期使用的slots。
Master Initiates an SCO Link:
蓝牙4.0的LM层说明
Slave Initiates an SCO Link:
蓝牙4.0的LM层说明
蓝牙4.0的LM层说明
 
9.简单总结
LMP的数据建立在ACL-C上,以transaction的形式进行联系,LMP的PDU结构很简单,为Opcode+payLoad形式,分7bit的Opcode和15bit的Opcode两种形式。LMP的传输须知道device feature,在支持的情况下才可以传输响应的MSG。
原文地址:https://www.cnblogs.com/senior-engineer/p/9842369.html