Core v6.0 Vol3
Core v6.0 Vol3
Volume 3
LOGICAL LINK
CONTROL AND
ADAPTATION PROTOCOL
SPECIFICATION
CONTENTS
8.6.1.5 Functions of the Poll (P) and Final (F) bits . 1204
8.6.2 Rules for timers .......................................................... 1204
8.6.2.1 Timer rules for ACL-U logical links ............. 1205
8.6.2.2 [This section is no longer used] ................. 1205
8.6.2.3 [This section is no longer used] ................. 1205
8.6.3 General rules for the state machine .......................... 1205
8.6.4 State diagram ............................................................ 1206
8.6.5 States tables .............................................................. 1207
8.6.5.1 State machines .......................................... 1207
8.6.5.2 States ......................................................... 1208
8.6.5.3 Variables and timers ................................... 1208
8.6.5.4 Events ........................................................ 1211
8.6.5.5 Conditions .................................................. 1212
8.6.5.6 Actions ....................................................... 1214
8.6.5.7 XMIT state table ......................................... 1219
8.6.5.8 WAIT_F state table .................................... 1220
8.6.5.9 RECV state table ........................................ 1220
8.6.5.10 REJ_SENT state table ............................... 1224
8.6.5.11 SREJ_SENT state table ............................. 1227
8.7 Streaming mode ........................................................................ 1231
8.7.1 Transmitting I-frames ................................................. 1231
8.7.2 Receiving I-frames ..................................................... 1231
8.7.3 Exception conditions .................................................. 1232
8.7.3.1 TxSeq sequence error ................................ 1232
1 INTRODUCTION
This section of the Bluetooth Specification defines the Logical Link Control and
Adaptation Layer Protocol, referred to as L2CAP. L2CAP provides connection-oriented
and connectionless data services to upper layer protocols with protocol multiplexing
capability and segmentation and reassembly operation. L2CAP permits higher level
protocols and applications to transmit and receive upper layer data packets (L2CAP
Service Data Units, SDU) up to 64 kilobytes in length. L2CAP also permits per-channel
flow control and retransmission.
The L2CAP layer provides logical channels, named L2CAP channels, which are
multiplexed over one or more logical links.
1. BR/EDR Controller
2. BR/EDR/LE Controller (supporting BR/EDR and LE)
3. LE Controller (supporting LE only)
Figure 1.1 breaks down L2CAP into its architectural components. The Channel
Manager provides the control plane functionality and is responsible for all internal
signaling, L2CAP peer-to-peer signaling and signaling with higher and lower layers.
It performs the state machine functionality described in Section 6 and uses message
formats described in Section 4, and Section 5. The Retransmission and Flow Control
block provides per-channel flow control and error recovery using packet retransmission.
The Resource Manager is responsible for providing a frame relay service to the
Channel Manager, the Retransmission and Flow Control block and those application
data streams that do not require Retransmission and Flow Control services. It is
responsible for coordinating the transmission and reception of packets related to
multiple L2CAP channels over the facilities offered at the lower layer interface.
data
data
Upper data control
layer
(SDUs)
Segmentation (Reassembly )
Resource
Manager
Channel
Retransmission & Flow Control
L2CAP Manager
(commands)
layer Encapsulation & Scheduling
(PDUs)
Fragmentation (Recombination)
(f ragments)
• Protocol/channel multiplexing
L2CAP supports multiplexing over individual Controllers. An L2CAP channel shall
operate over one Controller. An L2CAP channel cannot move between Controllers.
During channel setup, protocol multiplexing capability is used to route the connection
to the correct upper layer protocol.
For data transfer, logical channel multiplexing is needed to distinguish between
multiple upper layer entities. There may be more than one upper layer entity using
the same protocol.
• Segmentation and reassembly
With the frame relay service offered by the Resource Manager, the length of
transport frames is controlled by the individual applications running over L2CAP.
Many multiplexed applications are better served if L2CAP has control over the PDU
length. This provides the following benefits:
a. Segmentation will allow the interleaving of application data units in order to
satisfy latency requirements.
b. Memory and buffer management is easier when L2CAP controls the packet size.
c. Error correction by retransmission can be made more efficient.
d. The amount of data that is destroyed when an L2CAP PDU is corrupted or lost
can be made smaller than the application's data unit.
e. The application is decoupled from the segmentation required to map the
application packets into the lower layer packets.
• Flow control per L2CAP channel
Controllers provide error and flow control for data going over the air and HCI flow
control exists for data going over an HCI transport. When several data streams run
over the same Controller using separate L2CAP channels, each channel requires
individual flow control. A window based flow control scheme is provided.
• Error control and retransmissions
Some applications require a residual error rate much smaller than some Controllers
can deliver. L2CAP provides error checks and retransmissions of L2CAP PDUs. The
error checking in L2CAP protects against errors due to Controllers falsely accepting
packets that contain errors but pass Controller-based integrity checks. L2CAP error
checking and retransmission also protect against loss of packets due to flushing
by the Controller. The error control works in conjunction with flow control in the
sense that the flow control mechanism will throttle retransmissions as well as first
transmissions.
• Support for Streaming
Streaming applications such as audio set up an L2CAP channel with an agreed-upon
data rate and do not want flow control mechanisms, including those in the Controller,
to alter the flow of data. A flush timeout is used to keep data flowing on the transmit
side. Streaming mode is used to stop HCI and Controller based flow control from
being applied on the receiving side.
• Fragmentation and Recombination
Some Controllers may have limited transmission capabilities and may require
fragment sizes different from those created by L2CAP segmentation. Therefore layers
below L2CAP may further fragment and recombine L2CAP PDUs to create fragments
which fit each layer’s capabilities. During transmission of an L2CAP PDU, many
different levels of fragmentation and recombination may occur in both peer devices.
The HCI driver or Controller may fragment L2CAP PDUs to honor packet size
constraints of a Host Controller Interface transport scheme. This results in HCI ACL
Data packet payloads carrying start and continuation fragments of the L2CAP PDU.
Similarly the Controller may fragment L2CAP PDUs to map them into Controller
packets. This may result in Controller packet payloads carrying start and continuation
fragments of the L2CAP PDU.
Each layer of the protocol stack may pass on different sized fragments of L2CAP
PDUs, and the size of fragments created by a layer may be different in each peer
device. However the PDU is fragmented within the stack, the receiving L2CAP entity
still recombines the fragments to obtain the original L2CAP PDU.
• Quality of Service
The L2CAP connection establishment process allows the exchange of information
regarding the quality of service (QoS) expected between two Bluetooth devices. Each
L2CAP implementation monitors the resources used by the protocol and ensures that
QoS contracts are honored.
For a BR/EDR or BR/EDR/LE Controller, L2CAP may support both isochronous
(Guaranteed) and asynchronous (Best Effort) data flows over the same ACL logical
link by marking packets as automatically-flushable or non-automatically-flushable by
setting the appropriate value for the Packet_Boundary_Flag in the HCI ACL Data
packet (see [Vol 4] Part E, Section 5.4.2). Automatically-flushable L2CAP packets
are flushed according to the automatic flush timeout set for the ACL logical link
on which the L2CAP channels are mapped (see [Vol 4] Part E, Section 6.19).
Non-automatically-flushable L2CAP packets are not affected by the automatic flush
timeout and will not be flushed. All L2CAP packets can be flushed by using the
HCI_Flush command (see [Vol 4] Part E, Section 7.3.4).
Note: The terms "Guaranteed" and "Best Effort" are used as a shorthand to
indicate that the implementation will or will not attempt to provide some level of
quality of service. They do not make any statement as to what actual quality is
provided; in particular, "Guaranteed" does not mean that successful delivery of data
is guaranteed. Similarly, a "guarantee" is a set of resources (such as bandwidth and
buffer space) allocated to a "Guaranteed" connection and does not mean that a
specific data rate and latency will be provided under all possible circumstances.
1.2 Assumptions
The protocol is designed based on the following assumptions:
1.3 Scope
The following features are outside the scope of L2CAP’s responsibilities:
• L2CAP does not transport synchronous data designated for SCO or eSCO logical
transports.
• L2CAP does not support a reliable broadcast channel. See Section 3.2.
1.4 Terminology
The following formal definitions apply:
Term Description
Upper layer The system layer above the L2CAP layer, which exchanges data with L2CAP in
the form of SDUs. The upper layer may be represented by an application or higher
protocol entity known as the Service Level Protocol. The interface of the L2CAP layer
with the upper layer is not specified.
Lower layer The system layer below the L2CAP layer, which exchanges data with the L2CAP lay-
er in the form of PDUs, or fragments of PDUs. The lower layer is mainly represented
within the Controller, however a Host Controller interface (HCI) may be involved, such
that an HCI Host driver could also be seen as the lower layer. Except for the HCI
functional specification (in case HCI is involved) the interface between L2CAP and the
lower layer is not specified.
L2CAP chan- The logical connection between two endpoints in peer devices, characterized by their
nel Channel Identifiers (CID), which is multiplexed over one Controller based logical link.
Term Description
SDU, or Service Data Unit: a packet of data that L2CAP exchanges with the upper layer and
L2CAP SDU transports transparently over an L2CAP channel using the procedures specified here.
The term SDU is associated with data originating from upper layer entities only, i.e.
does not include any protocol information generated by L2CAP procedures.
Segment, or A part of an SDU, as resulting from the Segmentation procedure. An SDU may be
SDU segment split into one or more segments.
Note: This term is relevant only to Enhanced Retransmission mode, Streaming mode,
Retransmission mode, Flow Control mode, LE Credit Based Flow Control mode, and
Enhanced Credit Based Flow Control mode, not to the Basic L2CAP mode.
Segmentation A procedure used in the L2CAP Retransmission and Flow Control modes, resulting in
an SDU being split into one or more smaller units, called Segments, as appropriate
for the transport over an L2CAP channel.
Note: This term is relevant only to the Enhanced Retransmission mode, Streaming
mode, Retransmission mode, Flow Control mode, LE Credit Based Flow Control
mode, and Enhanced Credit Based Flow Control mode, not to the Basic L2CAP
mode.
Reassembly The reverse procedure corresponding to Segmentation, resulting in an SDU being
re-established from the segments received over an L2CAP channel, for use by the
upper layer. The interface between the L2CAP and the upper layer is not specified;
therefore, reassembly may actually occur within an upper layer entity although it is
conceptually part of the L2CAP layer.
Note: This term is relevant only to Enhanced Retransmission mode, Streaming mode,
Retransmission mode, Flow Control mode, LE Credit Based Flow Control mode, and
Enhanced Credit Based Flow Control mode, not to the Basic L2CAP mode.
PDU, or Protocol Data Unit: a packet of data containing L2CAP protocol information fields,
L2CAP PDU control information, and/or upper layer information data. A PDU is always started by
a Basic L2CAP header. Types of PDUs are: B-frames, I-frames, S-frames, C-frames,
G-frames, and K-frames.
Basic L2CAP Minimum L2CAP protocol information that is present in the beginning of each PDU: a
header PDU length field and a field containing the Channel Identifier (CID).
Basic infor- A B-frame is a PDU used in the Basic L2CAP mode for L2CAP data packets. It
mation frame contains a complete SDU as its payload, encapsulated by a Basic L2CAP header.
(B‑frame)
Information An I-frame is a PDU used in Enhanced Retransmission mode, Streaming mode,
frame Retransmission mode, and Flow Control mode. It contains an SDU segment and
(I‑frame) additional protocol information, encapsulated by a Basic L2CAP header.
Supervisory An S-frame is a PDU used in Enhanced Retransmission mode, Retransmission mode,
frame and Flow Control mode. It contains protocol information only, encapsulated by a Basic
(S‑frame) L2CAP header, and no SDU data.
Control frame A C-frame is a PDU that contains L2CAP signaling messages exchanged between
(C‑frame) the peer L2CAP entities. C-frames are exclusively used on the L2CAP signaling
channels.
Term Description
Group frame A G-frame is a PDU exclusively used on the Connectionless L2CAP channel. It
(G‑frame) is encapsulated by a Basic L2CAP header and contains the PSM followed by the
completed SDU. G-frames may be used to broadcast data to active Peripherals via
Active Peripheral Broadcast or to send unicast data to a single remote device.
Credit-based A K-frame is a PDU used in LE Credit Based Flow Control mode and Enhanced
frame Credit Based Flow Control mode. It contains an SDU segment and additional protocol
(K‑frame) information, encapsulated by a Basic L2CAP header.
Fragment A part of a PDU, as resulting from a fragmentation operation. Fragments are used
only in the delivery of data to and from the lower layer. They are not used for peer-to-
peer transportation. A fragment may be a Start or Continuation Fragment with respect
to the L2CAP PDU. A fragment does not contain any protocol information beyond the
PDU; the distinction of start and continuation fragments is transported by lower layer
protocol provisions.
Note: Start Fragments always either begin with the first octet of the Basic L2CAP
header of a PDU or they have a length of zero (see [Vol 2] Part B, Section 6.6.2).
Fragmenta- A procedure used to split L2CAP PDUs to smaller parts, named fragments, appropri-
tion ate for delivery to the lower layer transport. Although described within the L2CAP
layer, fragmentation may actually occur in an HCI Host driver, and/or in a Controller,
to accommodate the L2CAP PDU transport to HCI ACL Data packet or Controller
packet sizes.
Fragmentation of PDUs may be applied in all L2CAP modes.
Recombina- The reverse procedure corresponding to fragmentation, resulting in an L2CAP PDU
tion re-established from fragments. In the receive path, full or partial recombination opera-
tions may occur in the Controller and/or the Host, and the location of recombination
does not necessarily correspond to where fragmentations occurs on the transmit side.
Maximum The maximum size of an SDU, in octets, that the upper layer entity is capable of
Transmission accepting.
Unit (MTU)
Payload Size The amount of SDU data in a single PDU, in octets; equivalently, the number of octets
in the Information Payload field of a PDU.
Maximum The maximum payload size in octets that the L2CAP layer entity is capable of accept-
PDU payload ing.
Size (MPS) In the absence of segmentation, or in the Basic L2CAP mode, the Maximum Trans-
mission Unit is the same as the Maximum PDU payload Size and the two configura-
tion parameters shall be set to the same value.
Signaling The maximum size of command information that the L2CAP layer entity is capable of
MTU (MTUsig) accepting. The MTUsig, refers to the signaling channel only and corresponds to the
maximum size of a C-frame, excluding the Basic L2CAP header. The MTUsig value of
a peer is discovered when a C-frame that is too large is rejected by the peer.
Term Description
Connection- The maximum size of the connection packet information that the L2CAP layer entity is
less MTU capable of accepting. The MTUcnl refers to the connectionless channel only and cor-
(MTUcnl) responds to the maximum G-frame, excluding the Basic L2CAP header and the PSM
which immediately follows it. The MTUcnl of a peer can be discovered by sending an
L2CAP_INFORMATION_REQ packet.
MaxTransmit In Enhanced Retransmission mode and Retransmission mode, MaxTransmit controls
the number of transmissions of a PDU that L2CAP is allowed to try before assuming
that the PDU (and the link) is lost. The minimum value is 1 (only 1 transmission per-
mitted). In Enhanced Retransmission mode a value 0 means infinite transmissions.
Note: Setting MaxTransmit to 1 prohibits PDU retransmissions. Failure of a single
PDU will cause the link to drop. By comparison, in Flow Control mode, failure of a
single PDU will not necessarily cause the link to drop.
2 GENERAL OPERATION
L2CAP is based around the concept of ’channels’. Each one of the endpoints of an
L2CAP channel is referred to by a channel identifier (CID).
The characteristics of each fixed channel are defined on a per channel basis. Fixed
channel characteristics include configuration parameters (e.g., reliability, MTU size,
QoS), security, and the ability to change parameters using the L2CAP configuration
mechanism. Table 2.1 lists the defined fixed channels, provides a reference to where
the associated channel characteristics are defined and specifies the logical link over
which the channel may operate. Fixed channels are available as soon as the ACL-U or
LE-U logical link is set up. All initialization that is normally performed when a channel is
created shall be performed for each of the supported fixed channels when the ACL-U or
LE-U logical link is set up. Fixed channels shall only run over ACL-U, APB-U, or LE-U
logical links.
Implementations are free to manage the remaining CIDs in a manner best suited for
that particular implementation, with the provision that two simultaneously active L2CAP
channels on the same logical link (i.e., to the same peer device using the same
transport) shall not share the same CID. A different CID name space exists for each
ACL-U, APB-U, and LE-U logical link. Table 2.1 to Table 2.3 summarize the definition
and partitioning of the CID name space for each type of logical link.
L2CAP L2CAP
multiplexer multiplexer
Address may be
equal
There are also a number of CIDs reserved for special purposes. The L2CAP signaling
channels are examples of reserved channels. Fixed channel 0x0001 is used to create
and establish connection-oriented data channels and to negotiate changes in the
characteristics of connection-oriented channels and to discover characteristics of the
connectionless channel operating over the ACL-U logical link.
The L2CAP Signaling channel (0x0001) and all supported fixed channels are available
immediately when the ACL-U logical link is established between two devices. Another
CID (0x0002) is reserved for all incoming and outgoing connectionless data traffic,
whether broadcast or unicast. Connectionless data traffic may flow immediately once
the ACL-U logical link is established between two devices and once the transmitting
device has determined that the remote device supports connectionless traffic.
The L2CAP LE Signaling channel (0x0005) and all supported fixed channels are
available immediately when the LE-U logical link is established between two devices.
CID
CID
CID
CID
L2CAP L2CAP L2CAP
Entity Entity Entity
CID
CID
CID
Device #1 CID CID
Device #2
CID CID
L2CAP L2CAP
Entity Entity
Device #3 Device #4
Table 2.4 describes the various channel types and their source and destination
identifiers. A dynamically allocated CID is allocated to identify, along with the logical
link, the local endpoint and shall be in the range 0x0040 to 0xFFFF for ACL-U,
0x0040 to 0x007F for LE-U. Section 6 describes the state machine associated with
each connection-oriented channel with a dynamically allocated CID. Section 3.1 and
Section 3.3 describe the packet format associated with connection-oriented channels.
Section 3.2 describes the packet format associated with the connectionless channel.
also be prepared to accept certain types of events from lower layers and generate
events to upper layers. How these events are passed between layers is implementation
specific.
Upper Layer
L2CAP Layer
Lower Layer
The modes are enabled using the configuration procedure described in Section 7.1.
The Basic L2CAP mode shall be the default mode, which is used when no other
mode is agreed. Enhanced Retransmission mode shall be used for ACL-U logical
links operating as described in Section 7.10. Enhanced Retransmission mode should
be enabled for reliable channels created over ACL-U logical links not operating as
described in Section 7.10. Streaming mode shall be used for ACL-U logical links
operating as described in Section 7.10. Streaming mode should be enabled for
streaming applications created over ACL-U logical links not operating as described in
Section 7.10. Enhanced Retransmission mode, Enhanced Credit Based Flow Control
mode, or Streaming mode should be enabled when supported by both L2CAP
entities. Flow Control mode and Retransmission mode shall only be enabled when
communicating with L2CAP entities that do not support Enhanced Retransmission
mode, Enhanced Credit Based Flow Control mode, or Streaming mode.
In Flow Control mode no retransmissions take place, but missing PDUs are detected
and can be reported as lost.
In Retransmission mode a timer is used to ensure that all PDUs are delivered to the
peer, by retransmitting PDUs as needed. A go-back-n repeat mechanism is used to
simplify the protocol and limit the buffering requirements.
Streaming mode is for real-time isochronous traffic. PDUs are numbered but are not
acknowledged. A finite flush timeout is set on the sending side to flush packets that are
not sent in a timely manner. On the receiving side if the receive buffers are full when
a new PDU is received then a previously received PDU is overwritten by the newly
received PDU. Missing PDUs can be detected and reported as lost. TxWindow size is
not used in Streaming mode.
Enhanced Credit Based Flow Control mode is used for L2CAP connection-oriented
channels on both LE and BR/EDR for flow control using a credit-based scheme
for L2CAP data (i.e. not signaling packets). A BR/EDR/LE device that implements
Enhanced Credit Based Flow Control mode may support it on BR/EDR only, on LE only,
or on both.
Care should be taken in selecting the parameters used for Enhanced Retransmission
mode and Streaming mode when they are used beneath legacy profile implementations
to ensure that performance is not negatively impacted relative to the performance
achieved when using the same profile with Basic mode on an ACL-U logical link. It
may be preferable to configure Basic mode to minimize the risk of negative performance
impacts.
All Best Effort and Guaranteed channels going over a BR/EDR physical link between
two devices shall be mapped to a single ACL-U logical link. All channels going over an
LE physical link between two devices shall be treated as best effort and mapped to a
single LE-U logical link.
If a PDU is received on a CID that is not assigned or is reserved for future use on the
logical link type, the recipient shall ignore that PDU.
In all L2CAP PDUs, the PDU Length field indicates the size of the entire L2CAP PDU in
octets, excluding the 4 octets of the Basic L2CAP header. Therefore a PDU cannot be
more than 65539 octets long.
In PDUs that contain an Information Payload field, the number of octets in that field (the
payload size) shall not be greater than the peer device's MPS for the channel.
Basic L2CAP
header
PDU Channel
Length ID Information payload
LSB 16 16 MSB
Figure 3.1: L2CAP PDU format in Basic L2CAP mode on connection-oriented channels (field sizes in bits)
Basic L2CAP
header
PDU
0x0002 PSM Information payload
Length
LSB 16 16 ≥16 MSB
Group frame (G-frame)
Note: The maximum size of the Information payload field decreases accordingly if the
PSM field is extended beyond the two octet minimum.
Basic L2CAP
header
PDU Channel
Control3 FCS1
Length ID
LSB 16 16 16 or 32 0 or 16
MSB
Supervisory frame (S-frame)
Basic L2CAP
header
L2CAP
PDU Channel
Control3 SDU, Information Payload FCS1
Length ID
Length2
LSB 16 16 16 or 32 0 or 16 0 or 16
MSB
Information frame (I-frame)
1
FCS is optional
2
Only present in the “Start of L2CAP SDU” frame, SAR=0b01
3
Standard and Enhanced Control is 16 bits, Extended Control is 32 bits
Figure 3.3: L2CAP PDU formats in Flow Control and Retransmission modes
The maximum number of Information octets (the payload size) in one I-frame is based
on which fields are present and the type of the Control Field. The maximum number
of Information octets in an I-frame with a Standard Control field is as follows:
L2CAP SDU Length present and FCS present 65529 octets
L2CAP SDU Length present and FCS not present 65531 octets
L2CAP SDU Length not present and FCS present 65531 octets
L2CAP SDU Length not present and FCS not present 65533 octets
The Control Field identifies whether the frame is an S-frame or I-frame and contains
various information about the frame. There are three different Control Field formats:
the Standard Control Field, the Enhanced Control Field, and the Extended Control
Field. Which format is used is determined by the mode and is not indicated within the
frame. The Standard Control Field shall be used for Retransmission mode and Flow
Control mode. The Enhanced and Extended Control Fields shall be used for Enhanced
Retransmission mode and Streaming mode. The Enhanced Control Fields shall be used
until the first successful use of the Extended Window Size option (see Section 5.7) and
Extended Control Fields thereafter. The Control Field will contain sequence numbers
where applicable. Its coding is shown in Figure 3.4 to Figure 3.9. There are two different
frame types, Information frame types and Supervisory frame types. Information and
Supervisory frames types are distinguished by the least significant bit in the Control
Field.
The SAR field in the I-frame is used for segmentation and reassembly control. The
L2CAP SDU Length field specifies the length of an SDU, including the aggregate
length across all segments if segmented.
• Supervisory frame format (S-frame)
S-frames are used to acknowledge I-frames and request retransmission of I-frames.
Each S-frame has an ReqSeq sequence number which may acknowledge additional
I-frames received by the data Link Layer entity. Each S-frame with a Standard Control
Field has a retransmission bit (R bit) that affects whether I-frames are retransmitted.
Each S-frame with an Enhanced Control field or an Extended Control Field has a Poll
bit (P-bit) and a Final bit (F-bit) and does not have an R-bit.
Defined types of S-frames are RR (Receiver Ready), REJ (Reject), RNR (Receiver
Not Ready) and SREJ (Selective Reject).
• Type
The type bit shall be 0 for an I-frame and 1 for an S-frame.
• Send Sequence Number - TxSeq
The send sequence number is used to number each I-frame, to enable sequencing
and retransmission.
• Receive Sequence Number - ReqSeq
The receive sequence number is used by the receiver side to acknowledge I-frames,
and in the REJ and SREJ frames to request the retransmission of an I-frame with a
specific send sequence number.
• Retransmission Disable Bit - R
The Retransmission Disable bit is used to implement Flow Control. The receiver
sets the bit when its internal receive buffer is full, this happens when one or more
I-frames have been received but the SDU reassembly function has not yet pulled
all the frames received. When the sender receives a frame with the Retransmission
Disable bit set it shall disable the RetransmissionTimer, this causes the sender to stop
retransmitting I-frames.
R=0: Normal operation. Sender uses the RetransmissionTimer to control
retransmission of I-frames. Sender does not use the MonitorTimer.
R=1: Receiver side requests sender to postpone retransmission of I-frames.
Sender monitors signaling with the MonitorTimer. Sender does not use the
RetransmissionTimer.
The functions of ReqSeq and R are independent.
• Segmentation and Reassembly - SAR
The SAR bits define whether an L2CAP SDU is segmented. For segmented SDUs,
the SAR bits also define which part of an SDU is in this I-frame, thus allowing one
L2CAP SDU to span several I-frames.
An I-frame with SAR=”Start of L2CAP SDU” also contains an L2CAP SDU Length
field, specifying the number of information octets in the total L2CAP SDU. The
encoding of the SAR bits is shown in Table 3.1.
0b00 Unsegmented L2CAP SDU
0b01 Start of L2CAP SDU
0b10 End of L2CAP SDU
0b11 Continuation of L2CAP SDU
• Supervisory function - S
The S-bits mark the type of S-frame. There are four types defined: RR (Receiver
Ready), REJ (Reject), RNR (Receiver Not Ready) and SREJ (Selective Reject). The
encoding is shown in Table 3.2.
0b00 RR - Receiver Ready
0b01 REJ - Reject
0b10 RNR - Receiver Not Ready
0b11 SREJ - Select Reject
• Poll - P
The P-bit is set to 1 to solicit a response from the receiver. The receiver shall respond
immediately with a frame with the F-bit set to 1.
• Final - F
The F-bit is set to 1 in response to an S-frame with the P bit set to 1.
When an SDU spans more than one I-frame, the first I-frame in the sequence shall
be identified by SAR=0b01=”Start of L2CAP SDU”. The L2CAP SDU Length field shall
specify the total number of octets in the SDU and shall not be greater than the peer
device's MTU for the channel. The L2CAP SDU Length field shall be present in I-frames
with SAR=0b01 (Start of L2CAP SDU) and shall not be used in any other I-frames.
When the SDU is unsegmented (SAR=0b00), the L2CAP SDU Length field is not
needed and shall not be present.
The information payload field consists of an integer number of octets. The maximum
number of octets in this field is the same as the negotiated value of the MPS
configuration parameter. The maximum number of octets in this field also depends on
which other fields are present (see Section 3.3.1). If SAR=0b00 (Unsegmented L2CAP
SDU) then the payload size shall not be greater than the peer device's MTU for the
channel.
The FCS is constructed using the generator polynomial g(D) = D16 + D15 + D2 + 1 (see
Figure 3.10). The 16 bit LFSR is initially loaded with the value 0x0000, as depicted
in Figure 3.11. The switch S is set in position 1 while data is shifted in, LSB first for
each octet. After the last bit has entered the LFSR, the switch is set in position 2,
and the register contents are transmitted from right to left (i.e. starting with position 15,
then position 14, etc.). The FCS covers the Basic L2CAP header, Control, L2CAP SDU
Length, and Information Payload fields, if present, as shown in Figure 3.3.
2
D0 D2 D15 S D16
1
FCS out
Position 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Data in (LSB first)
Position 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
LFSR 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1. I Frame
PDU Length = 14
Channel ID = 0x0040
Control = 0x0002 (SAR=0b00, ReqSeq=0b000000, R=0, TxSeq=0b000001)
Information Payload = 00 01 02 03 04 05 06 07 08 09 (10 octets, hexadecimal
notation)
==> FCS = 0x6138
==> Data to Send = 0E 00 40 00 02 00 00 01 02 03 04 05 06 07 08 09 38 61
(hexadecimal notation)
2. RR Frame
PDU Length = 4
Channel ID = 0x0040
Control = 0x0101 (ReqSeq=0b000001, R=0, S=0b00)
==> FCS = 0x14D4
==> Data to Send = 04 00 40 00 01 01 D4 14 (hexadecimal notation)
For Retransmission mode and Flow Control mode, a received PDU shall be regarded as
invalid if one of the following conditions occurs:
For Enhanced Retransmission mode and Streaming mode the following algorithm shall
be used for received PDUs. It may be used for Retransmission mode and Flow Control
mode:
1. Check the CID. If the PDU contains an unknown CID then it shall be ignored.
2. Check the FCS. If the PDU contains an FCS error then it shall be ignored. If the
channel is configured to use "No FCS" then the PDU is considered to have a good
FCS (no FCS error).
3. Check the following conditions. If one of the conditions occurs the channel shall be
closed or in the case of fixed channels the ACL shall be disconnected.
a. I-frame with a payload size greater than the maximum PDU payload size
(MPS).
b. I-frame that has fewer than the required number of octets. If the channel is
configured to use a Standard or Enhanced Control Field then the required
number of octets is 6 if "No FCS" is configured; otherwise, it is 8. If the channel
is configured to use the Extended Control Field then the required number of
octets is 8 if "No FCS" is configured; otherwise, it is 10.
c. S-frame where the PDU Length field is invalid. If the channel is configured to
use a Standard or Enhanced Control Field then the PDU Length field shall be
2 if "No FCS" is configured; otherwise, the PDU Length field shall be 4. If the
channel is configured to use the Extended Control Field then the PDU Length
field shall be 4 if "No FCS" is configured; otherwise, the PDU Length field shall
be 6.
4. Check the SAR bits. The SAR check is performed after the frame has been
successfully received in the correct sequence. The PDU is invalid if one of the
following conditions occurs:
a. I-frame with SAR=0b01 (Start of L2CAP SDU) that has fewer than the required
number of octets. If the channel is configured to use a Standard or Enhanced
Control field then the required number of octets is 8 if "No FCS" is configured;
otherwise, the required number of octets is 10. If the channel is configured to
use an Extended Control field then the required number of octets is 10 if "No
FCS" is configured; otherwise, the required number of octets is 12.
b. I-frame with SAR bits that do not correspond to a normal sequence of either
unsegmented or start, continuation, end for the given CID.
c. I-frame with SAR= 0b01 (Start of L2CAP SDU) where the value in the L2CAP
SDU Length field exceeds the configured MTU.
5. If the I-frame has been received in the correct sequence and is invalid as described
in 4 then the channel shall be closed or in the case of fixed channels the ACL
shall be disconnected. For Streaming mode and Flow Control mode if one or
more I-frames are missing from a sequence of I-frames using SAR bits of start,
continuation and end then received I-frames in the sequence may be ignored. For
Flow Control mode and Streaming mode I-frames received out of sequence with
SAR bits of unsegmented may be accepted.
If the algorithm is used for Retransmission mode or Flow control mode then it shall be
used instead of Invalid Frame detection described in Section 3.3.6.
To support LE Credit Based Flow Control mode and Enhanced Credit Based Flow
Control mode, an L2CAP PDU type with protocol elements in addition to the Basic
L2CAP header is defined. In LE Credit Based Flow Control mode and Enhanced Credit
Based Flow Control mode, the L2CAP PDU on a connection-oriented channel is a
Credit-based frame (K-frame) as illustrated in Figure 3.12.
Basic L2CAP
header
L2CAP SDU
PDU Length Channel ID Information Payload
Length1
16 16 16
LSB MSB
Figure 3.12: L2CAP PDU format in LE Credit Based Flow Control and Enhanced Credit Based Flow
Control modes
The first K-frame of the SDU shall contain the L2CAP SDU Length field that shall
specify the total number of octets in the SDU. The value shall not be greater than the
peer device's MTU for the channel. All subsequent K-frames that are part of the same
SDU shall not contain the L2CAP SDU Length field.
The number of octets contained in the first K-frame information payload of the SDU is
equal to the PDU Length minus 2 octets. All subsequent K-frames of the same SDU
contain the number of octets in the information payload equal to the PDU Length.
If the SDU length field value exceeds the receiver's MTU, the receiver shall disconnect
the channel. If the payload size of any K-frame exceeds the receiver's MPS, the
receiver shall disconnect the channel. If the sum of the payload sizes for the K-frames
exceeds the specified SDU length, the receiver shall disconnect the channel.
This section describes the signaling commands passed between two L2CAP entities on
peer devices. All signaling commands are sent over a signaling channel. The signaling
channel for managing channels over ACL-U logical links shall use CID 0x0001 and
the signaling channel for managing channels over LE-U logical links shall use CID
0x0005. Signaling channels are available as soon as the lower layer logical transport
is set up and L2CAP traffic is enabled. Figure 4.1 illustrates the general format of
L2CAP PDUs containing signaling commands (C-frames). Multiple commands may be
sent in a single C-frame over fixed channel CID 0x0001 while only one command
per C-frame shall be sent over fixed channel CID 0x0005. Commands take the form
of requests, responses, and indications. All L2CAP implementations shall support
the reception of C-frames with a payload size that does not exceed the signaling
MTU. The minimum supported payload size for the C-frame (MTUsig) is defined in
Table 4.1. L2CAP implementations should not use C-frames that exceed the MTUsig of
the peer device. If a device receives a C-frame that exceeds its MTUsig then it shall
send an L2CAP_COMMAND_REJECT_RSP packet containing the supported MTUsig.
Implementations shall be able to handle the reception of multiple commands in an
L2CAP packet sent over fixed channel CID 0x0001.
Note: The name of a signalling packet has a suffix indicating its type: _REQ for
requests, _RSP for responses, and _IND for indications.
A signaling packet that is not correctly formed is invalid behavior (see [Vol 1] Part E,
Section 2.7). Examples of signaling packets that are not correctly formed include:
Basic L2CAP
header
• Code (1 octet)
The Code field is one octet long and identifies the type of command. When a packet
is received with a Code field that is unknown or disallowed on the signaling channel it
is received on, an L2CAP_COMMAND_REJECT_RSP packet (defined in Section 4.1)
is sent in response.
Table 4.2 lists the codes defined by this document. All codes are specified with the
most significant bit in the left-most position.
• Identifier (1 octet)
The Identifier field is one octet long and matches responses with requests. The
requesting device sets this field and the responding device uses the same value in
its response. Within each signaling channel a different Identifier shall be used for
each successive command. Following the original transmission of an Identifier in a
command, the Identifier may be recycled if all other Identifiers have subsequently
been used.
RTX and ERTX timers are used to determine when the remote end point is not
responding to signaling requests. On the expiration of a RTX or ERTX timer, the same
identifier shall be used if a duplicate request is re-sent as stated in Section 6.2.
When multiple commands are included in an L2CAP packet and the packet exceeds the
signaling MTU (MTUsig) of the receiver, a single L2CAP_COMMAND_REJECT_RSP
packet shall be sent in response. The identifier shall match the first request command
in the L2CAP packet. If only responses are recognized, the packet shall be silently
discarded.
• Reason (2 octets)
The Reason field describes why the request packet was rejected, and is set to one of
the Reason codes in Table 4.3.
Note: This means that all PSMs are odd numbers and that the end of a PSM can be
easily found by searching for the first even octet.
PSM values are separated into two ranges. Valid values in the first range are
assigned by the Bluetooth SIG and indicate protocols. The second range of values
are dynamically allocated and used in conjunction with the Service Discovery
protocol (SDP). The dynamically assigned values may be used to support multiple
implementations of a particular protocol.
PSM values in the first range are defined in Assigned Numbers.
Range Type Server Usage Client Usage
0x0001 to Fixed, PSM is fixed for all imple- PSM may be obtained via SDP or may
0x0EFF SIG as- mentations. be assumed for a fixed service. Proto-
signed col used is indicated by the PSM.
(Note 1)
>0x1000 Dynamic PSM may be fixed for a giv- PSM shall be obtained via SDP upon
en implementation or may every reconnection. PSM for one direc-
be assigned at the time the tion will typically be different from the
service is registered in SDP. other direction.
1Since PSMs are odd and the least significant bit of the most significant byte is zero, the following
ranges do not contain valid PSMs: 0x0100-0x01FF, 0x0300-0x03FF, 0x0500-0x05FF, 0x0700-0x07FF,
0x0900-0x09FF, 0x0B00-0x0BFF, 0x0D00-0x0DFF. All even values are also not valid as PSMs.
Result Status
Value Description
0x0002 Connection refused – PSM not supported
0x0003 Connection refused – security block
0x0004 Connection refused – no resources available
0x0006 Connection refused – invalid Source CID
0x0007 Connection refused – Source CID already allocated
Other Reserved for future use
Configuration Options
MSB LSB
RFU C
present in the request (except for those error conditions more appropriate
for an L2CAP_COMMAND_REJECT_RSP packet), or the responder may
reply with a "Success" L2CAP_CONFIGURATION_RSP packet containing no
options, delaying those options until the full request has been received. The
L2CAP_CONFIGURATION_REQ packet with the continuation flag cleared shall be
treated as the L2CAP_CONFIGURATION_REQ event in the channel state machine.
When used in the L2CAP_CONFIGURATION_RSP packet, the continuation flag shall
be set to one if the flag is set to one in the request. If the continuation flag is set to
one in the response when the matching request has the flag set to zero, it indicates
the responder has additional options to send to the requestor. In this situation,
the requestor shall send null-option L2CAP_CONFIGURATION_REQ packets (with
continuation flag set to zero) to the responder until the responder replies with an
L2CAP_CONFIGURATION_RSP packet where the continuation flag is set to zero.
The L2CAP_CONFIGURATION_RSP packet with the continuation flag set to zero
shall be treated as the L2CAP_CONFIGURATION_RSP event in the channel state
machine.
The result of the configuration transaction is success if all the individual result values
are success, and is failure otherwise.
Other flags are reserved for future use.
• Configuration Options
A list of the parameters and their values to be negotiated shall be provided in
the Configuration Options field. These are defined in Section 5; in addition, as
described in that section, an implementation shall be prepared to receive any number
of unknown options. An L2CAP_CONFIGURATION_REQ packet may contain no
options (referred to as an empty or null configuration request) and can be used to
request a response. For an empty configuration request the Data Length field is set to
0x0004.
Result Config
MSB LSB
RFU C
Result Description
0x0000 Success
0x0001 Failure – unacceptable parameters
0x0002 Failure – rejected (no reason provided)
0x0003 Failure – unknown options
0x0004 Pending
0x0005 Failure - flow spec rejected
Other Reserved for future use
• Configuration options
This field contains the list of parameters being configured. These are defined
in Section 5. On a successful result (Result=0x0000) and pending result
(Result=0x0004), these parameters contain the return values for any wild card
parameter values (see Section 5.3) and “adjustments” to non-negotiated configuration
parameter values contained in the request. A response with a successful result is also
referred to as a positive response.
On an unacceptable parameters failure (Result=0x0001) the rejected parameters
shall be sent in the response with the values that would have been accepted
if sent in the original request. Any missing configuration parameters in the
L2CAP_CONFIGURATION_REQ packet are assumed to have their default
value or previously agreed value and they too shall be included in the
L2CAP_CONFIGURATION_RSP packet if they need to be changed. A response with
an unacceptable parameters failure is also referred to as a negative response.
On an unknown option failure (Result=0x0003), the option(s) that
contain an option type field that is not understood by the recipient
of the L2CAP_CONFIGURATION_REQ packet shall be included in the
L2CAP_CONFIGURATION_RSP packet unless they are hints. Hints are
those options in the L2CAP_CONFIGURATION_REQ packet that are skipped
if not understood (see Section 5). Hints shall not be included in the
L2CAP_CONFIGURATION_RSP packet and shall not be the sole cause for rejecting
the L2CAP_CONFIGURATION_REQ packet.
On a flow spec rejected failure (Result=0x0005), an Extended Flow Spec option may
be included to reflect the QoS level that would be acceptable (see Section 7.1.3).
The decision on the amount of time (or messages) spent arbitrating the channel
parameters before terminating the negotiation is implementation specific.
The SCID and DCID are relative to the sender of this request and shall match those of
the channel to be disconnected. If the DCID is not recognized by the receiver of this
message, an L2CAP_COMMAND_REJECT_RSP packet with ‘invalid CID’ result code
shall be sent in response. If the receiver finds a DCID match but the SCID fails to find
the same match, the request should be silently discarded.
InfoType
• InfoType (2 octets)
The InfoType defines the type of implementation specific information being requested.
See Section 4.11 for details on the type of information requested.
Value Description
0x0001 Connectionless MTU
0x0002 Extended features supported
Value Description
0x0003 Fixed channels supported over BR/EDR
Other Reserved for future use
Info (optional)
• InfoType (2 octets)
The InfoType defines the type of implementation specific information that
was requested. This value shall be copied from the InfoType field in the
L2CAP_INFORMATION_REQ packet.
• Result (2 octets)
The Result contains information about the success of the request. If result is
"Success," the data field contains the information as specified in Table 4.11. If result is
"Not supported," no data shall be returned.
Value Description
0x0000 Success
0x0001 Not supported
Other Reserved for future use
The feature mask shown in Table 4.12 consists of 4 octets (numbered octet 0 to 3), with
bit numbers 0 to 7 each.
1Peer side supports upper layer control of the Link Manager's Bi-directional QoS, see Section 5.3 for more
details.
2Peer side supports negotiating omitting FCS; see Section 5.5 for more details and the required behavior if
An L2CAP entity shall not transmit on any fixed channel (with the exception of the
L2CAP Signaling channel) until it has received a Fixed Channels Supported InfoType
from the peer L2CAP entity indicating support for that channel, or has received a
valid packet from the remote device on that fixed channel. All packets received on a
non-supported fixed channel shall be ignored.
This command shall only be sent from the Peripheral to the Central and only if
one or more of the Peripheral’s Controller, the Central’s Controller, the Peripheral’s
Host and the Central’s Host do not support the Connection Parameters Request Link
Layer Control procedure ([Vol 6] Part B, Section 5.1.7). If a Peripheral’s Host receives
an L2CAP_CONNECTION_PARAMETER_UPDATE_REQ packet it shall respond with
an L2CAP_COMMAND_REJECT_RSP packet with reason 0x0000 (Command not
understood). Figure 4.16 defines the format of the packet.
or reject the request. In devices supporting HCI, the Central’s Host delivers the
requested parameters to its Controller using the HCI_LE_Connection_Update command
(see [Vol 4] Part E, Section 7.8.18). If the Central’s Host accepts the requested
parameters it shall send the L2CAP_CONNECTION_PARAMETER_UPDATE_RSP
packet with result 0x0000 (Parameters accepted) otherwise it shall set the result to
0x0001 (request rejected).
The Peripheral’s Host will receive an indication from the Peripheral’s Controller when
the connection parameters have been updated. In devices supporting HCI, this
notification will be in the form of an HCI_LE_Connection_Update_Complete event
(see [Vol 4] Part E, Section 7.7.65.3). If the Central’s Controller rejects the updated
connection parameters no indication from the Peripheral’s Controller will be sent to the
Peripheral’s Host.
Interval_Min Interval_Max
Latency Timeout
The data fields shall have the same meanings and requirements as the fields of the
LL_CONNECTION_PARAM_REQ PDU (see [Vol 6] Part B, Section 2.4.2.16) with the
same names.
This response shall only be sent from the Central to the Peripheral.
Result
• Result (2 octets)
The result field indicates the response to the request. The result value of 0x0000
indicates that the Central’s Host has accepted the connection parameters while
0x0001 indicates that the Central’s Host has rejected the connection parameters.
Result Description
0x0000 Connection Parameters accepted
0x0001 Connection Parameters rejected
Other Reserved for future use
Table 4.14: Result values for the L2CAP_CONNECTION_PARAMETER_UPDATE_RSP packet
MTU MPS
Initial Credits
Note: Unlike a normal PSM (see Section 4.2), the length of an SPSM is not variable
and each octet may be either odd or even.
Result
Table 4.16 defines values for this field. The DCID, MTU, MPS and Initial Credits fields
shall be ignored when the result field indicates the connection was refused.
Value Description
0x0000 Connection successful
0x0002 Connection refused – SPSM not supported
0x0004 Connection refused – no resources available
0x0005 Connection refused – insufficient authentication
0x0006 Connection refused – insufficient authorization
0x0007 Connection refused – encryption key size too short1
0x0008 Connection refused – insufficient encryption
0x0009 Connection refused – invalid Source CID
0x000A Connection refused – Source CID already allocated
0x000B Connection refused – unacceptable parameters
Other Reserved for future use
• CID – (2 octets)
The CID is two octets in length and represents the source channel endpoint of the
device sending the L2CAP_FLOW_CONTROL_CREDIT_IND packet. For example, a
received L2CAP_FLOW_CONTROL_CREDIT_IND packet with a given CID (0x0042)
would provide credits for the receiving device’s destination CID (0x0042).
• Credits – (2 octets)
The credit value field represents number of credits the receiving device can
increment, corresponding to the number of K-frames that can be sent to the
peer device sending the L2CAP_FLOW_CONTROL_CREDIT_IND packet. The credit
value field shall be a number between 1 and 65535.
SPSM MTU
MTU MPS
implementations shall support a minimum MPS of 64 octets and may support an MPS
up to 65533 octets.
• Initial Credits – (2 octets)
The Initial Credit field value indicates the number of K-frames that
the peer device can send to the L2CAP layer entity sending the
L2CAP_CREDIT_BASED_CONNECTION_RSP packet on each of the Destination
CID channels. The initial credit value shall be in the range of 1 to 65535.
• Result – (2 octets)
The Result field indicates the outcome of the connection request. Table 4.17 defines
values for this field. The Destination CID, MTU, MPS and Initial Credits fields shall
be ignored when the Result field indicates that all connections were refused or all
connections are pending.
Value Description
0x0000 All connections successful
0x0002 All connections refused – SPSM not supported
0x0004 Some connections refused – insufficient resources available
0x0005 All connections refused – insufficient authentication
0x0006 All connections refused – insufficient authorization
0x0007 All connections refused – encryption key size too short1
0x0008 All connections refused – insufficient encryption
0x0009 Some connections refused – invalid Source CID
0x000A Some connections refused – Source CID already allocated
0x000B All connections refused – unacceptable parameters
0x000C All connections refused – invalid parameters
0x000D All connections pending – no further information available
0x000E All connections pending – authentication pending
0x000F All connections pending – authorization pending
Other Reserved for future use
1This was previously "All connections refused - insufficient encryption key size".
(depending on the transport in use) and shall not be already allocated to a different
channel on the same logical link on the device sending the response. Once a channel
has been created, data packets flowing to the sender of the response shall be sent
to these CIDs. The order of the Destination CIDs shall correspond to the order of
the Source IDs in the corresponding L2CAP_CREDIT_BASED_CONNECTION_REQ
packet. If a Destination CID is non-zero, the channel was established. If a
Destination CID is 0x0000, the channel was not established. If a device receives
an L2CAP_CREDIT_BASED_CONNECTION_RSP packet with an already-assigned
Destination CID, then both the original channel and the new channel shall not be
used.
Note: The current MTU and MPS values of the channels may be different before this
packet is sent.
MTU MPS
Result
• Result (2 octets)
The Result field contains information about the success of the request.
Value Description
0x0000 Reconfiguration successful
0x0001 Reconfiguration failed - reduction in size of MTU not allowed
0x0002 Reconfiguration failed - reduction in size of MPS not allowed for more than
one channel at a time
0x0003 Reconfiguration failed - one or more Destination CIDs invalid
0x0004 Reconfiguration failed - other unacceptable parameters
All other val- Reserved for future use
ues
MTU is not a negotiated value, it is an informational parameter that each device can
specify independently. It indicates to the remote device that the local device can receive,
in this channel, an MTU larger than the minimum required. All L2CAP implementations
shall support a minimum MTU of 48 octets over the ACL-U logical link and 23 octets
over the LE-U logical link; however, some protocols and profiles explicitly require
support for a larger MTU. The minimum MTU for a channel is the larger of the L2CAP
minimum 48 octet MTU and any MTU explicitly required by the protocols and profiles
using that channel.
Note: The MTU is only affected by the profile directly using the channel. For example, if
a service discovery transaction is initiated by a non service discovery profile, that profile
does not affect the MTU of the L2CAP channel used for service discovery.
• A request specifying any MTU greater than or equal to the minimum MTU for the
channel shall be accepted.
• A request specifying an MTU smaller than the minimum MTU for the channel may be
rejected.
The signaling described in Section 4.5 may be used to reject an MTU smaller than
the minimum MTU for a channel. The "failure-unacceptable parameters" result sent
to reject the MTU shall include the proposed value of MTU that the remote device
intends to transmit. It is implementation specific whether the local device continues the
configuration process or disconnects the channel.
The MTU to be used on this channel for the traffic flowing in the opposite direction will
be established when the remote device sends its own L2CAP_CONFIGURATION_REQ
packet as explained in Section 4.4.
This option is used to inform the recipient of the Flush Timeout the sender is going to
use. This option shall not be used if the Extended Flow Specification is used. The Flush
Timeout is defined in the BR/EDR Baseband specification [Vol 2] Part B, Section 3.3.
The Option Type is 0x02 and the Option Length is 2 octets (see Figure 5.3). The Flush
Timeout option is negotiable.
If the remote device returns a negative response to this option and the local device
cannot honor the proposed value, then it shall either continue the configuration process
by sending a new request with the original value, or disconnect the channel. The flush
timeout applies to all channels on the same ACL logical transport but may be overridden
on a packet by packet basis by marking individual L2CAP packets as non-automatically-
flushable via the Packet_Boundary_Flag in the HCI ACL Data packet (see Section 1.1).
• Flush Timeout
This value is the Flush Timeout in milliseconds. This is an asymmetric value and the
sender of the request shall specify its flush timeout value if it differs from the default
value of 0xFFFF.
If no QoS configuration parameter is negotiated the link shall assume the default
parameters. The Option Type is 0x03. This option shall not be used if the Extended
Flow Specification option is used. The QoS option is negotiable. Figure 5.4 specifies the
format of this option.
L2CAP implementations are only required to support ’Best Effort’ service, support for
any other service type is optional. Best Effort does not require any guarantees. If
no QoS option is placed in the request, Best Effort shall be assumed. If any QoS
guarantees are required then a QoS configuration request shall be sent.
1Internet Engineering Task Force, “A Proposed Flow Specification”, RFC 1363, September 1992.
0 31
Option Option Flags Service
Type=0x03 Length=22 Type
Token Rate
Latency (microseconds)
Figure 5.4: Quality of Service (QoS) option format containing Flow Specification
• Flags (1 octet)
Reserved for future use.
• Service Type (1 octet)
This field indicates the level of service required. Table 5.1 defines the different
services available. The default value is ‘Best effort’.
If ‘Best effort’ is selected, the remaining parameters should be treated as optional
by the remote device. The remote device may choose to ignore the fields, try to
satisfy the parameters but provide no response (QoS option omitted in the response
message), or respond with the settings it will try to meet.
If ‘No traffic’ is selected, the remainder of the fields shall be ignored because there is
no data being sent across the channel in the outgoing direction.
Value Description
0x00 No traffic
0x01 Best effort (Default)
0x02 Guaranteed
Other Reserved for future use
Table 5.1: Service type definitions
• Token Rate (4 octets)
The value of this field represents the average data rate with which the application
transmits data. The application may send data at this rate continuously. On a short
time scale the application may send data in excess of the average data rate,
dependent on the specified Token Bucket Size and Peak Bandwidth (see below).
The Token Bucket Size and Peak Bandwidth allow the application to transmit data in
a 'bursty' fashion.
The Token Rate signaled between two L2CAP peers is the data transmitted by the
application and shall exclude the L2CAP protocol overhead. The Token Rate signaled
over the interface between L2CAP and the Link Manager shall include the L2CAP
protocol overhead. Furthermore the Token Rate value signaled over this interface
may also include the aggregation of multiple L2CAP channels onto the same ACL
logical transport.
The Token Rate is the rate with which traffic credits are provided. Credits can
be accumulated up to the Token Bucket Size. Traffic credits are consumed when
data is transmitted by the application. When traffic is transmitted, and there are
insufficient credits available, the traffic is non-conformant. The Quality of Service
guarantees are only provided for conformant traffic. For non-conformant traffic there
may be insufficient resources such as bandwidth and buffer space. Furthermore
non-conformant traffic may violate the QoS guarantees of other traffic flows.
The Token Rate is specified in octets per second. The value 0x00000000 indicates
no token rate is specified. This is the default value and means “do not care”. When
the Guaranteed service is selected, the default value shall not be used. The value
0xFFFFFFFF is a wild card matching the maximum token rate available. The meaning
of this value depends on the service type. For best effort, the value is a hint that the
application wants as much bandwidth as possible. For Guaranteed service the value
represents the maximum bandwidth available at the time of the request.
• Token Bucket Size (4 octets)
The Token Bucket Size specifies a limit on the 'burstiness' with which the application
may transmit data. The application may offer a burst of data equal to the Token
Bucket Size instantaneously, limited by the Peak Bandwidth (see below). The Token
Bucket Size is specified in octets.
The Token Bucket Size signaled between two L2CAP peers is the data transmitted
by the application and shall exclude the L2CAP protocol overhead. The Token Bucket
Size signaled over the interface between L2CAP and Link Manager shall include
the L2CAP protocol overhead. Furthermore the Token Bucket Size value over this
interface may include the aggregation of multiple L2CAP channels onto the same
ACL logical transport.
The value of 0x00000000 means that no token bucket is needed; this is the default
value. When the Guaranteed service is selected, the default value shall not be used.
The value 0xFFFFFFFF is a wild card matching the maximum token bucket available.
The meaning of this value depends on the service type. For best effort, the value
indicates the application wants a bucket as big as possible. For Guaranteed service
the value represents the maximum L2CAP SDU size.
The Token Bucket Size is a property of the traffic carried over the L2CAP channel.
The Maximum Transmission Unit (MTU) is a property of an L2CAP implementation.
For the Guaranteed service the Token Bucket Size shall be smaller or equal to the
MTU.
• Peak Bandwidth (4 octets)
The value of this field, expressed in octets per second, limits how fast packets from
applications may be sent back-to-back. Some systems can take advantage of this
information, resulting in more efficient resource allocation.
The Peak Bandwidth signaled between two L2CAP peers specifies the data
transmitted by the application and shall exclude the L2CAP protocol overhead. The
Peak Bandwidth signaled over the interface between L2CAP and Link Manager shall
include the L2CAP protocol overhead. Furthermore the Peak Bandwidth value over
this interface may include the aggregation of multiple L2CAP channels onto the same
ACL logical transport.
The value of 0x00000000 means "do not care." This states that the device has no
preference on incoming maximum bandwidth, and is the default value. When the
Guaranteed service is selected, the default value shall not be used.
• Access Latency (4 octets)
The value of this field is the maximum acceptable delay of an L2CAP packet to
the air-interface. The precise interpretation of this number depends on over which
interface this flow parameter is signaled. When signaled between two L2CAP peers,
the Access Latency is the maximum acceptable delay between the instant when
the L2CAP SDU is received from the upper layer and the start of the L2CAP SDU
transmission over the air. When signaled over the interface between L2CAP and
the Link Manager, it is the maximum delay between the instant the first fragment of
an L2CAP PDU is stored in the Controller buffer and the initial transmission of the
L2CAP packet on the air.
Thus the Access Latency value may be different when signaled between L2CAP
and the Link Manager to account for any queuing delay at the L2CAP transmit
side. Furthermore the Access Latency value may include the aggregation of multiple
L2CAP channels onto the same ACL logical transport.
The Access Latency is expressed in microseconds. The value 0xFFFFFFFF means
“do not care” and is the default value. When the Guaranteed service is selected, the
default value shall not be used.
• Delay Variation (4 octets)
The value of this field is the difference, in microseconds, between the maximum and
minimum possible delay of an L2CAP SDU between two L2CAP peers. The Delay
Variation is a purely informational parameter. The value 0xFFFFFFFF means “do not
care” and is the default value.
0 31
Option
Option Type=0x04 Mode TxWindow size
Length=9
Monitor timeout
Max Transmit Retransmission timeout
(least significant byte)
Monitor timeout Maximum PDU payload size
(most significant byte) (MPS)
• Mode (1 octet)
The field contains the requested mode of the link. Possible values are shown in
Table 5.2.
Value Description
0x00 L2CAP Basic mode
0x01 Retransmission mode
0x02 Flow control mode
0x03 Enhanced Retransmission mode
0x04 Streaming mode
Other Reserved for future use
Table 5.2: Mode definitions
The Basic L2CAP mode is the default. If Basic L2CAP mode is requested then all
other parameters shall be ignored.
Enhanced Retransmission mode should be enabled if a reliable channel has been
requested. Enhanced Retransmission mode shall only be sent to an L2CAP entity
that has previously advertised support for the mode in its Extended Feature Mask
(see Section 4.12).
the number of retransmissions for I-frames and S-frames with P-bit set to 1. The
sender of the option in an L2CAP_CONFIGURATION_REQ packet specifies the
value that shall be used by the receiver of the option. MaxTransmit values in an
L2CAP_CONFIGURATION_RSP packet shall be ignored. Lower values might be
appropriate for services requiring low latency. Higher values will be suitable for a
link requiring robust operation. A value of 1 means that no retransmissions will be
made but also means that the channel will be disconnected as soon as a packet
is lost. MaxTransmit shall not be set to zero in Retransmission mode. In Enhanced
Retransmission mode a value of zero for MaxTransmit means infinite retransmissions.
In Streaming mode this value is reserved for future use.
• Retransmission timeout (2 octets)
This is the value in milliseconds of the retransmission timeout (this value is used to
initialize the RetransmissionTimer).
The purpose of this timer in retransmission mode is to activate a retransmission in
some exceptional cases. In such cases, any delay requirements on the channel may
be broken, so the value of the timer should be set high enough to avoid unnecessary
retransmissions due to delayed acknowledgments. Suitable values could be 100’s of
milliseconds and up.
The purpose of this timer in flow control mode is to supervise I-frame transmissions.
If an acknowledgment for an I-frame is not received within the time specified by
the RetransmissionTimer value, either because the I-frame has been lost or the
acknowledgment has been lost, the timeout will cause the transmitting side to
continue transmissions. Suitable values are implementation dependent.
The purpose of this timer in Enhanced Retransmission mode is to detect lost I-frames
and initiate appropriate error recovery. The value used for the Retransmission timeout
is specified in Section 8.6.2. The value sent in an L2CAP_CONFIGURATION_REQ
packet is also specified in Section 8.6.2. A value for the Retransmission timeout shall
be sent in a positive L2CAP_CONFIGURATION_RSP packet and indicates the value
that will be used by the sender of the L2CAP_CONFIGURATION_RSP packet.
In Streaming mode this value is reserved for future use.
• Monitor timeout (2 octets)
In Retransmission mode this is the value in milliseconds of the interval at which
S-frames should be transmitted on the return channel when no frames are received
on the forward channel. (this value is used to initialize the MonitorTimer, see below).
This timer ensures that lost acknowledgments are retransmitted. Its main use is
to recover Retransmission Disable Bit changes in lost frames when no data is
being sent. The timer shall be started immediately upon transitioning to the open
state. It shall remain active as long as the connection is in the open state and the
retransmission timer is not active. Upon expiration of the Monitor timer an S-frame
shall be sent and the timer shall be restarted. If the monitor timer is already active
when an S-frame is sent, the timer shall be restarted. An idle connection will have
periodic monitor traffic sent in both directions. The value for this timeout should also
be set to 100’s of milliseconds or higher.
In Enhanced Retransmission mode the Monitor timeout is used to detect lost S-
frames with P-bit set to 1. If the timeout occurs before a response with the F-bit
set to 1 is received the S-frame is resent. The value used for the Monitor timeout
is specified in Section 8.6.3. The value sent in an L2CAP_CONFIGURATION_REQ
packet is also specified in Section 8.6.2. A value for the Monitor timeout shall be sent
in a positive L2CAP_CONFIGURATION_RSP packet and indicates the value that will
be used by the sender of the L2CAP_CONFIGURATION_RSP packet.
In Streaming mode this value is reserved for future use.
• Maximum PDU payload Size - MPS (2 octets)
The maximum payload size that the L2CAP layer entity sending the option in
an L2CAP_CONFIGURATION_REQ packet is capable of accepting, i.e. the MPS
corresponds to the maximum PDU payload size. Each device specifies the value
separately. An MPS value sent in a positive L2CAP_CONFIGURATION_RSP packet
is the actual MPS the receiver of the L2CAP_CONFIGURATION_REQ packet will use
on this channel for traffic flowing into the local device. An MPS value sent in a positive
L2CAP_CONFIGURATION_RSP packet shall be equal to or smaller than the value
sent in the L2CAP_CONFIGURATION_REQ packet.
When using Retransmission mode and Flow Control mode the settings are configured
separately for the two directions of an L2CAP connection. For example, in operating
with an L2CAP entity implementing a lower version of the specification, an
L2CAP connection can be configured as Flow Control mode in one direction and
Retransmission mode in the other direction. If Basic L2CAP mode is configured in one
direction and Retransmission mode or Flow control mode is configured in the other
direction on the same L2CAP channel then the channel shall not be used.
When using Enhanced Retransmission mode or Streaming mode, both directions of the
L2CAP connection shall be configured to the same mode. A precedence algorithm shall
be used by both devices so a mode conflict can be resolved in a quick and deterministic
manner.
• A device has a preferred mode but is willing to use another mode (known as "state
1"), and
• A device requires a specific mode (known as "state 2"). This includes cases where
channels are created over ACL-U logical links operating as described in Section 7.10.
In state 1, Basic L2CAP mode has the highest precedence and shall take precedence
over Enhanced Retransmission mode and Streaming mode. Enhanced Retransmission
mode has the second highest precedence and shall take precedence over all other
modes except Basic L2CAP mode. Streaming mode shall have the next level of
precedence after Enhanced Retransmission mode.
A device does not know in which state the remote device is operating so the state 1
precedence algorithm assumes that the remote device may be a state 2 device. If the
mode proposed by the remote device has a higher precedence (according to the state
1 precedence) then the algorithm will operate such that creation of a channel using the
remote device's mode has higher priority than disconnecting the channel.
The algorithm for state 1 devices is divided into two parts. Part one covers the case
where the remote device proposes a mode with a higher precedence than the state 1
local device. Part two covers the case where the remote device proposes a mode with a
lower precedence than the state 1 local device. Part one of the algorithm is as follows:
For Enhanced Retransmission mode and Streaming mode the Retransmission timeout
and Monitor Timeout parameters of the Retransmission and Flow Control option
parameters may be changed but all other parameters shall not be changed in a
subsequent reconfiguration after the channel has reached the OPEN state.
Figure 5.6 specifies the format of this option. The Option Type is 0x05. "No FCS"
shall only be used if both L2CAP entities send the FCS Option with value 0x00 (No
Value Description
0x00 No FCS
0x01 16-bit FCS defined in section 3.3.5 (default)
Other Reserved for future use
Value of 0x00 is set when the sender wishes to omit the FCS from S/I-frames.
The parameters in the Extended Flow Specification option specify the traffic stream in
the outgoing direction (transmitted traffic). The Option Type is 0x06. Figure 5.7 specifies
the format of this option.
0 31
The parameters of the Extended Flow Specification are shown in Table 5.5:
• Identifier (1 octet)
This field provides a unique identifier for the flow specification. This identifier is used
by some Controllers in the process of setting up the QoS request. Each active flow
specification sent by a device to configure an L2CAP channel shall have a unique
Identifier. An Identifier can be reused when the L2CAP channel associated with
the flow spec is disconnected. The Identifier shall be unique within the scope of a
physical link. Extended Flow Specifications for channels on different physical links
may have the same Identifier. The Identifier for an Extended Flow Specification with
Service Type Best Effort shall be 0x01.
Since the Identifier for an Extended Flow Specification with Service Type Best Effort
is fixed to 0x01 it is possible to generate a Best Effort Extended Flow Specification
for the remote device without performing the Lockstep Configuration process. (The
Lockstep Configuration process is described in Section 7.1.3).
• Service Type (1 octet)
This field indicates the level of service required. Table 5.6 defines the different Service
Types values. The default value is 'Best effort'. If 'Best effort' is selected then Access
Latency and Flush Timeout shall both be set to 0xFFFFFFFF. Maximum SDU size
and SDU Inter-arrival Time are used to indicate the maximum data rate that the
application can deliver to L2CAP for transmission. The remote device should respond
with lower settings indicating the maximum rate at which it can receive data (for
example, maximum rate data it can write to a mass storage device, etc.). Values
of 0xFFFF for Maximum SDU size and 0xFFFFFFFF for SDU Inter-arrival time are
used when the actual values are not known. If Maximum SDU size is set to 0xFFFF
then SDU Inter-arrival time shall be set to 0xFFFFFFFF, if SDU Inter-arrival time is
set to 0xFFFFFFFF then Maximum SDU size shall be set to 0xFFFF. This tells the
Controller to allocate as much bandwidth as possible.
If “Guaranteed” is selected the QoS parameters can be used to identify different types of
Guaranteed traffic.
• Guaranteed bandwidth traffic is traffic with a minimum data rate but no particular
latency requested. Latency will be related to the link supervision timeout. For this type
of traffic Access Latency is set to 0xFFFFFFFF.
• Guaranteed Latency traffic is traffic with only latency requirements. For this type of
traffic SDU Inter-arrival time is set to 0xFFFFFFFF. HID interrupt channel and AVRCP
are examples of this type of traffic.
• Both Guaranteed Latency and Bandwidth traffic has both a latency and bandwidth
requirement. An example is Audio/Video streaming.
If 'No Traffic' is selected the remainder of the fields shall be ignored because there is no
data being sent across the channel in the outgoing direction.
Value Description
0x00 No Traffic
0x01 Best effort (Default)
0x02 Guaranteed
Other Reserved for future use
A channel shall not be configured as “Best Effort” in one direction and “Guaranteed”
in the other direction. If a channel is configured in this way it shall be disconnected.
A channel may be configured as “No Traffic” in one direction and “Best Effort” in
the other direction. The “No Traffic” refers to the application traffic not the Enhanced
Retransmission mode supervisory traffic. A channel configured in this way is considered
to have a service type of Best Effort. A channel may be configured as “No Traffic” in
one direction and “Guaranteed” in the other direction. A channel configure in this way is
considered to have a service type of Guaranteed.
Once configured the service type of a channel shall not be changed during
reconfiguration.
roughly equal to the Flush Timeout minus the duration of streaming data which can be
stored in the receive side application buffers.
For non-streaming, bursty traffic (such as in HID and AVRCP), the Access Latency
parameter value sent in the L2CAP_CONFIGURATION_REQ packet should be set
to the desired latency, minus any HCI transport delays and any other stack delays
that may be expected on the device and on target Host systems. The remote device
receiving the L2CAP_CONFIGURATION_REQ packet may send an Access Latency
parameter value in the L2CAP_CONFIGURATION_RSP packet which is equal to
or lower than the value it received. The remote device may send a lower value to
account for other traffic it may be carrying, or overhead activities it may be carrying
out.
If HCI is used then the Host should take into account the latency of the HCI transport
when determining the value for the Access Latency. For example if the application
requires an Access Latency of 20 ms and the HCI transport has a latency of 5 ms
then the value for Access Latency should be 15 ms.
• Flush Timeout (4 Octets)
The Flush Timeout defines a maximum period after which all segments of the SDU
are flushed from L2CAP and the Controller. A Flush Timeout value of 0xFFFFFFFF
indicates that data will not be discarded by the transmitting side, even if the link
becomes congested, and thus in this case data is treated as reliable and is never
flushed.
The device receiving the L2CAP_CONFIGURATION_REQ packet with Flush Timeout
set to 0xFFFFFFFF should not modify this parameter. The Flush Timeout for a “Best
Effort” channel shall be set to 0xFFFFFFFF.
However, if the Traffic Type is “Guaranteed” and the transmit side buffer is limited,
then the Flush Timeout parameter given in the L2CAP_CONFIGURATION_REQ
packet may be set to a value corresponding to the duration of streaming data
which the transmit buffer can hold before it must begin discarding data. The
side receiving the L2CAP_CONFIGURATION_REQ packet may then set the Flush
Timeout parameter in the L2CAP_CONFIGURATION_RSP packet to a lower value if
the receive side buffer is smaller than the transmit side buffer.
Note: The total available buffer space is typically a combination of application buffers,
any buffers maintained by the L2CAP implementation, and HCI buffers provided by
the Controller.
The Flush Timeout should normally be set to a value which is larger than the Access
Latency, and which also accounts for buffers maintained by the application on the
receive side such as de-jitter buffers used in audio and video streaming applications.
In general, the Flush Timeout value should be selected to ensure that the Flush
Timeout expires when the application buffers are about to be exhausted.
The allowable values for the Maximum Extended Window Size are:
Value Description
0x0000 Invalid value for Enhanced Retransmission mode
Valid for Streaming mode
0x0001 to Valid maximum window size (frames) for Enhanced Retransmission mode. Invalid
0x3FFF for Streaming mode
Other Reserved for future use
Table 5.7: Extended Window Size values
This option shall only be sent if the peer L2CAP entity has indicated support for the
Extended Window size feature in the Extended Features Mask (see Section 4.12).
This option shall be ignored if the channel is configured to use Basic L2CAP mode (see
Section 5.4).
For Enhanced Retransmission mode, this option has the same directional semantics
as the Retransmission and Flow Control option (see Section 5.4). The sender of
an L2CAP_CONFIGURATION_REQ packet containing this option is suggesting the
maximum window size (possibly based on its own internal L2CAP receive buffer
resources) that the peer L2CAP entity should use when sending data.
For Streaming mode, this option is used to enable use of the Extended Control Field
and if sent, shall have a value of 0.
If this option is successfully configured then the Maximum Window Size negotiated
using the Retransmission and Flow Control option (see Section 5.4) shall be ignored.
If this option is successfully configured in either direction then both L2CAP entities shall
use the Extended Control Fields in all S/I-frames (see Section 3.3.2).
If the option is only configured in one direction then the maximum window size for the
opposite direction shall be taken from the maximum window size value in the existing
Retransmission and Flow Control option. In this configuration both L2CAP entities shall
use the extended control fields in all S/I-frames.
6 STATE MACHINE
The state machine does not necessarily represent all possible scenarios.
The following states have been defined to clarify the protocol; the actual number of
states and naming in a given implementation is outside the scope of the specification:
In the following state tables and descriptions, the L2CAP_Data message corresponds
to one of the PDU formats used on connection-oriented data channels as described in
Section 3, including PDUs containing B-frames, I-frames, or S-frames.
Some state transitions and actions are triggered only by internal events effecting one
of the L2CAP entity implementations, not by preceding L2CAP signaling messages. It
is implementation-specific and out of the scope of the specification, how these internal
events are realized; just for the clarity of specifying the state machine, the following
abstract internal events are used in the state event tables, as far as needed:
There is a single state machine for each L2CAP connection-oriented channel that is
active. A state machine is created for each new L2CAP_CONNECTION_REQ received.
The state machine always starts in the CLOSED state.
To simplify the state event tables, the RTX and ERTX timers, as well as the handling
of request retransmissions are described in Section 6.2 and not included in the state
tables.
L2CAP messages not bound to a specific data channel and thus not impacting
a channel state (e.g. L2CAP_INFORMATION_REQ, L2CAP_ECHO_REQ) are not
covered in this section.
In the Standard and Lockstep configuration processes both L2CAP entities initiate a
configuration request during the configuration process. This means that each device
adopts an initiator role for the outgoing configuration request, and an acceptor role
for the incoming configuration request. Configurations in both directions may occur
sequentially, but can also occur in parallel.
According to Section 6.1.1 and Section 6.1.2, the CONFIG state is entered via
WAIT_CONFIG substate from either the CLOSED state, the WAIT_CONNECT state,
or the WAIT_CONNECT_RSP state. The CONFIG state is left for the OPEN state if
both the initiator and acceptor paths complete successfully.
For better overview, separate tables are given: Table 6.4 shows the success transitions;
therein, transitions on one of the minimum paths (no previous non-success transitions)
are shaded. Table 6.5 shows the non-success transitions within the configuration
process, and Table 6.6 shows further transition cause by events not belonging to
the configuration process itself. The following configuration states and transitions are
illustrated in Figure 6.2.
Table 6.5: CONFIG state/substates event table: non-success transitions within configuration process
Table 6.6: CONFIG state/substates event table: events not related to configuration process
Notes:
The outgoing SDU shall be completed from the view of the remote entity. Therefore
all PDUs forming the SDU shall have been reliably transmitted by the local entity and
acknowledged by the remote entity, before entering the configuration state.
The Response Timeout eXpired (RTX) timer is used to terminate the channel when the
remote endpoint is unresponsive to signaling requests. This timer is started when a
signaling request (see Section 7) is sent to the remote device. This timer is disabled
when the response is received. If the initial timer expires, a duplicate Request message
may be sent or the channel identified in the request may be disconnected. If a duplicate
Request message is sent, the RTX timeout value shall be reset to a new value
at least double the previous value. When retransmitting the Request message, the
context of the same state shall be assumed as with the original transmission. If a
Request message is received that is identified as a duplicate (retransmission), it shall
be processed in the context of the same state which applied when the original Request
message was received.
The value of this timer is implementation-dependent but the minimum initial value is
1 second and the maximum initial value is 60 seconds. One RTX timer shall exist
for each outstanding signaling request, including each L2CAP_ECHO_REQ. The timer
disappears on the final expiration, when the response is received, or the physical link is
lost. The maximum elapsed time between the initial start of this timer and the initiation
of channel termination (if no response is received) is 60 seconds.
6.2.2 ERTX
The Extended Response Timeout eXpired (ERTX) timer is used in place of the RTX
timer when it is suspected the remote endpoint is performing additional processing of a
request signal. This timer is started when the remote endpoint responds that a request
is pending, e.g., when an L2CAP_CONNECTION_RSP event with a “connect pending”
result (0x0001) is received. This timer is disabled when the formal response is received
or the physical link is lost. If the initial timer expires, a duplicate Request may be sent or
the channel may be disconnected.
If a duplicate Request is sent, the particular ERTX timer disappears, replaced by a new
RTX timer and the whole timing procedure restarts as described previously for the RTX
timer.
The value of this timer is implementation-dependent but the minimum initial value is 60
seconds and the maximum initial value is 300 seconds. Similar to RTX, there shall be at
least one ERTX timer for each outstanding request that received a Pending response.
There should be at most one (RTX or ERTX) associated with each outstanding request.
The maximum elapsed time between the initial start of this timer and the initiation of
channel termination (if no response is received) is 300 seconds. When terminating the
channel, it is not necessary to send an L2CAP_DISCONNECTION_REQ and enter
WAIT_DISCONNECT state. Channels should be transitioned directly to the CLOSED
state.
Event:L2CAP_CONNECTION_RSP
Event:L2CAP_CONNECTION_RSP (refused)
(refused) CLOSED Action: -
Action: -
Event:L2CAP_CONNECTION_REQ Event:OpenChannelReq
Action:L2CAP_CONNECTION_RSP Action:L2CAP_CONNECTION_REQ
(pending)
WAIT_
WAIT_
CONNECT_
CONNECT
RSP
Event:L2CAP_DISCONNECTION_REQ Event:L2CAP_CONNECTION_REQ
Action:L2CAP_DISCONNECTION_RSP Action:L2CAP_CONNECTION_RSP
Event:OpenChannelRes (success)
(success)
Action:L2CAP_CONNECTION_RSP
(success) Event:L2CAP_CONNECTION_RSP
(success)
Event:L2CAP_CONFIGURATION_REQ Action: -
Action:L2CAP_COMMAND_REJECT_RSP
(invalid CID)
Event:L2CAP_CONNECTION_RSP OR
L2CAP_CONFIGURATION_REQ OR Event:L2CAP_Data
L2CAP_Data Action: Process the PDU
Event:CloseChannelReq
Action:Ignore
Action:L2CAP_DISCONNECTION_REQ
WAIT_DIS-
CONFIG
CONNECT
Event:L2CAP_CONFIGURATION_REQ
Action:L2CAP_CONFIGURATION_RSP Event:ReconfigureChannelReq
Action:Complete outgoing SDU
L2CAP_CONFIGURATION_REQ
Event:L2CAP_CONFIGURATION_REQ
options acceptable
Action:L2CAP_CONFIGURATION_RSP
(success)
Event:L2CAP_DISCONNECTION_REQ
Action:L2CAP_DISCONNECTION_RSP Event:L2CAP_CONFIGURATION_REQ
options not acceptable
Action:L2CAP_CONFIGURATION_RSP
Event:L2CAP_DISCONNECTION_RSP (fail)
Event:CloseChannelReq
Action: -
Action:L2CAP_DISCONNECTION_REQ
CLOSED OPEN
Event:L2CAP_DISCONNECTION_REQ
Action:L2CAP_DISCONNECTION_RSP
Event:SendDataReq
Action: Send L2CAP_Data packet
Event:L2CAP_Data
Action: Process the PDU
Event:L2CAP_DISCONNECTION_RSP
OR L2CAP_CONNECTION_RSP
Action: Ignore
WAIT_ WAIT_
Event: ControllerIndication
CONNECT_ (reject) CONTROL
RSP Action: L2CAP_CONNECTION_RSP _IND
(fail)
CLOSED
Event: L2CAP_CONNECTION_RSP
Event: ControllerIndication
(accept)
Action: L2CAP_CONNECTION_RSP
Event: L2CAP_CONNECTION_REQ (success)
Action: L2CAP_CONNECTION_RSP WAIT_
(success)
FINAL_
RSP
Event: L2CAP_CONFIGURATION_RSP
(fail)
Event: L2CAP_CONFIGURATION_RSP
WAIT_ (success)
CONNECT Event: OpenChannel_Rsp
(success)
Action: L2CAP_CONNECTION_RSP
(success) Event: ControllerIndication (reject)
WAIT_ Action: L2CAP_CONNECTION_RSP (fail) OPEN
CONFIG or
Event: L2CAP_CONFIGURATION_RSP (fail)
Event: L2CAP_CONFIGURATION_REQ
options not acceptable
Action: L2CAP_CONFIGURATION_RSP Event: L2CAP_CONFIGURATION_REQ
(fail) options not acceptable
Action: L2CAP_CONFIGURATION_RSP Event: ControllerIndication Event: L2CAP_CONFIGURATION_RSP
(fail) (accept) (success)
Action: L2CAP_CONNECTION_RSP
(success)
Event: ConfigureChannelReq
Action: L2CAP_CONFIGURATION_REQ
WAIT_
CONFIG_
Event: L2CAP_CONFIGURATION_REQ REQ
options acceptable
Action: L2CAP_CONFIGURATION_RSP
(success) or (pending) Event: L2CAP_CONFIGURATION_REQ
Event: L2CAP_CONFIGURATION_RSP options acceptable
options acceptable Action: L2CAP_CONFIGURATION_RSP
Event: L2CAP_CONFIGURATION_RSP (pending)
(fail)
Action: L2CAP_CONFIGURATION_REQ
(new options) Event: L2CAP_CONFIGURATION_REQ
WAIT_ options acceptable WAIT_IND_
CONFIG_ Action: L2CAP_CONFIGURATION_RSP
(success) FINAL_RSP
REQ_RSP
WAIT_
Event: L2CAP_CONFIGURATION_REQ
SEND_ options not acceptable OPEN
CONFIG Action: L2CAP_CONFIGURATION_RSP
(fail)
Event: L2CAP_CONFIGURATION_REQ
options acceptable
Action: L2CAP_CONFIGURATION_RSP
(success) Event: L2CAP_CONFIGURATION_RSP
options acceptable
Event: L2CAP_CONFIGURATION_RSP
options acceptable
Event: ConfigureChannelReq
Action: L2CAP_CONFIGURATION_REQ
WAIT_
CONFIG_
RSP
Event: L2CAP_CONFIGURATION_RSP
(fail)
Action: L2CAP_CONFIGURATION_REQ
(new options)
7 GENERAL PROCEDURES
This section describes the general operation of L2CAP, including the configuration
process, the handling and the processing of user data for transportation over the
air interface. This section also describes the operation of L2CAP features including
the delivery of erroneous packets, the flushing of expired data and operation in
connectionless mode, operation collision resolution, aggregation of best effort flow
specifications, and prioritizing data over HCI.
Procedures for the flow control and retransmission modes are described in Section 8.
Configuration consists of two processes, the Standard process and the Lockstep
process. The Lockstep process shall be used if both L2CAP entities support the
Extended Flow Specification option otherwise the Standard process shall be used.
For both processes, configuring the channel parameters shall be done independently for
both directions. Both configurations may be done in parallel.
If a device needs to establish the value of a configuration parameter the remote device
will accept, then it must wait for an L2CAP_CONFIGURATION_REQ packet containing
that configuration parameter to be sent from the remote device.
The Lockstep process is used when the channel parameters include an Extended Flow
Specification option. The Lockstep process can be divided into two phases. In the
first phase, each L2CAP entity shall receive an Extended Flow Specification option
along with all non-default parameters from its peer L2CAP entity and then present the
pair of Extended Flow specifications (local and remote) to its local Controller. In the
second phase, each L2CAP entity shall report the result from its local Controller to the
peer L2CAP entity. The Lockstep process is described in Section 7.1.3. The Standard
process is described in Section 7.1.4.
Both the Lockstep and Standard processes can be abstracted into the initial Request
configuration path and a Response configuration path, followed by the reverse direction
phase. Reconfiguration follows a similar two-phase process by requiring configuration in
both directions.
Parameter Description
MTU Incoming MTU information
FlushTO Outgoing flush timeout1
QoS Outgoing QoS information1
RFCMode Incoming and outgoing Retransmission and Flow Control mode
FCS Incoming and outgoing Frame Check Sequence
ExtFlowSpec Outgoing QoS information1
ExtWindow Incoming Extended Window size plus incoming and outgoing frame format
1FlushTO,QoS and ExtFlowSpec are considered QoS information. ExtFlowSpec is used instead of
FlushTO and QoS when both devices support ExtFlowSpec.
Parameter Description
MTU Outgoing MTU information
FlushTO Incoming flush timeout1
QoS Incoming QoS information1
RFCMode Incoming and outgoing Retransmission and Flow Control mode
ExtFlowSpec Incoming QoS information1
ExtWindow Outgoing Extended Window size
1FlushTO,QoS and ExtFlowSpec are considered QoS information. ExtFlowSpec is used instead of
FlushTO and QoS when both devices support ExtFLowSpec
the Lockstep configuration process. The Lockstep process shall only be used during
channel reconfiguration when an Extended Flow Specification option is present in the
L2CAP_CONFIGURATION_REQ packet used for reconfiguration.
The Extended Flow Specification shall only be sent for channels created on
the ACL-U logical link if both the local and remote L2CAP entities have
indicated support for the Extended Flow Specification for BR/EDR in their
Extended Features masks. The Extended Features mask shall be obtained via
the L2CAP_INFORMATION_REQ/L2CAP_INFORMATION_RSP signaling mechanism
(InfoType = 0x0002) prior to the issuance of the L2CAP_CONFIGURATION_REQ
packet. If an L2CAP_CONFIGURATION_REQ packet is sent containing the Extended
Flow Specification option then the Quality of Service option and Flush Timeout option
shall not be included.
If the service type is “Best Effort” then values for certain parameters may be sent in an
L2CAP_CONFIGURATION_RSP packet with result “Pending” to indicate the maximum
bandwidth the sender of the L2CAP_CONFIGURATION_RSP packet is capable to
receive. The values sent in an L2CAP_CONFIGURATION_RSP packet with result
“Pending” and service type Best Effort shall be in accordance with Table 7.3.
Table 7.3: Permitted parameter in L2CAP_CONFIGURATION_RSP packets for service type “Best Effort”
If the Controller cannot support the Extended Flow Specifications with service type
“Guaranteed,” then the recipient of the L2CAP_CONFIGURATION_REQ packet shall
send an L2CAP_CONFIGURATION_RSP packet indicating a result code of “Failure -
flow spec rejected” (0x0005). If the Controller indicates that it can support the Extended
Flow Specifications, then the recipient of the L2CAP_CONFIGURATION_REQ packet
shall send an L2CAP_CONFIGURATION_RSP packet with result code of “Success”
(0x0000) with no parameters.
Table 7.4: Permitted parameter changes in L2CAP_CONFIGURATION_RSP packets for service type
“Guaranteed”
For the Standard process the following general procedure shall be used for each
direction:
1. Local device informs the remote device of the parameters that the local device will
accept using an L2CAP_CONFIGURATION_REQ packet.
2. Remote device responds, agreeing or disagreeing with these values, including the
default ones, using an L2CAP_CONFIGURATION_RSP packet.
3. The local and remote devices repeat steps (1) and (2) until agreement on all
parameters is reached.
The decision on the amount of time (or messages) spent configuring the channel
parameters before terminating the configuration is left to the implementation, but it shall
not last more than 120 seconds.
Note: MTU is non-negotiable but can be rejected if a value lower than the mandated
minimum is proposed (See Section 5.1).
The following rules shall be used for parameter negotiation in the Request Path:
Note: The resending of all the options provides backwards compatibility with remote
implementations that don’t assume rule 4 when responding.
4. Negotiable options not included in a negative L2CAP_CONFIGURATION_RSP
packet are considered accepted by the remote device.
The following rules shall be used for parameter negotiation in the Response Path:
An L2CAP implementation may fragment any L2CAP PDU for delivery to the lower
layers, whether directly to the Controller or over HCI. All fragments associated with
a specific L2CAP PDU shall be sent to the Controller, in the same order as their
contents occur in the PDU, before any other fragment associated with the same logical
link. Fragments associated with different logical links may be interleaved. (See [Vol 2]
Part B, Section 5.3 and [Vol 6] Part B, Section 4.5.17 for related requirements on the
Controller.)
For example, in the BR/EDR Controller the two LLID bits defined in the first octet
of Baseband payload (also called the frame header) are used to signal the start
and continuation of L2CAP PDUs. LLID shall be 0b10 for the first segment in an
L2CAP PDU and 0b01 for a continuation segment. An illustration of fragmentation for a
BR/EDR Controller is shown in Figure 7.1. An example of how fragmentation might be
used in a device with HCI is shown in Figure 7.2.
Note: The BR/EDR Link Controller is able to impose a different fragmentation on the
PDU by using “start” and “continuation” indications as fragments are translated into
Baseband packets. Thus, both L2CAP and the BR/EDR Link Controller use the same
mechanism to control the size of fragments.
Embedded
Software Re-assemble &
HCI-USB buffer packets HCI 1 HCI 2 HCI n
Figure 7.2: Example of fragmentation processes in a device with a BR/EDR Controller and USB HCI
transport
The Controller will provide fragments of L2CAP PDUs to the L2CAP implementation. It
is the responsibility of L2CAP to reassemble PDUs and SDUs and to check the length
field of the SDUs. The L2CAP layer shall reassemble the fragments it receives from the
Controller into complete PDUs, which may then further be combined into SDUs. (See
[Vol 2] Part B, Section 5.3 and [Vol 6] Part B, Section 4.5.17 for related requirements on
the Controller.)
An L2CAP implementation shall use the PDU Length field in the header of L2CAP
PDUs, see Section 3, as a consistency check and shall discard any L2CAP PDUs that
fail to match the PDU Length field. If channel reliability is not needed, packets with
invalid lengths may be silently discarded. For reliable channels using Basic mode, an
L2CAP implementation shall indicate to the upper layer that the channel has become
unreliable. Reliable channels are defined by having an infinite flush timeout value as
specified in Section 5.2. For higher data integrity L2CAP should be operated in the
Enhanced Retransmission mode.
The maximum size of an SDU segment shall be given by the Maximum PDU Payload
Size (MPS). The MPS parameter may be exported using an implementation specific
interface to the upper layer.
The specification does not describe a service interface with the upper layer, nor
does it assume any specific buffer management scheme of a Host implementation.
Consequently, a reassembly buffer may be part of the upper layer entity. It is assumed
that SDU boundaries are preserved between peer upper layer entities.
L2CAP SDU
I-frame I-frame
HCI
Fragment/ Fragment/ Fragment/ Fragment/
BB payload BB payload BB payload BB payload
The receiving side uses the SAR field of incoming 'I-frames' for the reassembly process.
The L2CAP SDU Length field, present in the “start of SDU” I-frame, is an extra integrity
check, and together with the sequence numbers may be used to indicate lost L2CAP
SDUs to the application.
The receiving side uses the SDU length of the first K-frame and the PDU length of each
K-frame for the reassembly process.
Figure 7.4 illustrates the use of segmentation and fragmentation operations to transmit
a single SDU. While SDUs and L2CAP PDUs are transported in peer-to-peer
fashion, the fragment size used by the Fragmentation and Recombination routines
are implementation specific and may be different in the sender and the receiver. The
over-the-air sequence of packet fragments as created by the sender is common to both
devices.
Re-assemble &
HCI-USB buffer packets HCI 1 HCI 2 HCI n
Figure 7.4: Example of segmentation and fragment processes in a device with a BR/EDR Controller and
USB HCI Transport1
1For simplicity, the stripping of any additional HCI and USB specific information fields prior to the creation of
the Baseband packets (Air_1, Air_2, etc.) is not shown in the figure.
In the L2CAP configuration using either the Flush Timeout option or the Extended Flow
Specification option, the Flush timeout may be set separately per L2CAP channel, but in
the BR/EDR Baseband, the flush mechanisms operate per ACL logical transport.
When there is more than one L2CAP channel mapped to the same ACL logical
transport, the automatic flush timeout does not discriminate between L2CAP channels.
The automatic flush timeout also applies to unicast data sent via the L2CAP
connectionless channel. The exception is packets marked as non-automatically-
flushable via the Packet_Boundary_Flag in the HCI ACL Data packet (see Section 1.1).
The automatic flush timeout flushes a specific automatically-flushable L2CAP PDU. The
HCI_Flush command flushes all outstanding L2CAP PDUs for the ACL logical transport
including L2CAP PDUs marked as non-automatically-flushable. Therefore, care has to
be taken when using the Automatic Flush Timeout and the HCI_Flush command. The
HCI_Enhanced_Flush command should be used instead.
If it is desired to send unicast data via the L2CAP connectionless channel which is
not subject to automatic flushing, then the data should be marked as non-automatically
flushable if it is mapped to an ACL logical transport with a finite automatic flush timeout.
Unicast data sent via the L2CAP connectionless channel may be marked flushable.
There is only one automatic flush timeout setting per ACL logical transport. Therefore,
all time bounded L2CAP channels on an ACL logical transport with an automatic flush
timeout setting should configure the same flush timeout value at the L2CAP level. The
flush timeout setting for the ACL logical transport also applies to unicast data sent via
the L2CAP connectionless channel which are marked flushable.
If Automatic Flush Timeout is used, then it should be taken into account that it only
flushes one L2CAP PDU. If one PDU has timed out and needs flushing, then other
automatically-flushable packets on the same logical transport are also likely to need
flushing. Therefore, flushing can be handled by the HCI_Enhanced_Flush command so
that all outstanding automatically-flushable L2CAP PDUs are flushed.
When both reliable and isochronous data is to be sent over the same ACL logical
transport, an infinite Automatic Flush Timeout can be used. In this case the isochronous
data can be flushed using the HCI_Enhanced_Flush command with Packet_Type set to
“Automatically-Flushable Only,” thus preserving the reliable data.
While L2CAP itself does not provide retransmission for data sent via the connectionless
channel, the Baseband does provide an ARQ scheme for unicast data (see [Vol 2] Part
B, Section 7.6). If a higher degree of reliability is desired for unicast data sent via the
connectionless L2CAP channel than is provided by the Baseband ARQ scheme then an
ARQ scheme should be implemented at a higher layer.
The receiving L2CAP entity may silently discard data received via the connectionless
L2CAP channel if the data packet is addressed to a PSM and no application is
registered to receive data on that PSM.
L2CAP does not provide flow control for either connection-oriented L2CAP channels
operating in Basic mode or for traffic on the connectionless L2CAP channel. Hence
if data received by L2CAP is not accepted by the target applications in a timely
manner, congestion can occur in a receiving L2CAP implementation. For connection-
oriented channels, the receiving L2CAP entity may elect to close a channel if the target
application for that channel does not accept the data in a timely manner. Since this
option is not available for unicast data received via the connectionless L2CAP channel,
the receiving L2CAP entity may instead elect to de-register the application receiving
the data or to disconnect the underlying physical link. An application shall be notified
if it is de-registered. If the underlying physical link is disconnected then all applications
utilizing that physical link shall be notified.
Unicast data shall only be sent via the connectionless L2CAP channel to a remote
device if the remote device indicates support for Unicast Connectionless Data
Reception in the L2CAP Extended Features Mask.1
Unicast data sent via the L2CAP connectionless channel are subject to automatic
flushing and hence the packet boundary flags should be set appropriately if the
Controller supports the Packet Boundary Flag feature. See Section 7.5 for further
details. Since the receiving L2CAP entity has no mechanism to enable it to know
whether received packets were originally marked as flushable or non-flushable on the
transmitting device, the receiving L2CAP entity should treat all unicast packets received
via the connectionless L2CAP packet as non-flushable.
If encryption is required for a given profile, then the profile or application shall ensure
that authentication is performed and encryption is enabled prior to sending any unicast
data on the connectionless L2CAP channel by utilizing Security mode 4 as defined in
GAP ([Vol 3] Part C, Section 5.2.2). There is no mechanism provided in the specification
to prevent reception of unencrypted data on the connectionless L2CAP channel. An
application which requires received data to be encrypted should ignore any unencrypted
data it may receive over the connectionless channel.
Broadcast transmissions to the connectionless channel are sent with the broadcast
LT_ADDR and hence may be received by any of the Peripherals in the piconet. If it
is desirable to restrict the reception of the transmitted data to only a subset of the
Peripherals in the piconet, then higher level encryption may be used to support private
communication.
The Central will not receive transmissions broadcast on the connectionless channel.
Therefore, higher layer protocols must loopback any broadcast data traffic being sent to
the Central if required.
The connectionless data channel shall not be used with Enhanced Retransmission
mode, Retransmission mode or Flow Control mode.
1The Unicast Connectionless Data Reception bit in the L2CAP Extended Features Mask does not in any way
indicate support or lack of support for reception of broadcast data on the connectionless L2CAP channel
even though both broadcast data and unicast data are sent and received using the same CID (0x0002).
For historical reasons, there is no bit to indicate support for sending or receiving of broadcast data on the
connectionless L2CAP channel.
When two devices request the same operation by sending a request packet with the
same code, a collision can occur. Some operations require collision resolution. The
description of each operation in Section 4 will indicate if collision resolution is required.
Both devices must know which request will be rejected. The following algorithm shall be
used by both devices to determine which request to reject.
In order for Guaranteed channels to meet their guarantees, L2CAP should prioritize
traffic over the HCI transport in devices that support HCI. Packets for Guaranteed
channels should receive higher priority than packets for Best Effort channels.
If both the local L2CAP entity and the remote L2CAP entity indicate support for
Extended Flow Specification for BR/EDR in the Extended Feature Mask then all
channels created between the two devices shall send an Extended Flow Specification
option and shall use the Lockstep configuration procedure. In addition all channels shall
use Enhanced Retransmission mode or Streaming mode. If one or both L2CAP entities
do not indicate support for Extended Flow Specification for BR/EDR in the Extended
Feature Mask then the Lockstep configuration procedure shall not be used and the
Extended Flow Specification option shall not be sent for channels created over the
ACL-U logical link between the two devices.
The L2CAP entity shall perform admission control for Guaranteed channels during the
Lockstep configuration procedure (see Section 7.1.3). Admission control is performed
to determine if the requested Guaranteed QoS can be achieved by the BR/EDR
or BR/EDR/LE Controller over an ACL-U logical link without compromising existing
Guaranteed channels running on the Controller. If HCI is used then the L2CAP entity
shall also verify that the QoS can be achieved over the HCI transport.
In performing admission control the L2CAP layer shall reject a Guaranteed QoS request
that causes at least one of the following rules to be violated.
• The total guaranteed data rate in both directions shall not exceed two times the
highest Symmetric Max of an ACL-U logical link over the BR/EDR or BR/EDR/LE
Controller (see [Vol 2] Part B, Section 6.7). For example, for a Basic Rate Controller
the highest Symmetric Max Rate is 433.9 kb/s (DH5) from [Vol 2] Part B, Table 6.8.
Two times that value is 867.8 kb/s.
• The total guaranteed data rate in any one direction shall not exceed the highest
Asymmetric Max Rate of an ACL-U logical link (see [Vol 2] Part B, Section 6.7). For
example, the highest Asymmetric Max Rate for Basic Rate is 723.2 kb/s (DH5 packet)
from [Vol 2] Part B, Table 6.8.
The data rate of a Guaranteed channel is calculated by dividing the Maximum SDU
size in an Extended Flow Specification by the SDU Inter-arrival time. Total guaranteed
data rate in both directions is calculated by taking the sum of the data rates in both
directions for all existing Guaranteed channels plus the data rate in both directions of
the requested Guaranteed channel (i.e. data rates from the both outgoing and incoming
Extended Flow Specifications). Total guaranteed data rate for one direction is calculated
by taking the sum of the data rates in one direction for all existing Guaranteed channels
plus the data rate in the same direction of the requested Guaranteed channel.
An L2CAP entity should use additional information for admission control that may result
in a Guaranteed QoS request being rejected even if none of the rules are violated. This
allows the L2CAP entity to account for things such as CQDDR, SCO/eSCO channels,
LMP traffic, page scanning, etc.
In order to meet the access latency and/or data rate required by a Guaranteed channel,
the L2CAP entity should:
• Prioritize traffic over the HCI transport in devices that support HCI.
• Give conformant packets for Guaranteed channels higher priority than packets for
Best Effort channels. Packets for Best Effort channels should have higher priority than
non-conformant packets for Guaranteed channels. (See Section 5.6 for a discussion
of non-conformant and conformant traffic).
• Utilize the SAR feature to restrict the PDU sizes of Best Effort SDUs so that they do
not prevent the Controller from sending the SDUs of the Guaranteed channel within
the time periods required by its Extended Flow Specification.
I-frames are sequentially numbered frames containing information fields. I-frames also
include some of the functionality of RR frames (see below).
The S-frame is used to control the transmission of I-frames. For Retransmission mode
and Flow Control mode, the S-frame has two formats: Receiver Ready (RR) and Reject
(REJ). A description of how S-frames are used in Enhanced Retransmission mode
is given in Section 8.6.1. S-frames are not used in Streaming mode. The following
description of S-frames only applies to Retransmission mode and Flow Control mode.
The reject (REJ) S-frame is used to request retransmission of all I-frames starting with
the I-frame with TxSeq equal to ReqSeq specified in the REJ. The value of ReqSeq
in the REJ frame acknowledges I-frames numbered up to and including ReqSeq - 1.
I-frames that have not been transmitted, shall be transmitted following the retransmitted
I-frames.
When a REJ is transmitted, it triggers a REJ Exception condition. A second REJ frame
shall not be transmitted until the REJ Exception condition is cleared. The receipt of an
I-frame with a TxSeq equal to the ReqSeq of the REJ frame clears the REJ Exception.
The REJ Exception condition only applies to traffic in one direction.
• TxSeq – the send sequence number used to sequentially number each new I-frame
transmitted.
• NextTxSeq – the sequence number to be used in the next new I-frame transmitted.
• ExpectedAckSeq – the sequence number of the next I-frame expected to be
acknowledged by the receiving peer.
The receiving peer uses the following variables and sequence numbers:
All variables have the range 0 to 63. Arithmetic operations on state variables
(NextTXSeq, ExpectedTxSeq, ExpectedAckSeq, BufferSeq) and sequence numbers
(TxSeq, ReqSeq) contained in this document shall be taken mod 64.
I-frames contain TxSeq, the send sequence number of the I-frame. When an I-frame is
first transmitted, TxSeq is set to the value of the send state variable NextTXSeq. TxSeq
is not changed if the I-frame is retransmitted.
The CID sent in the information frame is the destination CID and identifies the remote
endpoint of the channel. A send state variable NextTxSeq shall be maintained for each
remote endpoint. NextTxSeq is the sequence number of the next in-sequence I-frame
to be transmitted to that remote endpoint. When the link is created NextTXSeq shall be
initialized to 0.
The CID sent in the information frame is the destination CID and identifies the remote
endpoint of the channel. An acknowledge state variable ExpectedAckSeq shall be
maintained for each remote endpoint. ExpectedAckSeq is the sequence number of the
next in-sequence I-frame that the remote receiving peer is expected to acknowledge.
(ExpectedAckSeq – 1 equals the TxSeq of the last acknowledged I-frame). When the
link is created ExpectedAckSeq shall be initialized to 0.
Note: If the next acknowledgment acknowledges a single I-frame then its ReqSeq will
be expectedAckSeq + 1.
If a valid ReqSeq is received from the peer then ExpectedAckSeq is set to ReqSeq.
A valid ReqSeq value is one that is in the range ExpectedAckSeq ≤ ReqSeq ≤
NextTxSeq.
Note: The comparison with NextTXSeq must be ≤ in order to handle the situations
where there are no outstanding I-frames.
These inequalities shall be interpreted in the following way: ReqSeq is valid, if and
only if (ReqSeq-ExpectedAckSeq) mod 64 ≤ (NextTXSeq-ExpectedAckSeq) mod 64.
ExpectedAckSeq NextTxSeq
TxWindow
F1 F2 F3 F4 F5 F6 F7 F8 F9
Figure 8.1 shows TxWindow=5, and three frames awaiting transmission. The frame with
number F7 may be transmitted when the frame with F2 is acknowledged. When the
frame with F7 is transmitted, TxSeq is set to the value of NextTXSeq. After TxSeq has
been set, NextTxSeq is incremented by one.
The sending peer expects to receive valid ReqSeq values, which are in the range
ExpectedAckSeq to NextTxSeq. Upon receipt of a ReqSeq value equal to the current
NextTxSeq all outstanding I-frames have been acknowledged by the receiver.
All I-frames and S-frames contain ReqSeq, the send sequence number (TxSeq) that the
receiving peer requests in the next I-frame.
Note: The option to set ReqSeq to BufferSeq instead of ExpectedTxSeq allows the
receiver to impose flow control for buffer management or other purposes. In this
situation, if BufferSeq<>ExpectedTxSeq, the receiver should also set the retransmission
disable bit to 1 to prevent unnecessary retransmissions.
Each channel shall have a receive state variable (ExpectedTxSeq). The receive state
variable is the sequence number (TxSeq) of the next in-sequence I-frame expected.
The value of the receive state variable shall be the last in-sequence, valid I-frame
received.
Note: Owing to the variable size of I-frames, updates of BufferSeq may be based on
changes in available buffer space instead of delivery of I-frame contents.
I-frames shall have sequence numbers in the range ExpectedTxSeq ≤ TxSeq <
(BufferSeq + TxWindow).
BufferSeq
ExpectedTxSeq Invalid TxSeq
values
TxWindow
F1 F2 F3 F4 F5 F6 F7 F8 F9
Figure 8.2 shows TxWindow=5. F1 is successfully received and pulled by the upper
layer. BufferSeq shows that F2 is the next I-frame to be pulled, and ExpectedTxSeq
points to the next I-frame expected from the peer. An I-frame with TxSeq equal to 5 has
been received thus triggering an SREJ or REJ exception. The star indicates I-frames
received but discarded owing to the SREJ or REJ exception. They will be resent as part
of the error recovery procedure.
In Figure 8.2 there are several I-frames in a buffer awaiting the SDU reassembly
function to pull them and the TxWindow is full. The receiver would usually disable
retransmission in Retransmission mode or Flow Control mode by setting the
Retransmission Disable Bit to 1 and send an RR back to the sending side. This
tells the transmitting peer that there is no point in performing retransmissions. Both
sides will send S-frames to make sure the peer entity knows the current value of the
Retransmission Disable Bit.
A new I-frame shall only be transmitted when the TxWindow is not full. No I-frames shall
be transmitted if the last RetransmissionDisableBit (R) received is set to one.
The state of the RetransmissionDisableBit (R) is stored and used along with the
state of the RetransmissionTimer to decide the actions when transmitting I-frames.
The RetransmissionTimer is running whenever I-frames have been sent but not
acknowledged.
If the last R received was set to zero, then I-frames may be transmitted. If there are any
I-frames which have been sent and not acknowledged then they shall be retransmitted
when the RetransmissionTimer elapses. If the retransmission timer has not elapsed
then a retransmission shall not be sent and only new I-frames may be sent.
Table 8.1 summarizes actions when the RetransmissionTimer is in use and R=0.
Table 8.1: Summary of actions when the RetransmissionTimer is in use and R=0
• If the MonitorTimer is running and has not elapsed, then no transmit action shall be
taken and no timer action shall be taken.
• If the MonitorTimer has elapsed, then an S-frame shall be sent and the MonitorTimer
shall be restarted.
If any I-frames become available for transmission, then the MonitorTimer shall be
stopped, the RetransmissionTimer shall be started, and the rules for when the
RetransmissionTimer is in use shall be applied.
When an I-frame is sent ReqSeq shall be set to ExpectedTxSeq, TxSeq shall be set to
NextTxSeq and NextTxSeq shall be incremented by one.
If the last R received was set to one, then I-frames shall not be transmitted. The only
frames which may be sent are S-frames. An S-frame shall be sent according to the
rules below:
• If the MonitorTimer is running and has not elapsed, then no transmit action shall be
taken and no timer action shall be taken.
• If the MonitorTimer has elapsed, then an S-frame shall be sent and the MonitorTimer
shall be restarted.
Upon receipt of a valid I-frame with TxSeq equal to ExpectedTxSeq, the frame shall be
accepted for the SDU reassembly function. ExpectedTxSeq is used by the reassembly
function.
The first valid I-frame received after an REJ was sent, with a TxSeq of the received
I-frame equal to ReqSeq of the REJ, shall clear the REJ Exception condition.
When the L2CAP layer has removed one or more I-frames from the buffer, BufferSeq
may be incremented in accordance with the amount of buffer space released. If
BufferSeq is incremented, an acknowledgment shall be sent to the peer entity.
If the MonitorTimer is active then it shall be restarted to indicate that a signal has been
sent to the peer L2CAP entity.
On receipt of a valid S-frame or I-frame, the ReqSeq contained in the frame shall
acknowledge previously transmitted I-frames. ReqSeq acknowledges I-frames with a
TxSeq up to and including ReqSeq – 1.
On receipt of a valid S-frame or I-frame the ReqSeq contained in the frame shall
acknowledge previously transmitted I-frames. ExpectedAckSeq shall be set to ReqSeq
to indicate that the I-frames with TxSeq up to and including (ReqSeq - 1) have been
acknowledged.
Upon receipt of a valid REJ frame, where ReqSeq identifies an I-frame not yet
acknowledged, the ReqSeq acknowledges I-frames with TxSeq up to and including
ReqSeq - 1. Therefore the REJ acknowledges all I-frames before the I-frame it is
rejecting.
A counter, TransmitCounter, counts the number of times an L2CAP PDU has been
transmitted. This shall be set to 1 after the first transmission. If the RetransmissionTimer
expires the following actions shall be taken:
Exception conditions may occur as the result of physical layer errors or L2CAP
procedural errors. The error recovery procedures which are available following the
detection of an exception condition at the L2CAP layer in Retransmission mode are
defined in this section.
A TxSeq sequence error exception condition occurs in the receiver when a valid I-frame
is received which contains a TxSeq value which is not equal to the expected value, thus
TxSeq is not equal to ExpectedTxSeq.
• Duplicated I-frame
The duplicated I-frame is identified by a TxSeq in the range BufferSeq to
ExpectedTxSeq – 1 (BufferSeq ≤TxSeq<ExpectedTxSeq). The ReqSeq and
RetransmissionDisableBit shall be processed according to Section 8.4.4. The
Information field shall be discarded since it has already been received.
• Out-of-sequence I-frame
The out-of-sequence I-frame is identified by a TxSeq within the valid range. The
ReqSeq and RetransmissionDisableBit shall be processed according to Section 8.4.4.
A REJ exception is triggered, and an REJ frame with ReqSeq equal to
ExpectedTxSeq shall be sent to initiate recovery. The received I-frame shall be
discarded.
• Invalid TxSeq
An invalid TxSeq value is a value that does not meet either of the above conditions.
An I-frame with an invalid TxSeq is likely to have errors in the control field and shall
be silently discarded.
An ReqSeq sequence error exception condition occurs in the transmitter when a valid
S-frame or I-frame is received which contains an invalid ReqSeq value. An invalid
ReqSeq is one that is not in the range ExpectedAckSeq ≤ ReqSeq ≤ NextTxSeq.
The L2CAP entity shall close the channel as a consequence of an ReqSeq Sequence
error.
If an L2CAP entity fails to receive an acknowledgment for the last I-frame sent, then it
will not detect an out-of-sequence exception condition and therefore will not transmit an
REJ frame.
The L2CAP entity that transmitted an unacknowledged I-frame shall, on the expiry of
the RetransmissionTimer, take appropriate recovery action as defined in Section 8.4.6.
Any frame received which is invalid (as defined in Section 3.3.6) shall be discarded, and
no action shall be taken as a result of that frame.
When a link is configured to work in flow control mode, the flow control operation is
similar to the procedures in retransmission mode, but all operations dealing with CRC
errors in received packets are not used. Therefore
Assuming that the TxWindow size is equal to the buffer space available in the receiver
(counted in number of I-frames), in flow control mode the number of unacknowledged
frames in the transmitter window is always less than or equal to the number of frames
for which space is available in the receiver.
Missing ExpectedTxSeq
(lost or BufferSeq
corrupted) Invalid TxSeq
I-frame values
TxWindow
1 2 3 4 5 6 7 8 9
Figure 8.3: Overview of the receiver side when operating in Flow Control mode
A new I-frame shall only be transmitted when the TxWindow is not full.
The control field parameter ReqSeq shall be set to ExpectedTxSeq, TxSeq shall be set
to NextTXSeq and NextTXSeq shall be incremented by one.
Upon receipt of a valid I-frame with TxSeq equal to ExpectedTxSeq, the frame shall
be made available to the reassembly function. ExpectedTxSeq shall be incremented by
one. An acknowledgment shall not be sent until the SDU reassembly function has pulled
the I-frame.
Upon receipt of a valid I-frame with an out-of-sequence TxSeq (see Section 8.5.6) all
frames with a sequence number less than TxSeq shall be assumed lost and marked
as missing. The missing I-frames are in the range from ExpectedTxSeq (the frame that
the device was expecting to receive) up to TxSeq-1, (the frame that the device actually
received). ExpectedTxSeq shall be set to TxSeq +1. The received I-frame shall be
made available for pulling by the reassembly function. The acknowledgment shall not
occur until the SDU reassembly function has pulled the I-frame. The ReqSeq shall be
processed according to Section 8.5.4.
When the L2CAP layer has removed one or more I-frames from the buffer, BufferSeq
may be incremented in accordance with the amount of buffer space released. If
BufferSeq is incremented, an acknowledgment shall be sent to the peer entity. If the
MonitorTimer is active then it shall be restarted to indicate that a signal has been sent to
the peer L2CAP entity.
Whenever a data Link Layer entity transmits an I-frame or a S-frame, ReqSeq shall be
set to ExpectedTxSeq or BufferSeq.
On receipt of a valid S-frame or I-frame the ReqSeq contained in the frame shall be
used to acknowledge previously transmitted I-frames. ReqSeq acknowledges I-frames
with a TxSeq up to and including ReqSeq – 1.
ExpectedAckSeq shall be set to ReqSeq to indicate that the I-frames with TxSeq up to
and including ExpectedAckSeq have been acknowledged.
Exception conditions may occur as the result of physical layer errors or L2CAP
procedural errors. The error recovery procedures which are available following the
detection of an exception condition at the L2CAP layer in flow control only mode are
defined in this section.
A TxSeq sequence error exception condition occurs in the receiver when a valid I-frame
is received which contains a TxSeq value which is not equal to the expected value, thus
TxSeq is not equal to ExpectedTxSeq.
• Duplicated I-frame
The duplicated I-frame is identified by a TxSeq in the range BufferSeq to
ExpectedTxSeq – 1. The ReqSeq shall be processed according to Section 8.5.4.
The Information field shall be discarded since it has already been received.
• Out-of-sequence I-frame
The out-of-sequence I-frame is identified by a TxSeq such that ExpectedTxSeq <
TxSeq < (BufferSeq + TxWindow). The ReqSeq shall be processed according to
Section 8.5.4.
The missing I-frame(s) are considered lost and ExpectedTXSeq is set equal to
TxSeq+1 as specified in Section 8.5.2. The missing I-frame(s) are reported as lost
to the SDU reassembly function.
• Invalid TxSeq
An invalid TxSeq value is a value that does not meet either of the above conditions
and TxSeq is not equal to ExpectedTxSeq. An I-frame with an invalid TxSeq is likely
to have errors in the control field and shall be silently discarded.
An ReqSeq sequence error exception condition occurs in the transmitter when a valid
S-frame or I-frame is received which contains an invalid ReqSeq value. An invalid
ReqSeq is one that is not in the range ExpectedAckSeq ≤ ReqSeq ≤ NextTXSeq.
The L2CAP entity shall close the channel as a consequence of an ReqSeq Sequence
error.
Any frame received that is invalid (as defined in Section 3.3.6) shall be discarded, and
no action shall be taken as a result of that frame, unless the receiving L2CAP entity is
configured to deliver erroneous frames to the layer above L2CAP. In that case, the data
contained in invalid frames may also be added to the receive buffer and made available
for pulling from the SDU reassembly function.
permission from the other L2CAP entity. A transmission may contain single or multiple
frames and shall be used for I-frame transfer and/or to indicate status change.
Enhanced Retransmission mode uses I-frames to transfer upper layer information and
S-frames for supervision. There are four S-frames defined: Receiver Ready (RR),
Reject (REJ), Receiver Not Ready (RNR), and Selective Reject (SREJ). All frames
formats in Enhanced Retransmission mode shall use the Enhanced Control Field.
An RR with P-bit set to 1 (P=1) is used to indicate the clearance of any busy condition
that was initiated by an earlier transmission of an RNR frame by the same L2CAP entity.
The REJ frame shall be used by an L2CAP entity to request retransmission of I-frames
starting with the frame numbered ReqSeq. I-frames numbered ReqSeq - 1 and below
shall be considered acknowledged. Additional I-frames awaiting initial transmission may
be transmitted following the retransmitted I-frame(s) up to the TxWindow size of the
receiver.
At most only one REJ exception from a given L2CAP entity to another L2CAP entity
shall be established at any given time. A REJ frame shall not be transmitted until an
earlier REJ exception condition or all earlier SREJ exception conditions have been
cleared. The REJ exception condition shall be cleared upon the receipt of an I-frame
with TxSeq equal to the ReqSeq of the REJ frame.
Two L2CAP entities may be in REJ exception conditions with each other at the same
time.
The RNR frame shall be used by an L2CAP entity to indicate a busy condition
(i.e. temporary inability to receive I-frames). I-frames numbered up to and including
ReqSeq - 1 shall be considered acknowledged. The I-frame numbered ReqSeq and
any subsequent I-frames sent shall not be considered acknowledged. The acceptance
status of these I-frames shall be indicated in subsequent transfers.
The SREJ frame shall be used by an L2CAP entity to request retransmission of one
I-frame. The ReqSeq shall indicate the TxSeq of the earliest I-frame to be retransmitted
(not yet reported by a SREJ). If the P-bit is set to 1 then I-frames numbered up to and
including ReqSeq -1 shall be considered acknowledged. If the P-bit is set to 0 then the
ReqSeq field in the SREJ shall not indicate acknowledgment of I-frames.
Each SREJ exception condition shall be cleared upon receipt of an I-frame with TxSeq
equal to the ReqSeq sent in the SREJ frame.
An L2CAP entity may transmit one or more SREJ frames with the P=0 before one or
more earlier SREJ exception conditions initiated with SREJ(P=0) have been cleared.
An L2CAP entity shall not transmit more than one SREJ with P=1 before all earlier
SREJ exception conditions have been cleared. A SREJ frame shall not be transmitted
if an earlier REJ exception condition has not been cleared. Likewise a REJ frame shall
not be transmitted if one or more SREJ exception conditions have not been cleared.
Only one I-frame shall be retransmitted in response to receiving a SREJ frame with
P=0. Additional I-frames awaiting initial transmission may be transmitted following the
retransmission of the specific I-frame requested by SREJ with P=1.
P-bit set to 1 shall be used to solicit a response frame with the F-bit set to 1 from the
remote L2CAP entity at the earliest respond opportunity. At most only one frame with a
P=1 shall be outstanding in a given direction at a given time. Before an L2CAP entity
issues another frame with P=1, it shall have received a response frame from the remote
L2CAP entity with F=1. If no valid frame is received with F=1 within Monitor timeout
period, the frame with P=1 may be retransmitted.
The Final bit shall be used to indicate the frame as a response to a soliciting poll
(S‑frame with P=1). The frame with F=1 shall not be retransmitted. The Monitor-timeout
is not used to monitor lost frames with F=1. Additional frames with F=0 may be
transmitted following the frame with F=1.
S-frames shall not be transmitted with both the F-bit and the P-bit set to 1 at the same
time.
Timers are started upon transmission of a packet. Timers should be started when the
corresponding packet leaves the Controller (transmitted or flushed). If the timer is not
started when the packet leaves the Controller then it shall be started when the packet
is delivered to the Controller. The specific rules for BR/EDR and BR/EDR/LE Controllers
are described in the following sections.
If a flush timeout does not exist on the ACL-U logical link for the channel using
Enhanced Retransmission mode then the value for the Retransmission timeout shall be
at least two seconds and the value for the Monitor timeout shall be at least 12 seconds.
If a flush timeout exists on the link for Enhanced Retransmission mode then the value
for the Retransmission timeout shall be three times the value of flush timeout, subject to
a minimum of 1 second and maximum of 2 seconds.
If a flush timeout exists on the link for Enhanced Retransmission mode and both sides
of the link are configured to the same flush timeout value then the monitor timeout shall
be set to a value at least as large as the Retransmission timeout otherwise the value of
the Monitor timeout shall be six times the value of flush timeout, subject to a minimum of
the retransmission timeout value and a maximum of 12 seconds.
If an L2CAP entity knows that a specific packet has been flushed instead of transmitted
then it may execute proper error recovery procedures immediately.
When configuring a channel over an ACL-U logical link the values sent in an
L2CAP_CONFIGURATION_REQ packet for Retransmission timeout and Monitor
timeout shall be 0.
Note: If the link has a flush timeout and the Non-Flushable Packet Boundary Flag
feature is used to mark the Enhanced Retransmission mode packets as non-flushable
then the link does not have a flush timeout with regards to Enhanced Retransmission
mode.
1. The state machine pair specifies the behavior of the protocol. Designers and
implementers may choose any design / implementation technique they wish, but
it shall behave in a manner identical to the external behavior of the specified state
machines.
2. There is a single state machine pair for each active L2CAP channel configured to
use Enhanced Retransmission mode.
3. Variables are used to limit the number of states by maintaining the state of
particular conditions. The variables are defined in Section 8.6.5.2.
4. For some combinations of event and condition, the state tables provide an action
that involves alternatives or alternative groups of actions. The alternatives are
mutually exclusive; selection of an alternate is done based upon (i) local status,
(ii) a layer management action, or (iii) an implementation decision. There is no
relationship between the order of the alternatives between events, nor is it implied
that the same alternative must be selected every time the event occurs.
5. The state tables use timers. Any Start Timer action restarts the specified timer from
its initial value, even if the timer is already running. When the timer reaches 0 the
appropriate timer expired event is set and the timer stops. The Stop Timer action
stops a timer if it is running.
6. Events not recognized in a particular state are assumed to remain pending until
any masking flag is modified or a transition is made to a state where they can be
recognized.
7. Some state transitions and actions are triggered by internal events (e.g. requests
from the upper layer). It is implementation specific how these internal events are
realized. They are used for clarity in specifying the state machine. All events
including Internal events are described in Section 8.6.5.3.
8. The state machines specify the exact frames to be sent by transmitters but are
relaxed on what receivers are allowed to accept as valid. For example there are
cases where the transmitter is required to send a frame with P=1. The correct
response is a frame with F=1 but in some cases the receiver is allowed to accept a
frame with F=0 in addition to F=1.
The state diagram in Figure 8.4 shows the states and the main transitions. Not all
events are shown on the state diagram.
SREJ_
SENT
RECV WAIT_F
REJ_
SENT
XMIT
Note 1: Implementations may choose
between sending an REJ or SREJ
when receiving an I-frame with
Transmitter State Machine
Unexpected TxSeq
The Receiver state machine “calls” the Transmitter state machine using the PassToTx
action. This shows up in the Transmitter state machine as an event. When the
Transmitter state machine is called it runs to completion before returning to the Receiver
state machine. Running to completion means that all actions are executed and the
Transmitter state is changed to the new state.
The Receiver and Transmitter state machine share variables and timers.
8.6.5.2 States
The following states have been defined to specify the protocol; the actual number of
states and naming in a given implementation is outside the scope of the specification:
REJ_SENT—The L2CAP entity has sent a REJ frame to cause the remote L2CAP
entity to resend I-frame(s). The L2CAP entity is waiting for the I-frame with a TxSeq
that matches the ReqSeq sent in the REJ. Whether to send a REJ versus a SREJ is
implementation dependent.
SREJ_SENT—The L2CAP entity has sent one or more SREJ frames to cause the
remote L2CAP entity to resend missing I-frame(s). The local L2CAP entity is waiting for
all requested I-frames to be received. If additional missing I-frames are detected while in
SREJ_SENT then additional SREJ frames or a REJ frame can be sent to request those
I-frames. Whether to send a SREJ versus a REJ is implementation dependent.
WAIT_F—Local busy has been cleared or the Retransmission timer has expired and an
S-frame with P=1 has been sent. The local L2CAP entity is waiting for a frame with F=1.
New I-frames cannot be sent while in the WAIT_F state to prevent the situation where
retransmission of I-frames could result in the channel being disconnected.
Variables are used to limit the number of states and help clarify the state chart tables.
Variables can be set to values, evaluated in conditions and compared in conditional
statements. They are also used in the action descriptions. Below is a list of the
operators, connectives and statements that can be used with variables.
Operator, Description
connective or statement
:= Assignment operator. Used to set a variable to a value
= Relational operator "equal"
> Relational operator "greater than"
< Relational operator "less than"
≥ Relational operator "greater than or equal"
≤ Relational operator "less than or equal"
+ Arithmetic operator "plus"
Operator, Description
connective or statement
and logical connective "and." It returns TRUE if both operands are TRUE
otherwise it returns FALSE.
or logical connective "or." It returns TRUE if either of its operands are
TRUE otherwise it returns FALSE.
if (expression) then { Conditional Statement. If expression is TRUE then the statement is
executed otherwise the statement is not executed. The statement is
statement
composed of one or more actions. All the actions in the statement are
} indented under the if ... then clause and contained within braces “{ }”.
if (expression) then { Conditional Statement. If expression is TRUE then statement1 is exe-
cuted otherwise statement2 is executed. A statement is composed of
statement1
one or more actions. All the actions in the statement1 are indented
} under the if ... then clause and contained within braces “{ }”. All the ac-
else { tions of statement2 are indented under the else clause and contained
within braces “{ }”.
statement2
}
Enhanced Retransmission mode uses the following variables and sequence numbers
described in Section 8.3:
• TxSeq
• NextTxSeq
• ExpectedAckSeq
• ReqSeq
• ExpectedTxSeq
• BufferSeq
In addition to the variables above the following variables and timers are used:
RemoteBusy—when set to TRUE RemoteBusy indicates that the local L2CAP entity
has received an RNR from the remote L2CAP entity and considers the remote L2CAP
entity as busy. When the remote device is busy it will likely discard I-frames sent to it.
The RemoteBusy flag is set to FALSE when the local L2CAP Entity receives an RR,
REJ or SREJ. When set to FALSE the local L2CAP entity considers the remote L2CAP
entity able to accept I-frames. When the channel is created RemoteBusy shall be set to
FALSE.
LocalBusy—when set to TRUE, LocalBusy indicates the local L2CAP entity is busy
and will discard received I-frames. When set to FALSE the local L2CAP entity is not
busy and is able to receive I-frames. When the channel is created LocalBusy shall be
set to FALSE.
SrejList—is a list of TxSeq values for I-frames that are missing and need to be
retransmitted using SREJ. A SREJ has already been sent for each TxSeq on the list.
When SrejList is empty it equals 0 (i.e. SrejList = 0). If SrejList is not empty it is greater
than 0 (i.e. SrejList > 0).
RetryIframes[ ]—holds a retry counter for each I-frame that is sent within the receiving
device's TxWindow. Each time an I-frame is retransmitted the corresponding counter
within RetryIframes is incremented by one. When an attempt to retransmit the I-frame is
made and the counter is equal to MaxTransmit then the channel shall be closed.
RNRsent—when set to TRUE it means that the local L2CAP entity has sent an RNR
frame. It is used to determine if the L2CAP entity needs to send an RR to the remote
L2CAP entity to clear the busy condition. When the channel is created RNRsent shall
be set to FALSE.
RejActioned—is used to prohibit a frame with F=1 from causing I-frames already
retransmitted in response to a REJ from being retransmitted again. RejActioned is set to
TRUE if a received REJ is actioned when a frame sent with P=1 is unanswered. When
the channel is created RejActioned shall be set to FALSE.
SendRej—when set to TRUE it indicates that the local L2CAP entity has determined
that a REJ should be sent in the SREJ_SENT state while processing received I-frames.
The sending of new SREJ frames is stopped. When the channel is created SendRej
shall be set to FALSE.
BufferSeqSrej—is used while in the SREJ_SENT state to keep track of the value to
which BufferSeq will be set upon exit of the SREJ_SENT state.
FramesSent—is used to keep track of the number I-frames sent by the Send-Data and
Retransmit-I-frames actions.
MonitorTimer—The Monitor Timer is used to detect lost S-frames. When the channel is
created the MonitorTimer shall be off.
8.6.5.4 Events
Data-Request—The upper layer has requested that an SDU be sent. The SDU may
need to be broken into multiple I-frames by L2CAP based on the MPS of the remote
device and/or the maximum PDU allowed by the HCI or QoS requirements of the
system.
Local-Busy-Detected—A local busy condition occurs when the local L2CAP entity is
temporarily unable to receive, or unable to continue to receive, I-frames due to internal
constraints. For example, the upper layer has not pulled received I-frames and the
local L2CAP entity needs to send an acknowledgment to the remote L2CAP entity.
The method for handling the detection of local busy is implementation specific. An
implementation may wait to send an RNR to see if the busy condition will clear before
the remote L2CAP entity's Retransmission timer expires. If the busy condition clears
then frames can be acknowledged with an RR or I-frame. If the busy condition does not
clear before the remote L2CAP entity's Retransmission timer expires then an RNR shall
be sent in response to the RR or RNR poll sent by the remote L2CAP entity. Optionally
an implementation may send an RNR as soon as the local busy condition is detected.
Local-Busy-Clear—The local busy condition clears when L2CAP has buffer space to
receive more I-frames (i.e. SDU Reassembly function and/or upper layer has pulled
I-frames) and if necessary the upper layer has cleared the busy condition.
Recv Fbit—This is an event generated by the Receiver state machine. It contains the
F-bit value of a received frame. The value of the F-bit can be checked in a condition.
Recv RR, REJ, RNR, SREJ (P=x) or (F=x)—Receive a specific S-frame (RR, REJ,
etc.) with a specific value for the P and/or F bit. The F-bit and the P-bit shall not both be
set to 1 in a transmitted S-frame so received S-frames with both P and F set to 1 should
be ignored. If the P and/or F bit value is not specified in the event then either value is
accepted.
Recv RRorRNR—Receive an RR or RNR with any value for the P-bit and F-bit.
Recv REJorSREJ—Receive an REJ or SREJ with any value for the P-bit and F-bit.
Recv frame—This is catch-all for all frames that are not explicitly declared as events in
the state table.
8.6.5.5 Conditions
RNRsent = TRUE or FALSE—TRUE indicates an RNR has been sent while a local
busy condition exists. It is set to FALSE when the local busy condition clears.
F = 0 or 1—the F-bit of a received frame is checked. The F-bit of the received frame is
available as part of the Recv ReqSeqAndFbit and Recv Fbit events.
SendRej = TRUE or FALSE—TRUE indicates that a REJ will be sent after all frames
requested using SREJ have been received.
8.6.5.6 Actions
Send I-frame with TxSeq set to NextTxSeq and ReqSeq set to BufferSeq.
UnackedList[NextTxSeq] := I-frame
UnackedFrames := UnackedFrames + 1
FramesSent := FramesSent + 1
RetryIframes[NextTxSeq] := 1
NextTxSeq := (NextTxSeq + 1) mod MaxTxWin
Start-RetransTimer
Send RR, RNR (P=x) or (F=x)—Send the specified S-frame with the specified value for
the P-bit or F-bit. If a value for the P-bit or F-bit is not specified the value shall be 0. For
example Send RR(P=1) means send an RR with the P-bit set to 1 and the F-bit set to 0.
The ReqSeq field shall be set to BufferSeq. If an RNR is sent, RNRsent shall be set to
TRUE.
Send REJ (P =x) or (F=x)—Send a REJ with the specified value for the P-bit or F-bit.
The ReqSeq field shall be set to ExpectedTxSeq. If a value for the P-bit or F-bit is not
specified the value shall be 0, which acknowledges previously received I-frames up to
ExpectedTxSeq—1 and may allow the remote L2CAP entity to transmit new I-frames.
If the local L2CAP entity is not in a position to acknowledge the previously received
I-frames it may use SREJ(P=0) or RNR. It may also wait to send the REJ until it is able
to acknowledge the I-frames.
Send RRorRNR (P=x) or (F=1)—Send an RR or RNR with the specified value for the
P-bit or F-bit based on the value of LocalBusy. If a value for the P-bit or F-bit is not
specified the value shall be 0. An RNR shall be sent if LocalBusy equals TRUE. If
LocalBusy equals FALSE then an RR shall be sent.
FramesSent:=0
if LocalBusy = TRUE then {
Send RNR(F=1)
}
if RemoteBusy = TRUE and UnackedFrames > 0 then {
Start-RetransTimer
}
RemoteBusy := FALSE
Send-Pending-I-frames
if LocalBusy = FALSE and FramesSent = 0 then {
Send RR(F=1)
}
Send SREJ—Send one or more SREJ frames with P=0. For each missing I-frame
starting with ExpectedTxSeq up to but not including the TxSeq of the received I-frame,
an SREJ frame is sent with ReqSeq set to the TxSeq of the missing frame. The TxSeq
is inserted into the tail of SrejList. For example if ExpectedTxSeq is 3 and the received
I-frame has a TxSeq of 5 there are two missing I-frames. An SREJ with ReqSeq 3 is
sent followed by an SREJ with ReqSeq 4. TxSeq 3 is inserted first into SrejList followed
by TxSeq 4. After all SREJ frames have been sent ExpectedTxSeq shall be set to (the
TxSeq of the received I-frame + 1) mod MaxTxWin.
Send SREJ(SrejList)—Send one or more SREJ frames with P=0. An I-frame was
received that matches one of the TxSeq values in the SrejList but does not match the
head of SrejList. This means I-frames requested via SREJ are still missing. For each
TxSeq value starting with the head of SrejList and going backwards (i.e., from the head
towards the tail) through the SrejList up to but not including the TxSeq of the received
frame, an SREJ frame is sent with ReqSeq set to the TxSeq from SrejList. The TxSeq is
removed from SrejList and reinserted into the tail of SrejList. Finally, remove the TxSeq
of the received frame from the head of the list.
Start-RetransTimer—If the Monitor timer is not running then start the Retransmission
Timer from its initial value (see Retransmission timeout in Section 5.4). If the
Retransmission timer is already running it is restarted from its initial value. If the Monitor
timer is running then the Retransmission timer is not started.
Start-MonitorTimer—Start the Monitor Timer from its initial value (see Monitor timeout
in Section 5.4). If the timer is already running it is restarted from its initial value.
PassToTx—Pass the ReqSeq and F-bit value of a received frame to the Transmitter
state machine. This will show up as a Recv ReqSeqAndFbit event in the Transmitter
state machine.
Send-Ack (F=x)—an acknowledgment with the specified value for the F-bit may be
sent. This action may occur in an action block with other actions that also send frames.
If a frame has already been sent then it is not necessary to send additional frames.
If the value for the F-bit is not specified it shall be set to 0. If the value specified
is P then the F-bit shall be set equal to the value of the P-bit of the received frame
being acknowledged. If more than one frame is sent in the acknowledgment only
the first frame shall have an F-bit set to 1. An acknowledgment is an RR, RNR, or
pending I-frame(s) (I-frames that have not been transmitted yet). If pending I-frames
are available and are allowed to be sent then as many as allowed should be sent as
an acknowledgment. Sending an RR or RNR as an acknowledgment for each received
I-frame is not required. An implementation may wait to send an RR or RNR until a
specific number of I-frames have been received, after a certain period of time has
elapsed or some other algorithm. To keep data flowing it is recommended that an
acknowledgment be sent before the TxWindow is full. It should also be noted that the
maximum size of a remote L2CAP entity's unacknowledged I-frame list may be smaller
than the local L2CAP entity's TxWindow. Therefore the local L2CAP entity should not
expect the remote L2CAP entity to send enough frames to fill its TxWindow and should
acknowledge I-frames accordingly.
StoreOrIgnore—If the local L2CAP entity has room to store the received I-frame
then it may store it otherwise it shall discard it. If the received I-frame is stored,
ExpectedTxSeq is advanced as follows:
PbitOutstanding—If the Transmitter state machine of the local L2CAP entity is in the
WAIT_F state then return TRUE otherwise return FALSE.
or With-Invalid-ReqSeq
Recv With-Invalid-ReqSeq Close Channel none
RRorRNR
Recv REJorS- With-Invalid-ReqSeq-Retrans Close Channel none
REJ
• RR, REJ, RNR and SREJ frames shall not be used in Streaming mode.
• The F-bit shall always be set to zero in the transmitter, and shall be ignored in the
receiver.
• the MonitorTimer and RetransmissionTimer shall not be used in Streaming mode.
A channel configured to work in Streaming mode shall be configured with a finite value
for the Flush Timeout on the transmitter.
When transmitting a new I-frame the control field parameter ReqSeq shall be set to 0,
TxSeq shall be set to NextTXSeq and NextTXSeq shall be incremented by one.
Upon receipt of a valid I-frame with TxSeq equal to ExpectedTxSeq, the frame shall
be made available to the reassembly function. ExpectedTxSeq shall be incremented by
one.
Upon receipt of a valid I-frame with an out-of-sequence TxSeq (see Section 8.7.3.1) all
frames with a sequence number less than TxSeq shall be assumed lost and marked as
missing. The missing I-frames are in the range from ExpectedTxSeq (the frame that the
device was expecting to receive) up to and including TxSeq - 1. ExpectedTxSeq shall
be set to TxSeq +1. The received I-frame shall be made available for pulling by the
reassembly function. The ReqSeq shall be ignored.
Note: It is possible for a complete window size of I-frames to be missing and thus,
no missing I-frames are detected. For example, when a window size of 63 is used
this situation occurs when 63 I-frames in a row are missing. If the ability to not detect
missing I-frames will cause problems for an application, it is recommended that the
Extended Window Size option be used.
If there is no buffer space for the received I-frame an existing I-frame (i.e. the oldest)
shall be discarded (flushed) freeing up buffer space for the new I-frame. The discarded
I-frame shall be marked as missing.
Exception conditions may occur as the result of physical layer errors or L2CAP
procedural errors. The error recovery procedures which are available following the
detection of an exception condition at the L2CAP layer in Streaming mode are defined
in this section.
A TxSeq sequence error exception condition occurs in the receiver when a valid I-frame
is received which contains a TxSeq value which is not equal to the expected value, thus
TxSeq is not equal to ExpectedTxSeq.
There are two credit-based flow control modes: LE Credit Based Flow Control mode
and Enhanced Credit Based Flow Control mode.
Note: When encryption is not enabled, the result value “Connection refused –
insufficient authentication” does not indicate that MITM protection is required.
Enhanced Credit Based Flow Control mode is used for L2CAP connection-oriented
channels on LE and BR/EDR with flow control using a credit-based scheme for L2CAP
data (i.e. not signaling packets). The ACL logical transport shall have an infinite
Automatic Flush Timeout.
Note: When encryption is not enabled, the result value “All connections refused -
insufficient authentication” does not indicate that MITM protection is required.
See [Vol 3] Part C, Section 5.2.2 for the requirements for responding to a received
L2CAP_CREDIT_BASED_CONNECTION_REQ packet.
The examples in this appendix describe a sample of the multiple possible configuration
scenarios that might occur.
Figure A.1 illustrates the basic configuration process. In this example, the devices
exchange MTU information. All other values are assumed to be default.
Device A Device B
L2CA L2CA
ConfigureChannel_Req
Option=0x01
[MTU=0x00000100]
L2CAP_CONFIGURATION_REQ
L2CAP_CONFIGURATION_RSP
ConfigureChannel_Req
Option=0x01
[MTU=0x00000200]
L2CAP_CONFIGURATION_REQ
L2CAP_CONFIGURATION_RSP
Figure A.2 illustrates how two devices interoperate even though one device supports
more options than the other does. Device A is an upgraded version. It uses a
hypothetically defined option type 0x20 for link-level security. Device B rejects the
command using the L2CAP_CONFIGURATION_RSP packet with result ‘unknown
parameter’ informing Device A that option 0x20 is not understood. Device A then
resends the request omitting option 0x20. Device B notices that it does not need to
such a large MTU and accepts the request but includes in the response the MTU option
informing Device A that Device B will not send an L2CAP packet with a payload larger
than 0x80 octets over this channel. On receipt of the response, Device A could reduce
the buffer allocated to hold incoming traffic.
Device A Device B
L2CA L2CA
ConfigureChannel_Req
Option=0x01
[MTU=0x00000100]
Option=0x20 L2CAP_CONFIGURATION_REQ
[Data=0xFA12D823]
L2CAP_CONFIGURATION_RSP
L2CAP_CONFIGURATION_REQ
L2CAP_CONFIGURATION_RSP
ConfigureChannel_Req
Option=0x01
[MTU=0x00000200]
L2CAP_CONFIGURATION_REQ
L2CAP_CONFIGURATION_RSP
Figure A.3 illustrates an unsuccessful configuration request. There are two problems
described by this example. The first problem is that the configuration request
is placed in an L2CAP packet that cannot be accepted by the remote device,
due to its size. The remote device informs the sender of this problem using the
L2CAP_COMMAND_REJECT_RSP message. Device A then resends the configuration
options using two smaller L2CAP_CONFIGURATION_REQ messages.
The second problem is an attempt to configure a channel with an invalid CID. For
example device B may have no open connection on that CID (0x01234567 in this
example case).
Device A Device B
L2CA L2CA
ConfigureChannel_Req
L2CAP_CONFIGURATION_REQ
ID=0x1234
DCID=0x01234567
Option=0x01
[MTU=0x00000100]
Option=0x20
[Data=BIG]
L2CAP_COMMAND_REJECT_RSP
ID=0x1234
Reason=0x0001
(MTU exceeded)
Data=0x80
L2CAP_CONFIGURATION_REQ
ID=0x1235
DCID=0x01234567
Option=0x01
[MTU=0x00000100]
C flag set to 1
Co
nfig
A P_ _ ura
tion
L 2 C N D P D
A
M _R S C r
ID= D= eque
I
M
COJECT35 02 0x 0x1 st
RE 0x12 0x00 Op01234236
= tio 5
=
ID aso IDn ) [Da n=0x67
Re alid C ta= 20
BIG
(Inv ]
L2CAP_COMMAND_REJECT_RSP
ID=0x1236
Reason=0x0002
(Invalid CID)
Previous versions of this specification used different names for the signalling packets
defined in Section 4. Table B.1 shows the previous and current names of these packets.
SERVICE DISCOVERY
PROTOCOL (SDP)
SPECIFICATION
CONTENTS
1 INTRODUCTION
1.5 Conventions
1.5.1 Bit and byte ordering conventions
When multiple bit fields are contained in a single byte and represented in a drawing
in this Part, the more significant (high-order) bits are shown toward the left and less
significant (low-order) bits toward the right.
Multiple-byte fields are drawn with the more significant bytes toward the left and the less
significant bytes toward the right. Multiple-byte fields are transferred in network byte
order. See Section 4.1.
2 OVERVIEW
The service discovery mechanism provides the means for client applications to discover
the existence of services provided by server applications as well as the attributes of
those services. The attributes of a service include the type or class of service offered
and the mechanism or protocol information needed to utilize the service.
From the perspective of the Service Discovery Protocol (SDP), the configuration shown
in Figure 2.1 can be simplified to that shown in Figure 2.2.
SDP involves communication between an SDP Server and an SDP Client. The server
maintains an SDP database which consists of a list of service records that describe
the characteristics of services associated with the server. Each service record contains
information about a single service. A client can retrieve information from a service
record maintained by the SDP Server by issuing an SDP request.
If the client, or an application associated with the client, decides to use a service, it
opens a separate connection to the service provider in order to utilize the service. SDP
provides a mechanism for discovering services and their attributes (including associated
service access protocols), but it does not provide a mechanism for utilizing those
services (such as delivering the service access protocols).
If multiple applications on a device provide services, an SDP Server can act on behalf of
those service providers to handle requests for information about the services that they
provide. Similarly, multiple client applications can utilize an SDP Client to query servers
on behalf of the client applications.
The set of SDP Servers that are available to an SDP Client will change dynamically
based on the RF proximity of the servers to the client. When a server becomes
available, a potential client must be notified by a means other than SDP so that the
client can use SDP to query the server about its services. Similarly, when a server
leaves proximity or becomes unavailable for any reason, there is no explicit notification
via the Service Discovery protocol. However, the client can use SDP to poll the server
and may infer that the server is not available if it no longer responds to requests.
A service is any entity that can provide information, perform an action, or control
a resource on behalf of another entity. A service may be implemented as software,
hardware, or a combination of hardware and software.
All of the information about a service that is maintained by an SDP Server is contained
within a single service record. The service record shall only be a list of service
attributes.
A service record handle is a 32-bit number that shall uniquely identify each service
record within an SDP Server. In general, each handle is unique only within each SDP
Server. If SDP Server S1 and SDP Server S2 both contain identical service records
(representing the same service), the service record handles used to reference these
identical service records are completely independent. The handle used to reference the
service on S1 will be meaningless if presented to S2.
The Service Discovery protocol does not provide a mechanism for notifying clients
when service records are added to or removed from an SDP Server. While an L2CAP
(Logical Link Control and Adaptation Protocol) connection is established to a server, a
service record handle acquired from the server shall remain valid unless the service
record it represents is removed. If a service is removed from the server, further requests
to the server (during the L2CAP connection in which the service record handle was
acquired) using the service’s (now stale) record handle shall result in an error response
indicating an invalid service record handle. An SDP Server shall ensure that no service
record handle values are re-used while an L2CAP connection remains established.
Service record handles shall remain valid across successive L2CAP connections
while the ServiceDatabaseState attribute value remains unchanged. Further, service
record handles should remain valid until such time that the corresponding service is
permanently removed or changes in an incompatible way. See the ServiceRecordState
and ServiceDatabaseState attributes in Section 5.
A device may have a service record with a service record handle of 0x00000000
representing the SDP Server itself. This service record contains attributes for the SDP
Server and the protocol it supports. For example, one of its attributes is the list of SDP
protocol versions supported by the server.
See Section 5.1 for attribute definitions that are common to all service records. Service
providers can also define their own service attributes.
2.3.1 Attribute ID
A service class definition specifies each of the attribute IDs for a service class and
assigns a meaning to the attribute value associated with each attribute ID. Each
attribute ID is defined to be unique only within each service class.
All services belonging to a given service class assign the same meaning to each
particular attribute ID. See Section 2.4.
The attribute value is a variable length field whose meaning is determined by the
attribute ID associated with it and by the service class of the service record in which
the attribute is contained. In the Service Discovery protocol, an attribute value is
represented as a data element. (See Section 3.) Generally, any type of data element
is permitted as an attribute value, subject to the constraints specified in the service
class definition that assigns an attribute ID to the attribute and assigns a meaning to the
attribute value. See Section 5, for attribute value examples.
Each service class is also assigned a unique identifier. This service class identifier is
contained in the attribute value for the ServiceClassIDList attribute, and is represented
as a UUID (see Section 2.5.1). Since the format and meanings of many attributes
in a service record are dependent on the service class of the service record, the
ServiceClassIDList attribute is very important. Its value shall be examined or verified
before any class-specific attributes are used. Since all of the attributes in a service
record must conform to all of the service’s classes, the service class identifiers
contained in the ServiceClassIDList attribute are related. Typically, each service class is
a subclass of another class whose identifier is contained in the list. A service subclass
definition differs from its superclass in that the subclass contains additional attribute
definitions that are specific to the subclass.
When a new service class is defined that is a subclass of an existing service class,
the new service class retains all of the attributes defined in its superclass. Additional
attributes may be defined that are specific to the new service class. In other words, the
mechanism for adding new attributes to some of the instances of an existing service
class is to create a new service class that is a subclass of the existing service class.
If a Service Class UUID is exposed in the SDP database of a product, then the product
containing the SDP record shall comply with the specification which defines the service
corresponding to the UUID.
DuplexColorPostscriptPrinterServiceClassID,
ColorPostscriptPrinterServiceClassID,
PostscriptPrinterServiceClassID,
PrinterServiceClassID
This example is only illustrative. This is not necessarily a practical printer class
hierarchy.
The Service Search transaction allows a client to retrieve the service record handles
for particular service records based on the values of attributes contained within those
service records. Once an SDP Client has a service record handle, it can request the
values of specific attributes.
The capability search for service records based on the values of arbitrary attributes
is not provided. Rather, the capability is provided to search only for attributes whose
values are Universally Unique Identifiers1 (UUIDs). Important attributes of services that
can be used to search for a service are represented as UUIDs.
2.5.1 UUID
A UUID is a universally unique identifier that is expected to be unique across all space
and all time (more precisely, the probability of independently-generated UUIDs being the
same is negligible). UUIDs can be independently created in a distributed fashion. No
central registry of assigned UUIDs is required. A UUID is a 128-bit value.
To reduce the burden of storing and transferring 128-bit UUID values, a range of UUID
values has been pre-allocated for assignment to often-used, registered purposes. The
first UUID in this pre-allocated range is known as the Bluetooth_Base_UUID and has
the value 00000000-0000-1000-8000-00805F9B34FB. UUID values in the pre-allocated
range have aliases that are represented as 16-bit or 32-bit values. These aliases are
often called 16-bit and 32-bit UUIDs, but each actually represents a 128-bit UUID value.
The full 128-bit value of a 16-bit or 32-bit UUID may be computed by a simple arithmetic
operation.
A 16-bit UUID may be converted to 32-bit UUID format by zero-extending the 16-bit
value to 32-bits. An equivalent method is to add the 16-bit UUID value to a zero-valued
32-bit UUID.
Note: Two 16-bit UUIDs may be compared directly, as may two 32-bit UUIDs or two
128-bit UUIDs. If two UUIDs of differing sizes are to be compared, the shorter UUID
must be converted to the longer UUID format before comparison.
A service search pattern is a list of UUIDs used to locate matching service records. A
service search pattern matches a service record if each and every UUID in the service
search pattern is contained within any of the service record’s attribute values. The
UUIDs need not be contained within any specific attributes or in any particular order
within the service record. The service search pattern matches if the UUIDs it contains
constitute a subset of the UUIDs in the service record’s attribute values. The only time
a service search pattern does not match a service record is if the service search pattern
contains at least one UUID that is not contained within the service record’s attribute
values. A valid service search pattern shall contain at least one UUID.
1The format of UUIDs is specified in ITU-T Rec. X.667(10/2012), alternatively known as ISO/IEC 9834-8:2014.
When a client desires to browse an SDP Server’s services, it creates a service search
pattern containing the UUID that represents the root browse group. All services that
may be browsed at the top level are made members of the root browse group by having
the root browse group’s UUID as a value within the BrowseGroupList attribute.
Normally, if an SDP Server has relatively few services, all of its services will be placed
in the root browse group. However, the services offered by an SDP Server may be
organized in a browse group hierarchy, by defining additional browse groups below the
root browse group. Each of these additional browse groups is described by a service
record with a service class of BrowseGroupDescriptor.
A browse group descriptor service record defines a new browse group by means of
its Group ID attribute. In order for a service contained in one of these newly defined
browse groups to be browseable, the browse group descriptor service record that
defines the new browse group must in turn be browseable. The hierarchy of browseable
services that is provided by the use of browse group descriptor service records allows
the services contained in an SDP Server to be incrementally browsed and is particularly
useful when the SDP Server contains many service records.
Figure 2.3 illustrates a fictitious service browsing hierarchy that illuminates the manner
in which browse group descriptors are used. Browse group descriptor service records
are identified with (G); other service records with (S).
Table 2.2 shows the services records and service attributes necessary to implement the
browse hierarchy.
3 DATA REPRESENTATION
Attribute values can contain information of various types with arbitrary complexity; thus
enabling an attribute list to be generally useful across a wide variety of service classes
and environments.
SDP defines a simple mechanism to describe the data contained within an attribute ID,
attribute ID range, and attribute value. The primitive construct used is the data element.
A data element is a typed data representation. It consists of two fields: a header field
and a data field. The header field, in turn, is composed of two parts: a type descriptor
and a size descriptor. The data is a sequence of bytes whose length is specified in the
size descriptor (described in Section 3.3) and whose meaning is (partially) specified by
the type descriptor.
A data element type is represented as a 5-bit type descriptor. The type descriptor is
contained in the most significant (high-order) 5 bits of the first byte of the data element
header. The following types have been defined.
For the boolean type, false shall be represented by the value 0 and true shall be
represented by the value 1. Any other value received shall be accepted as representing
true.
4 PROTOCOL DESCRIPTION
SDP is a simple protocol with minimal requirements on the underlying transport. It can
function over a reliable packet transport (or even unreliable, if the client implements
timeouts and repeats requests as necessary).
SDP uses a request/response model where each transaction consists of one request
protocol data unit (PDU) and one response PDU. In the case where SDP is used
with the Bluetooth L2CAP transport protocol, no more than one SDP request PDU per
connection to a given SDP Server shall be outstanding at a given instant. In other
words, a client shall wait for a response to its current request before issuing another
request on the same L2CAP connection. Limiting SDP to sending one unacknowledged
request PDU provides a simple form of flow control.
The format of the continuation information is not standardized among SDP Servers.
Each continuation state parameter is meaningful only to the SDP Server that generated
it. The SDP Server should not expose any sensitive information, such as internal
data structures, in the continuation state parameter. The SDP Server should validate
a continuation state parameter supplied by the client before using it.
After a client receives a partial response and the accompanying continuation state
parameter, it can re-issue the original request (with a new transaction ID) and include
the continuation state in the new request indicating to the server that the remainder of
the original response is desired. The maximum allowable value of the InfoLength field is
16 (0x10).
Unless otherwise stated in a PDU response specification, an SDP Server may split
a response at any arbitrary boundary when it generates a partial response. The
SDP Server may select the boundary based on the contents of the reply, but is not
required to do so. Therefore, length fields give the lengths as measured in the complete
assembled record, not the length of the fields in the partial segment. When a service
record is segmented into partial responses all attribute list values are relative to the
complete record, not relevant to the partial record.
Client Server
Any Request
SDP_ERROR_RSP
Description:
The SDP Server generates this PDU type in response to an improperly formatted
request PDU or when the SDP Server, for whatever reason, cannot generate an
appropriate response PDU.
PDU parameters:
Note: Invalid PDU size should be used, for example, if an incoming request PDU's
length is inconsistent with the specification of that request PDU or the length parameter
of an incoming request PDU is inconsistent with that request PDU's actual contents.
Client Server
SDP_SERVICE_SEARCH_REQ
SDP_SERVICE_SEARCH_RSP
Description:
No mechanism is provided to request information for all service records. However, see
Section 2.6 for a description of a mechanism that permits browsing for non-specific
services without a priori knowledge of the services.
PDU parameters:
Description:
PDU parameters:
Client Server
SDP_SERVICE_ATTR_REQ
SDP_SERVICE_ATTR_RSP
Description:
Command parameters:
Description:
PDU parameters:
Client Server
SDP_SERVICE_SEARCH_ATTR_REQ
SDP_SERVICE_SEARCH_ATTR_RSP
Description:
The service record handle for each service record is contained in the
ServiceRecordHandle attribute of that service and may be requested along with other
attributes.
PDU parameters:
Description:
PDU parameters:
The service classes and attributes contained in this document are necessarily a partial
list of the service classes and attributes supported by SDP. Only service classes that
directly support the SDP Server are included in this document. Additional service
classes will be defined in other documents and possibly in future revisions of this
document. Also, it is expected that additional attributes will be discovered that are
applicable to a broad set of services; these may be added to the list of Universal
attributes in future revisions of this document.
Where a range of values is specified for a class of attribute IDs, only numbers in that
range are assigned numbers for that class and (except for universal attributes) are only
assigned numbers for that class.
Universal attributes use attribute IDs 0x0000 to 0x00FF. Specific IDs in this range are
defined in Assigned Numbers.
Only two attributes are required to exist in every service record instance. They are
the ServiceRecordHandle and the ServiceClassIDList. All other service attributes are
optional within a service record.
Description:
A service record handle is a 32-bit number that uniquely identifies each service record
within an SDP Server. In general, each handle is unique only within each SDP Server. If
SDP Server S1 and SDP Server S2 both contain identical service records (representing
the same service), the service record handles used to reference these identical service
records are completely independent. The handle used to reference the service on
Description:
Description:
Description:
The ServiceID is a UUID that universally and uniquely identifies the service instance
described by the service record. This service attribute is particularly useful if the same
service is described by service records in more than one SDP Server.
Description:
The ProtocolDescriptorList attribute describes one or more protocol stacks that can be
used to gain access to the service described by the service record.
If the ProtocolDescriptorList describes a single stack, it takes the form of a data element
sequence in which each element of the sequence is a protocol descriptor. Each protocol
descriptor is, in turn, a data element sequence whose first element is a UUID identifying
the protocol and whose successive elements are protocol-specific parameters. Potential
protocol-specific parameters are a protocol version number and a connection-port
number. The protocol descriptors are listed in order from the lowest layer protocol to
the highest layer protocol used to gain access to the service.
If it is possible for more than one kind of protocol stack to be used to gain access to the
service, the ProtocolDescriptorList takes the form of a data element alternative where
each member is a data element sequence as described in the previous paragraph.
Protocol descriptors
ProtocolDescriptorList examples
These examples are intended to be illustrative. The parameter formats for each protocol
are not defined within the specification.
In the first two examples, it is assumed that a single RFCOMM instance exists on top
of the L2CAP layer. In this case, the L2CAP protocol specific information (PSM) points
to the single instance of RFCOMM. In the last example, two different and independent
RFCOMM instances are available on top of the L2CAP layer. In this case, the L2CAP
protocol specific information (PSM) points to a distinct identifier that distinguishes each
of the RFCOMM instances. See the L2CAP specification ([Vol 3] Part A, Section 4.2) for
the range of allowed PSM values.
IrDA-like printer
IP Network Printing
Description:
AdditionalProtocolDescriptorLists examples
The following is just an illustrative example and is not meant to refer a real specified
service or protocols.
Description:
Description:
The first element of each triplet contains an identifier representing the natural language.
The language is encoded according to ISO 639:1988 (E/F): “Code for the representation
of names of languages”.
The second element of each triplet contains an identifier that specifies a character
encoding used for the language. Values for character encoding can be found in
IANA's database1, and have the values that are referred to as MIBEnum values. The
recommended character encoding is UTF-8.
The third element of each triplet contains an attribute ID that serves as the base
attribute ID for the natural language in the service record. Different service records
within a server may use different base attribute ID values for the same language.
The base attribute ID value shall be chosen so that all attributes that are specified as
being offset from it (e.g. ServiceName, ServiceDescription, and ProviderName) shall
have resulting Attribute IDs that are in the range 0x0100 to 0x01FF or a range specified
in another specification as being used for this purpose. The range 0x0100 to 0x01FF
shall only be used for this purpose.
Description:
The ServiceTimeToLive attribute is a 32-bit integer that contains the number of seconds
for which the information in a service record is expected to remain valid and unchanged.
This time interval is measured from the time that the attribute value is retrieved from the
SDP Server. This value does not imply a guarantee that the service record will remain
available or unchanged. It is simply a hint that a client can use to determine a suitable
polling interval to re-validate the service record contents.
Description:
The ServiceAvailability attribute is an 8-bit unsigned integer that represents the relative
ability of the service to accept additional clients. A value of 0xFF indicates that the
1See https://www.iana.org/assignments/character-sets/character-sets.xhtml
service is not currently in use and is thus fully available, while a value of 0x00
means that the service is not accepting new clients. For services that support multiple
simultaneous clients, intermediate values indicate the relative availability of the service
on a linear scale.
For example, a service that can accept up to 3 clients should provide ServiceAvailability
values of 0xFF, 0xAA, 0x55, and 0x00 when 0, 1, 2, and 3 clients, respectively, are
2 2
utilizing the service. The value 0xAA is approximately 3
× 0xFF and represents 3
1 1
availability, while the value 0x55 is approximately 3 × 0xFF and represents 3
availability.
The availability value is be approximated as
When the maximum number of clients is large, this formula must be modified to ensure
that ServiceAvailability values of 0x00 and 0xFF are reserved for their defined meanings
of unavailability and full availability, respectively.
Note: The maximum number of clients a service can support may vary according to the
resources utilized by the service's current clients.
A non-zero value for ServiceAvailability does not guarantee that the service will be
available for use. It should be treated as a hint or an approximation of availability status.
Description:
Each version of a profile is assigned a 16-bit unsigned integer profile version number,
which consists of two 8-bit fields. The higher-order 8 bits contain the major version
number field and the lower-order 8 bits contain the minor version number field.
Description:
Description:
This attribute contains a URL that refers to the location of an application that can be
used to utilize the service described by the service record. Since different operating
environments require different executable formats, a mechanism has been defined to
allow this single attribute to be used to locate an executable that is appropriate for the
client device’s operating environment. In the attribute value URL, the first byte with the
value 0x2A (ASCII character ‘*’) is to be replaced by the client application with a string
representing the desired operating environment before the URL is to be used.
For example, assume that the value of the ClientExecutableURL attribute is http://
my.fake/public/*/client.exe. On a device capable of executing SH3 WindowsCE files,
this URL would be changed to http://my.fake/public/sh3-microsoft-wince/client.exe. On
a device capable of executing Windows 98 binaries, this URL would be changed to
http://my.fake/public/i86-microsoft-win98/client.exe.
Description:
This attribute contains a URL that refers to the location of an icon that can be used
to represent the service described by the service record. Since different hardware
devices require different icon formats, a mechanism has been defined to allow this
single attribute to be used to locate an icon that is appropriate for the client device.
In the attribute value URL, the first byte with the value 0x2A (ASCII character ‘*’) is to
be replaced by the client application with a string representing the desired icon format
before the URL is to be used.
For example, assume that the value of the IconURL attribute is http://my.fake/public/
icons/*. On a device that prefers 24 x 24 icons with 256 colors, this URL would
be changed to http://my.fake/public/icons/24x24x8.png. On a device that prefers 10
x 10 monochrome icons, this URL would be changed to http://my.fake/public/icons/
10x10x1.png.
Description:
The ServiceName attribute is a string containing the name of the service represented by
a service record. It should be brief and suitable for display with an Icon representing
the service. An offset specified in Assigned Numbers is added to the attribute ID
base (contained in the LanguageBaseAttributeIDList attribute) in order to compute the
attribute ID for this attribute.
Description:
This attribute is a string containing a brief description of the service. It should be less
than 200 characters in length. An offset specified in Assigned Numbers is added to the
attribute ID base (contained in the LanguageBaseAttributeIDList attribute) in order to
compute the attribute ID for this attribute.
Description:
This attribute is a string containing the name of the person or organization providing
the service. An offset specified in Assigned Numbers is added to the attribute ID
base (contained in the LanguageBaseAttributeIDList attribute) in order to compute the
attribute ID for this attribute.
This service class uses attribute IDs 0x0200 to 0x02FF. Specific IDs in this range are
defined in Assigned Numbers.
Value
Value
Description:
A version number is a 16-bit unsigned integer consisting of two fields. The higher-order
8 bits contain the major version number field and the low-order 8 bits contain the minor
version number field. The initial version of SDP has a major version of 1 and a minor
version of 0.
Description:
The ServiceDatabaseState attribute does not change when existing service records are
modified, including the addition, removal, or modification of service attributes. A service
record's ServiceRecordState attribute indicates when that service record is modified.
This service class uses attribute IDs 0x0200 to 0x02FF. Specific IDs in this range are
defined in Assigned Numbers.
Value
Description:
This attribute contains a UUID that can be used to locate services that are members of
the browse group that this service record describes.
6 SECURITY
In Security Mode 4, SDP should use no security but may use security (an authenticated
or unauthenticated link key with encryption). See [Vol 3] Part C, Section 5.2.2).
The following are simple examples of typical SDP transactions. These are meant to be
illustrative of SDP flows. The examples do not consider:
• Caching (in a caching system, the SDP Client would make use of the
ServiceRecordState and ServiceDatabaseState attributes);
• Service availability (if this is of interest, the SDP Client should use the
ServiceAvailability and/or ServiceTimeToLive attributes);
• SDP versions (the VersionNumberList attribute could be used to determine
compatible SDP versions);
• SDP Error Responses (an SDP error response is possible for any SDP request that is
in error); and
• Communication connection (the examples assume that an L2CAP connection is
established).
The examples are meant to be illustrative of the protocol. The format used is
ObjectName[ObjectSizeInBytes] {SubObjectDefinitions} , but this is not meant
to illustrate an interface. The ObjectSizeInBytes is the size of the object in
decimal. The SubObjectDefinitions (inside of {} characters) are components of the
immediately enclosing object. Hexadecimal values shown as lower-case letters, such
as for transaction IDs and service handles, are variables (the particular value is not
important for the illustration, but each such symbol always represents the same value).
Comments are included in this manner: /* comment text */
TotalServiceRecordCount[2] {
0x0002
}
CurrentServiceRecordCount[2] {
0x0002
}
ServiceRecordHandleList[8] {
/* print service 1 handle */
0xqqqqqqqq
/* print service 2 handle */
0xrrrrrrrr
}
ContinuationState[1] {
/* no continuation state */
0x00
}
}
are 32-bit UUIDs and the RFCOMM server channel is a data element with an 8-bit
value of 2.
0xuuuu
}
ParameterLength[2] {
0x0021
}
AttributeListByteCount[2] {
0x001E
}
AttributeList[30] {
DataElementSequence[30] {
0b00110 0b101 0x1C
Attribute[28] {
AttributeID[3] {
0b00001 0b001 0x0004
}
AttributeValue[25] {
/* ProtocolDescriptorList */
DataElementSequence[25] {
0b00110 0b101 0x17
/* L2CAP protocol descriptor */
DataElementSequence[7] {
0b00110 0b101 0x05
UUID[5] {
/* L2CAP Protocol UUID */
0b00011 0b010 <32-bit L2CAP UUID>
}
}
/* RFCOMM protocol descriptor */
DataElementSequence[9] {
0b00110 0b101 0x07
UUID[5] {
/* RFCOMM Protocol UUID */
0b00011 0b010 <32-bit RFCOMM UUID>
}
/* parameter for server 2 */
uint8[2] {
0b00001 0b000 0x02
}
}
/* PostscriptStream protocol descriptor */
DataElementSequence[7] {
/* no continuation state */
0x00
}
}
UUID[5] {
/* RFCOMM Protocol UUID */
0b00011 0b010 <32-bit RFCOMM UUID>
}
/* parameter for server 2 */
uint8[2] {
0b00001 0b000 0x02
}
}
/* PostscriptStream protocol descriptor */
DataElementSequence[7] {
0b00110 0b101 0x05
UUID[5] {
/* PostscriptStream Protocol UUID */
0b00011 0b010 <32-bit PostscriptStream UUID>
}
}
}
}
}
}
}
ContinuationState[1] {
/* no continuation state */
0x00
}
}
result is larger than this, the SDP Client will repeat the request supplying a continuation
state parameter to retrieve the remainder of the response. The transaction illustrates:
AttributeID[3] {
0b00001 0b001 0x0301
} }
}
ContinuationState[1] {
/* no continuation state */
0x00
}
}
}
AttributeValue[7] {
DataElementSequence[7] {
0b00110 0b101 0x05
UUID[5] {
/* SynchronisationServiceClassID */
0b00011 0b010 0xssssssss
}
}
}
}
Attribute[35] {
AttributeID[3] {
0b00001 0b001 0x000C
}
AttributeValue[32] {
/* IconURL; '*' replaced by client application */
0b01000 0b101 0x1E
"http://Synchronisation/icons/*"
}
}
Attribute[22] {
AttributeID[3] {
0b00001 0b001 0x0100
}
AttributeValue[19] {
/* service name */
0b00100 0b101 0x11
"Address Book Sync"
}
}
Attribute[59] {
AttributeID[3] {
0b00001 0b001 0x0101
}
AttributeValue[56] {
/* service description */
0b00100 0b101 0x36
"Synchronisation Service for vCard Address Book Entries"
}
}
Attribute[37] {
AttributeID[3] {
0b00001 0b001 0x0102
}
AttributeValue[34] {
/* service provider */
0b00100 0b101 0x20
"Synchronisation Specialists Inc."
}
}
Attribute[5] {
AttributeID[3] {
0b00001 0b001 0x0301
}
AttributeValue[2] {
/* Supported Data Store ’phonebook’ */
0b00001 0b000 0x01
}
}
}
DataElementSequence[175] {
0b00110 0b101 0xAD
Attribute[8] {
AttributeID[3] {
0b00001 0b001 0x0000
}
AttributeValue[5] {
/* service record handle */
0b00001 0b010 0xmmmmmmmm
}
}
Attribute[10] {
AttributeID[3] {
0b00001 0b001 0x0001
}
AttributeValue[7] {
DataElementSequence[7] {
0b00110 0b101 0x05
UUID[5] {
/* SynchronisationServiceClassID */
0b00011 0b010 0xssssssss
}
}
}
}
Attribute[35] {
AttributeID[3] {
0b00001 0b001 0x000C
}
AttributeValue[32] {
/* IconURL; '*' replaced by client application */
0b01000 0b101 0x1E
"http://Synchronisation/icons/*"
}
}
Attribute[21] {
AttributeID[3] {
0b00001 0b001 0x0100
}
AttributeValue[18] {
/* service name */
0b00100 0b101 0x10
"Appointment Sync"
}
}
Attribute[57] {
AttributeID[3] {
0b00001 0b001 0x0101
}
AttributeValue[54] {
/* service description */
0b00100 0b101 0x34
"Synchronisation Service for vCal Appointment Entries"
}
}
Attribute[37] {
AttributeID[3] {
0b00001 0b001 0x0102
}
AttributeValue[34] {
/* service provider */
0b00100 0b101 0x20
}
MaximumAttributeByteCount[2] {
0x0180
}
AttributeIDList[18] {
DataElementSequence[18] {
0b00110 0b101 0x10
AttributeIDRange[5] {
0b00001 0b010 0x00000001
}
AttributeID[3] {
0b00001 0b001 0x000C
}
AttributeIDRange[5] {
0b00001 0b010 0x01000102
}
AttributeID[3] {
0b00001 0b001 0x0301
}
}
}
ContinuationState[9] {
/* same 8 bytes of continuation state */
/* received in part 2 */
0x08 0xzzzzzzzzzzzzzzzz
}
}
SDP_SERVICE_SEARCH_ATTR_RSP[115] {
PDUID[1] {
0x07
}
TransactionID[2] {
0xwwww
}
ParameterLength[2] {
0x006E
}
AttributeListByteCount[2] {
0x006B
}
AttributeLists[107] {
/* Continuing the data element sequence of */
/* attribute lists begun in Part 2. */
DataElementSequence[107] {
0b00110 0b101 0x69
Attribute[8] {
AttributeID[3] {
0b00001 0b001 0x0000
}
AttributeValue[5] {
/* service record handle */
0b00001 0b010 0xFFFFFFFF
}
}
Attribute[10] {
AttributeID[3] {
0b00001 0b001 0x0001
}
AttributeValue[7] {
DataElementSequence[7] {
0b00110 0b101 0x05
UUID[5] {
/* SynchronisationServiceClassID */
0b00011 0b010 0xssssssss
}
}
}
}
Attribute[35] {
AttributeID[3] {
0b00001 0b001 0x000C
}
AttributeValue[32] {
/* IconURL; '*' replaced by client application */
0b01000 0b101 0x1E
"http://DevManufacturer/icons/*"
}
}
Attribute[18] {
AttributeID[3] {
0b00001 0b001 0x0100
}
AttributeValue[15] {
/* service name */
0b00100 0b101 0x0D
"Calendar Sync"
}
}
Attribute[29] {
AttributeID[3] {
0b00001 0b001 0x0102
}
AttributeValue[26] {
/* service provider */
0b00100 0b101 0x18
"Device Manufacturer Inc."
}
}
Attribute[5] {
AttributeID[3] {
0b00001 0b001 0x0301
}
AttributeValue[2] {
/* Supported Data Store ’calendar’ */
0b00001 0b000 0x03
}
}
}
/* This completes the data element sequence */
/* of attribute lists begun in Part 2. */
}
ContinuationState[1] {
/* no continuation state */
0x00
}
}
Previous versions of this specification used different names for the PDUs defined in
Section 4. Table C.1 shows the previous and current names of these PDUs.
GENERIC ACCESS
PROFILE
CONTENTS
1 FOREWORD
Whether the provision of a feature is mandatory or optional is stated separately for both
sides of the Bluetooth air interface.
1.1 Scope
The purpose of the Generic Access Profile is:
To describe how devices are to behave in standby and connecting states in order to
avoid situations where links and channels cannot be established between Bluetooth
devices or that prevent multi-profile operation. Special focus is put on discovery, link
establishment and security procedures.
To state requirements on user interface aspects, mainly coding schemes and names of
procedures and parameters, that are needed to provide a satisfactory user experience.
This profile defines three implementation transport types based on the supported Core
Configurations as defined in [Vol 0] Part D, Section 2. These implementation transport
types are defined in Table 1.1:
Implementation Description
Transport Type
BR/EDR-only Implementations of a BR/EDR Core Configuration (see [Vol 0] Part D, Sec-
tion 2.1.1, [Vol 0] Part D, Section 2.2.1, and [Vol 0] Part D, Section 2.3.1)
LE only Implementations of an LE Core Configuration (see [Vol 0] Part D, Sec-
tion 2.1.2, [Vol 0] Part D, Section 2.2.2, and [Vol 0] Part D, Section 2.3.2)
BR/EDR/LE Implementations of a BR/EDR/LE Core Configuration (see [Vol 0] Part
D, Section 2.1.3, [Vol 0] Part D, Section 2.2.3, and [Vol 0] Part D, Sec-
tion 2.3.3)
The terms physical transport, physical link and physical channel as defined in [Vol 1]
Part A, Section 3 are used in the specification.
The arrows shown in Figure 1.1 are used in diagrams describing procedures:
A B
PROC1
PROC2
PROC3
PROC4
PROC5
MSG1
MSG2
MSG3
In Figure 1.1, the following cases are shown: PROC1 is a sub-procedure initiated by
B. PROC2 is a sub-procedure initiated by A. PROC3 is a sub-procedure where the
initiating side is undefined (may be both A or B). Dashed arrows denote optional steps.
PROC4 indicates an optional sub-procedure initiated by A, and PROC5 indicates an
optional sub-procedure initiated by B.
Timers are introduced specific to this profile. To distinguish them from timers used in
the Bluetooth protocol specifications and other profiles, these timers are named in the
following format: ’TGAP(nnn)’.
2 PROFILE OVERVIEW
Figure 2.1: Relationship of GAP with lower layers of the Bluetooth architecture
• Profile roles
• Discoverability modes and procedures
• Connection modes and procedures
• Security modes and procedures
In GAP, for describing the Bluetooth communication that occurs between two devices in
the BR/EDR GAP role, the generic notation of the A-party (the paging device in case
of link establishment, or initiator in case of another procedure on an established link)
and the B-party (paged device or acceptor) is used. The A-party is the one that, for a
given procedure, initiates device discovery, initiates the establishment of a physical link
or initiates a transaction on an existing link.
This profile handles the procedures between two devices related to discovery and
connecting (link and connection establishment) for the case where none of the two
devices has any link established as well as the case where (at least) one device has a
link established (possibly to a third device) before starting the described procedure.
Figure 2.2: This profile covers procedures initiated by one device (A) towards another device (B) whether
or not they have an existing Bluetooth link active
The initiator and the acceptor generally operate the generic procedures according to
this profile or another profile referring to this profile. If the acceptor operates according
to several profiles simultaneously, this profile describes generic mechanisms for how to
handle this.
There are four GAP roles defined for devices operating over an LE physical transport:
• Broadcaster
• Observer
• Peripheral
• Central
The GAP roles "Central" and "Peripheral" are related to, but not the same as, the Link
Layer roles with the same names and therefore can have different requirements. If a
connection is established successfully, the device with one of these GAP roles will also
have the corresponding Link Layer role. However, the device can be in the GAP role
without a connection being established.
Table 2.1 defines requirements for physical layer and Link Layer functionalities for each
GAP role when operating over an LE physical transport.
1These advertising event types are excluded if the device does not support LE Extended Advertising.
A device operating in the Broadcaster role is a device that sends advertising events
or periodic advertising events as described in [Vol 6] Part B, Section 4.4.2, and may
also send Broadcast Isochronous Stream (BIS) events as described in [Vol 6] Part B,
Section 4.4.6. A device operating in the Broadcaster role is referred to as a Broadcaster
and shall have a transmitter and may have a receiver.
A device operating in the Observer role is a device that receives advertising events or
periodic advertising events as described in [Vol 6] Part B, Section 4.4.3, and may also
receive BIS events as described in [Vol 6] Part B, Section 4.4.6. A device operating in
the Observer role is referred to as an Observer and shall have a receiver and may have
a transmitter.
Any device that accepts the establishment of an LE active physical link using any of the
connection establishment procedures as defined in Section 9 is referred to as being in
the Peripheral role. A device operating in the Peripheral role will be in the Peripheral
role in the Link Layer Connection state as described in [Vol 6] Part B, Section 4.5. A
device operating in the Peripheral role is referred to as a Peripheral. A Peripheral shall
have both a transmitter and a receiver.
A device that supports the Central role initiates the establishment of an LE active
physical link. A device operating in the Central role will be in the Central role in the Link
Layer Connection state as described in [Vol 6] Part B, Section 4.5. A device operating in
the Central role is referred to as a Central. A Central shall have both a transmitter and a
receiver.
A device may operate in multiple GAP roles concurrently if supported by the Controller.
The Host should read the supported Link Layer states and state combinations from the
Controller before any procedures or modes are used.
This profile defines modes of operation that are not service- or profile-specific, but
that are generic and can be used by profiles referring to this profile, and by devices
implementing multiple profiles.
This profile defines the general procedures that can be used for discovering identities,
names and basic capabilities of other Bluetooth devices that are in a mode where they
can be discovered. Only procedures where no channel or connection establishment is
used are specified.
This profile defines the general procedure for how to create bonds (i.e., dedicated
exchange of link keys) between Bluetooth devices.
This profile describes the general procedures that can be used for establishing
connections to other Bluetooth devices that are in a mode that allows them to accept
connections and service requests.
This profile specifies the generic terms that should be used on the user interface level.
3.2.1.1 Definition
When the Bluetooth address is referred to on the UI level, the term ‘Bluetooth Device
Address’ should be used.
3.2.1.3 Representation
On the Baseband level the BD_ADDR is represented as 48 bits (see [Vol 2] Part B,
Section 1.2). On the Link Layer the public and random device address are represented
as 48-bit addresses.
3.2.2.1 Definition
The Bluetooth Device Name is the user-friendly name that a Bluetooth device exposes
to remote devices. For a BR/EDR-only implementation, the name is a character string
returned in the LMP_NAME_RES in response to an LMP_NAME_REQ. For an LE-only
implementation, the name is a character string held in the Device Name characteristic
as defined in Section 12.1.
A BR/EDR/LE implementation shall have a single Bluetooth Device Name which shall
be identical irrespective of the physical channel used to perform the name discovery
procedure.
For the BR/EDR physical channel the name is received in the LMP_NAME_RES. For
the LE physical channel the name can be read from the Device Name characteristic as
defined in Section 12.1.
Note: The Device Name Characteristic of the local device can be read by a remote
device using ATT over BR/EDR if the local device supports ATT over BR/EDR.
When the Bluetooth Device Name is referred to on the UI level, the term ‘Bluetooth
Device Name’ should be used.
3.2.2.3 Representation
The Bluetooth Device Name can be up to 248 bytes (see [Vol 2] Part C, Section 4.3.5).
It shall be encoded according to UTF-8 (therefore the name entered on the UI level
may be restricted to as few as 62 characters if codepoints outside the range U+0000 to
U+007F are used).
A device cannot expect that a general remote device is able to handle more than the
first 40 characters of the Bluetooth Device Name. If a remote device has limited display
capabilities, it may use only the first 20 characters.
3.2.3.1 Definition
The Bluetooth Passkey may be used to authenticate two Bluetooth devices with each
other during the creation of a mutual link key via the pairing procedure. The passkey
may be used in the pairing procedures to generate the initial link key.
The PIN may be entered on the UI level but may also be stored in the device; e.g., in
the case of a device without an interface for entering and displaying digits.
When the Bluetooth PIN is referred to on the UI level, the term ‘Bluetooth Passkey’
should be used.
3.2.3.3 Representation
and Security Manager, and another used with legacy pairing (where it is generally
referred to as the Bluetooth PIN).
For Secure Simple Pairing and Security Manager, the Bluetooth Passkey is a 6-
digit numerical value. It is represented as integer value in the range 0x00000000 –
0x000F423F (000000 to 999999). The numeric value may be used as the input to the
Authentication stage 1 for Secure Simple Pairing Passkey Entry (see [Vol 2] Part H,
Section 7.2.3), or as the TK value in the Security Manager for the process defined in
[Vol 3] Part H, Section 2.3.5.
For legacy pairing (see Section B.2), the Bluetooth PIN has different representations on
different levels. PINBB is used on the Baseband level, and PINUI is used on the user
interface level. PINBB is the PIN used in [Vol 2] Part H, Section 3.2.1 for calculating the
initialization key during the Pairing procedure.
PINUI is the character representation of the PIN that is entered on the UI level. The
transformation from PINUI to PINBB shall be according to UTF-8. PINBB may be 128
bits (16 bytes).
PIN codes may be up to 16 characters. In order to take advantage of the full level of
security all PINs should be 16 characters long. Variable PINs should be composed of
alphanumeric characters chosen from within the Unicode range U+0000 to U+007F. If
the PIN contains any decimal digits these shall be encoded using the Unicode Basic
Latin characters (i.e., U+0030 to U+0039) (Note 1).
For compatibility with devices with numeric keypads, fixed PINs shall be composed of
only decimal digits, and variable PINs should be composed of only decimal digits.
If a device supports entry of characters outside the Unicode range U+0000 to U+007F,
other Unicode code points may be used (Note 2), except the Halfwidth and Fullwidth
Forms (i.e., U+FF00 to U+FFEF) shall not be used (Note 3).
Examples:
Note 1: This is to prevent interoperability problems since there are decimal digits at
other code points (e.g., the Fullwidth digits at code points U+FF10 to U+FF19).
Note 2: Unicode characters outside the Basic Latin range (U+0000 to U+007F) encode
to multiple bytes; therefore, when characters outside the Basic Latin range are used
the maximum number of characters in the PINUI will be less than 16. The second
example illustrates a case where a 15 character string encodes to 16 bytes because the
character ø is outside the Basic Latin range and encodes to two bytes (0xC3 0xB8).
Note 3: This is to prevent interoperability problems since the Halfwidth and Fullwidth
forms contain alternative variants of ASCII, Katakana, Hangul, punctuation and
symbols. All of the characters in the Halfwidth and Fullwidth forms have other related
Unicode characters; for example, U+3150 (Hangul Letter AE) can be used instead of
U+FFC3 (Halfwidth Hangul Letter AE).
3.2.4.1 Definition
When using a mix of information found in the Bluetooth Device Class and the Bluetooth
Service Type, the term ‘Bluetooth Device Type’ should be used.
3.2.4.3 Representation
The Class of Device is a bit field and is defined in [3]. The UI-level representation of the
information in the Class of Device is implementation specific.
3.2.4.4 Usage
Some devices provide more than one service and a given service may be provided
by different device types. Therefore, the device type does not have a one-to-one
relationship with services supported. The major and minor device class field should
not be used to determine whether a device supports any specific service(s). It may
be used as an indication of devices that are most likely to support desired services
before service discovery requests are made, and it may be used to guide the user when
selecting among several devices that support the same service.
3.2.5.1 Definition
3.2.5.3 Representation
The Appearance characteristic value shall be set to one of the 16-bit numbers assigned
by the Bluetooth SIG and defined in Section 1.12 of [4]. The UI-level representation of
the Appearance characteristic value is implementation specific.
3.2.6.1 Definition
When the Broadcast_Code parameter is referred to on the UI level, the term ‘Bluetooth
Privacy Code’ should be used.
3.2.6.3 Representation
On all levels other than UI, the Broadcast Code parameter shall be represented as
a 128-bit value. The transformation from string to number shall be by representing
the string in UTF-8, placing the resulting bytes in 8-bit fields of the value starting
at the least significant bit, and then padding with zeros in the most significant bits
if necessary. For example, the string “Børne House” is represented as the value
0x00000000_6573756F_4820656E_72B8C342.
3.3 Pairing
Pairing over a BR/EDR physical link is defined on LMP level (LMP pairing, see
Section B.2). Pairing over an LE physical link is defined by the Security Manager
specification ([Vol 3] Part H, Section 2.3). Either the user initiates the bonding procedure
and enters the passkey with the explicit purpose of creating a bond (and maybe also a
secure relationship) between two Bluetooth devices, or the user is requested to enter
the passkey during the establishment procedure since the devices did not share a
common link key beforehand. In the first case, the user is said to perform “bonding (with
entering of passkey)” and in the second case the user is said to “authenticate using the
passkey.”
After being made discoverable, the Bluetooth device shall be discoverable for at least
TGAP(103).
The speed of discovery is dependent on the configuration of the inquiry scan interval
and inquiry scan type of the Bluetooth device. The Host is able to configure these
4.1.1.1 Definition
4.1.2.1 Definition
The limited discoverable mode should be used by devices that need to be discoverable
only for a limited period of time, during temporary conditions, or for a specific event.
• Limited discoverable mode can be used to allow remote devices using the general
inquiry procedure to prioritize or otherwise identify devices in limited discoverable
mode when presenting discovered devices to the end user because, typically, the
user is interacting with them.
• Limited discoverable mode can also be used to allow remote devices using the limited
inquiry procedure to filter out devices using the general discoverable mode.
A Bluetooth device should not be in limited discoverable mode for more than TGAP(104).
The scanning for the limited inquiry access code can be done either in parallel or
in sequence with the scanning of the general inquiry access code. When in limited
discoverable mode, one of the following options shall be used.
• Parallel scanning
When a Bluetooth device is in limited discoverable mode and when discovery speed
is more important than power consumption or bandwidth, it is recommended that the
Bluetooth device enter the INQUIRY_SCAN state at least every TGAP(105) and that
Interlaced Inquiry scan is used.
If, however, power consumption or bandwidth is important, but not critical, it is
recommended that the Bluetooth device enter the INQUIRY_SCAN state at least
every TGAP(102) and Interlaced Inquiry scan is used.
4.1.2.2 Conditions
When a device is in limited discoverable mode it shall set bit number 13 in the Major
Service Class part of the Class of Device/Service field [3].
4.1.3.1 Definition
Devices in the general discoverable mode will not be discovered by devices performing
the limited inquiry procedure. General discoverable mode should not be used if it is
known that the device performing discovery will be using the limited inquiry procedure
(see Section 6.1).
4.1.3.2 Conditions
When a Bluetooth device is in general discoverable mode and when discovery speed
is more important than power consumption or bandwidth, it is recommended that the
Bluetooth device enter the INQUIRY_SCAN state at least every TGAP(105) and that
Interlaced Inquiry scan is used.
In all cases the Bluetooth device shall enter the INQUIRY_SCAN state at least once in
TGAP(102) and scan for the GIAC for at least TGAP(101).
The speed of connections is dependent on the configuration of the page scan interval
and page scan type of the Bluetooth device. The Host is able to configure these
parameters based on trade-offs between power consumption, bandwidth and the
desired speed of connection.
4.2.1.1 Definition
4.2.2.1 Definition
R0 page scanning should be used when connection speeds are critically important and
when the paging device has a very good estimate of the Bluetooth clock. Under these
conditions it is possible for paging to complete within two times the page scan window.
Because the page scan interval is equal to the page scan window it is not possible
for any other traffic to go over the Bluetooth link when using R0 page scanning. In R0
page scanning it is not possible to use interlaced scan. R0 page scanning is the highest
power consumption mode of operation.
When connection times are critical but the other device either does not have an
estimate of the Bluetooth clock or when the estimate is possibly out of date, it is better
to use R1 page scanning with a very short page scan interval, TGAP(106), and Interlaced
scan. This configuration is also useful to achieve nearly the same connection speeds
as R0 page scanning but using less power and leaving bandwidth available for other
connections. Under these circumstances it is possible for paging to complete within
TGAP(106). In this case the Bluetooth device shall page scan for at least TGAP(101).
When connection times are important but not critical enough to sacrifice significant
bandwidth and/or power consumption it is recommended to use either TGAP(107) or
TGAP(108) for the scanning interval. Using Interlaced scan will reduce the connection
time by half but may use twice the power consumption. Under these circumstances it
is possible for paging to complete within one or two times the page scanning interval
depending on whether Interlaced Scan is used. In this case the Bluetooth device shall
page scan for at least TGAP(101).
In all cases the Bluetooth device shall enter the PAGE_SCAN state at least once in
TGAP(102) and scan for at least TGAP(101).
The page scan interval, page scan window size, and scan type for the six scenarios are
described in Table 4.2:
4.3.1.1 Definition
When a Bluetooth device is in non-bondable mode it shall not accept a pairing request
that results in bonding. Devices in non-bondable mode may accept connections that do
not request or require bonding.
When both devices support Secure Simple Pairing and the local device is in non-
bondable mode, the local Host shall respond to an IO capability request where
the Authentication_Requirements parameter requests dedicated bonding or general
bonding with a negative response.
4.3.2.1 Definition
When a Bluetooth device is in bondable mode, and Secure Simple Pairing is not
supported by either the local or remote device, the local device shall respond to a
When both devices support Secure Simple Pairing, the local Host shall respond to a
user confirmation request with a positive response.
The Host is able to configure the Synchronization Train interval based on trade-offs
between bandwidth, potential interference to other devices, power consumption, and the
desired time for a Peripheral to receive a synchronization train packet.
4.4.1.1 Definition
4.4.2.1 Definition
After being made synchronizable, the Bluetooth device shall be synchronizable for at
least TGAP(Sync_Train_Duration).
Table 5.1: Conformance requirements related to the generic authentication procedure and the security
modes defined in this section
5.1 Authentication
5.1.1 Purpose
The generic authentication procedure describes how the LMP-authentication and LMP-
pairing procedures are used when authentication is initiated by one Bluetooth device
towards another, depending on if a link key exists or not and if pairing is allowed or not.
‘Bluetooth authentication’.
5.1.3 Procedure
Authentication
start
link yes
authenticated
already?
no
no
fail
LMP authentication
ok
no Initiate
pairing?
yes
fail
LMP pairing
ok
authentication
authentication ok
failed
5.1.4 Conditions
The local device shall initiate authentication after link establishment. The remote device
may initiate security during or after link establishment.
The flow chart in Figure 5.2, including the steps in Figure 5.3, Figure 5.4, and
Figure 5.5, specifies the overall channel establishment procedures. The following
subsections give more details of these procedures.
Paging
Link Setup
LMP_HOST_
CONNECTION_REQ
No
Figure 5.3
(pre-2.1 only)
LMP_ACCEPTED
Link Setup
complete
Responding
2.0 or lower
Device version?
2.1 or higher
A device may support two security modes simultaneously: security mode 2 for
backwards compatibility with remote devices that do not support Secure Simple Pairing
and security mode 4 for devices that support Secure Simple Pairing.
Legacy security modes apply to those devices with a Controller or a Host that does not
support SSP.
When a remote Bluetooth device is in security mode 1 it will never initiate any
security procedure (i.e., it will never send LMP_AU_RAND, LMP_IN_RAND or
LMP_ENCRYPTION_MODE_REQ).
When a remote Bluetooth device is in security mode 2 it will not initiate any security
procedure before a channel establishment request (L2CAP_CONNECTION_REQ) has
been received or a channel establishment procedure has been initiated by itself.
Whether a security procedure is initiated or not depends on the security requirements of
the requested channel or service.
A Bluetooth device in security mode 2 should classify the security requirements of its
services using at least the following attributes:
• Authorization required
• Authentication required
• Encryption required
Note: Security mode 1 can be considered (at least from a remote device point of view)
as a special case of security mode 2 where no service has registered any security
requirements.
When a remote Bluetooth device is in security mode 3 it will initiate security procedures
before it sends LMP_SETUP_COMPLETE.
A Bluetooth device in security mode 3 may reject the Host connection request
(respond with LMP_NOT_ACCEPTED to the LMP_HOST_CONNECTION_REQ) based
on settings in the Host (e.g., only communication with pre-paired devices allowed).
LMP_NOT_ACCEPTED
A Bluetooth device in security mode 4 shall classify the security requirements of its
services using at least the following attributes (in order of decreasing security):
When both devices support Secure Simple Pairing, GAP shall require at least an
unauthenticated link key and enabling encryption for all connections except those
allowed to have security level 0 (see Section 5.2.2.8). A profile or protocol may
define services that require more security (e.g., an authenticated link key) or no
security (although unencrypted connections are only allowed when connecting to a
service allowed to have security level 0). To allow an unauthenticated link key to be
created during the Secure Simple Pairing procedure, the Authentication_Requirements
parameter may be set to one of the MITM Protection Not Required options.
When the device is in Bondable Mode, it shall enable Secure Simple Pairing mode prior
to entering Connectable Mode or establishing a link.
For services transmitting unicast data over the connectionless L2CAP channel, the
transmitting device shall enforce its security requirements prior to sending data. There
is no mechanism for a device receiving data via the L2CAP connectionless channel
to prevent unencrypted data from being received. Hence, Section 5.2.2.1 addresses
unicast connectionless data transmission together with devices initiating connection-
oriented channels while Section 5.2.2.2 covers only devices responding to requests for
connection-oriented channel establishment but does not cover unicast connectionless
data reception.
When the responding device does not support Secure Simple Pairing, it may disconnect
the link while the initiating device is requesting the PIN to be entered by the user.
This may occur due to the lack of an L2CAP channel being present for longer than an
implementation-specific amount of time (e.g., a few seconds). When this occurs, the
initiating device shall allow the user to complete entering the PIN and shall then re-page
the remote device and restart the pairing procedure (see [Vol 2] Part C, Section 4.2.2)
using the PIN entered.
When a Bluetooth device in security mode 4 initiates access to a remote service via
a connection-oriented L2CAP channel, the service requires security, and a sufficient
link-key is not available, the local device shall perform pairing procedures and enable
When a Bluetooth device in security mode 4 transmits data to a remote service via
the unicast connectionless L2CAP channel and a sufficient link-key is not available, the
local device shall perform pairing procedures and enable encryption before transmitting
unicast data on the connectionless L2CAP channel.
See Section 5.2.2.8 for details on determining whether or not a link key is sufficient.
If pairing does not succeed, the local device shall not send a channel establishment
request. The local device may re-try pairing up to three (3) times. If pairing fails three
consecutive times, the local device shall disconnect the ACL link with error code 0x05 -
Authentication Failure.
If the link key generated is not at least as good as the expected or required type, the
local device shall fail the establishment and may disconnect the ACL link with error code
0x05 - Authentication Failure.
When a Bluetooth device in security mode 4 initiates access to a remote service via a
connection-oriented L2CAP channel and a sufficient link key is available for the remote
device, it shall authenticate the remote device and enable encryption before sending a
channel establishment request (an L2CAP connection request or a higher layer-channel
establishment request such as that of RFCOMM).
When a Bluetooth device in security mode 4 transmits unicast data to a remote service
via the connectionless L2CAP channel and security is required for the application and a
sufficient link-key is available then the local device shall authenticate the remote device
and enable encryption before transmitting unicast data on the L2CAP connectionless
channel.
See Section 5.2.2.8 for details on determining whether or not a link key is sufficient.
Channel
Establistment or
Connection
Establistment or
preparation for
connectionless
data TX
Yes
Secure Simple
Pairing or Legacy
Pairing
Abort
L2CAP
L2CAP connection
CONNECTION
- request
REQ
or application-specific
request or
connectionless data TX
Figure 5.4: Channel establishment using security mode 4 for initiating side
After encryption is enabled and both devices support cross-transport key generation,
the Central of the BR/EDR transport may perform LE key generation and distribution
([Vol 3] Part H, Section 2.3.5.7). The Peripheral shall not perform LE key generation and
distribution.
If a role switch gets performed after enabling encryption but before the LE keys can
be generated and distributed, the new Central may perform LE key generation and
distribution once the role switch has completed. The new Peripheral shall not perform
LE key generation and distribution once the role switch has completed.
5.2.2.2 Security for access to local service by remote device (responding side)
When a remote device attempts to access a service offered by a Bluetooth device that
is in security mode 4 and the service requires security, a sufficient link key exists, and
authentication has not been performed, the local device shall authenticate the remote
device and enable encryption after the channel establishment request is received but
before a channel establishment confirmation (L2CAP connection response with result
code of 0x0000 or a higher-level channel establishment confirmation such as that of
RFCOMM) is sent.
When L2CAP is the channel establishment protocol being used for the requested
service, an L2CAP connection response signaling packet shall be sent by the
responding device containing a pending result code following receipt of an L2CAP
connection request and prior to initiating security procedures which can result in
prompting the local user for input (e.g., pairing using a PIN or Secure Simple Pairing
using either the Passkey entry or Numerical Comparison association models). This will
stop the L2CAP RTX timer on the remote device (which may be as short as 1 second)
and will invoke the ERTX timer on the remote device, which is a minimum duration of 60
seconds.
See [Vol 3] Part A, Section 6.2 for additional information on L2CAP RTX and ERTX
timers. See also [Vol 3] Part A, Section 4.3 and [Vol 3] Part A, Section 4.26 for
additional information on the L2CAP connection response signaling packets and the
defined result codes.
establishment protocol is L2CAP, then the result code in the L2CAP connection
response shall be set to indicate that the connection was refused due to
security reasons. If an L2CAP_CONNECTION_RSP is being sent, then the
result code shall be set to 0x0003 (connection refused - security block). If an
L2CAP_CREDIT_BASED_CONNECTION_RSP is being sent, then the result code
shall be set to 0x0005 (All connections refused - insufficient authentication), 0x0006
(All connections refused - insufficient authorization), 0x0007 (All connections refused
- encryption key size too short), or 0x0008 (All connections refused - insufficient
encryption).
If the remote device has indicated support for Secure Simple Pairing, a channel
establishment request is received for a service other than SDP, and encryption has
not yet been enabled, then the local device shall disconnect the ACL link with error code
0x05 - Authentication Failure.
See Section 5.2.2.6 for details on determining whether or not a link key is sufficient.
If pairing does not succeed, then the local device shall not send a channel
establishment confirmation. The local device may retry pairing up to three (3) times.
If pairing fails three consecutive times, then the local device shall disconnect the ACL
link with error code 0x05 - Authentication Failure.
If the link-key generated is not at least as good as the expected or required type or if
enabling encryption does not result in the correct encryption type (i.e. AES-CCM or E0),
then the local device shall fail the channel establishment and may disconnect the ACL
link with error code 0x05 - Authentication Failure.
See Section 5.2.2.6 for details on determining whether or not a link key is sufficient.
If authentication does not succeed, then the local device shall not send a channel
establishment confirmation. The Host may at this point notify the user and offer to
perform pairing.
L2CAP connection
request
or application-specific
request
Que ry security
DB
No No Yes
Encryption
Ena bled?
No
Success?
No
No Encryption
key size lo ng
eno ugh?
Cross-transport
Yes No
Key gener atio n
and distribution
possible?
Yes
LE key ge neration
and distribution
([vo l 3] Part H,
Section 2.3.5.7)
L2CAP connection
L2CAP connection
response (failure) or
response (success) or
application-specific
application-specific
failure report
accept message
Figure 5.5: Channel establishment using security mode 4 for the responding side
After encryption is enabled and both devices support cross-transport key generation,
the Central of the BR/EDR transport may perform LE key generation and distribution
([Vol 3] Part H, Section 2.3.5.7). The Peripheral shall not perform LE key generation and
distribution.
If a role switch gets performed after enabling encryption but before the LE keys can
be generated and distributed, the new Central may perform LE key generation and
distribution once the role switch has completed. The new Peripheral shall not perform
LE key generation and distribution once the role switch has completed.
When both devices support Secure Simple Pairing all non-SDP connections are
encrypted regardless of whether security was required or whether the devices are
bonded or not. The initial connection between the two devices will result in a link key
through Secure Simple Pairing. Depending on whether or not bonding was performed
and the security policy of the initiating device, the link key may be stored. When the link
key is stored, subsequent connections to the same device will use authentication but
this may fail if the remote device has deleted the link key. Table 5.2 defines what shall
be done depending on the type of the link key and whether bonding was performed or
not.
Link Key Type Devices Bonded? Action to take when Authentication Fails
Combination No Depends on security policy of the device:
• Option 1: Automatically initiate pairing
• Option 2: Notify user and ask if pairing is ok
Option 2 is recommended.
Combination Yes Notify user of security failure
Unauthenticated No Depends on security policy of the device:
• Option 1: Automatically initiate secure simple pairing
• Option 2: Notify user and ask if secure simple pairing is ok.
Option 1 is recommended.
Unauthenticated Yes Notify user of security failure
Link Key Type Devices Bonded? Action to take when Authentication Fails
Authenticated No Depends on security policy of the device:
• Option 1: Automatically initiate secure simple pairing
• Option 2: Notify user and ask if secure simple pairing is ok
Option 2 is recommended.
Authenticated Yes Notify user of security failure
5.2.2.4 IO capabilities
Capability Description
No input Device does not have the ability to indicate 'yes' or 'no'
Yes / No Device has at least two buttons that are mapped easily to 'yes' and 'no' or the
device has a mechanism whereby the user can indicate either 'yes' or 'no' (see
note below).
Keyboard Device has a numeric keyboard that can input the numbers '0' to '9' and a confir-
mation. Device also has two buttons that can be easily mapped to 'yes' and 'no'
or the device has a mechanism whereby the user can indicate either 'yes' or 'no'
(see Note below).
Note: 'yes' could be indicated by pressing a button within a certain time limit otherwise
'no' would be assumed.
Capability Description
No output Device does not have the ability to display or communicate a 6 digit decimal
number
Numeric output Device has the ability to display or communicate a 6 digit decimal number
The individual input and output capabilities are mapped to a single IO capability which is
later used to determine which authentication algorithm will be used.
When a device has OOB authentication information from the remote device, it will
indicate it in the LMP_IO_CAPABILITY_RES PDU. When either device has OOB
information, the OOB association model will be used.
The Host may allow the Link Manager to ignore the IO capabilities and use the Numeric
Comparison protocol with automatic accept by setting the Authentication_Requirements
parameter to one of the MITM Protection Not Required options.
Device A
Has not received remote Has received remote OOB
OOB authentication data authentication data
Has not received remote Use the IO capability map- Use OOB association with
OOB authentication data ping table ra = 0
Device B
rb from OOB
Has received remote OOB Use OOB association with Use OOB association with
authentication data ra from OOB ra from OOB
rb = 0 rb from OOB
Second, if neither device has received OOB authentication data and if both devices
have set the Authentication_Requirements parameter to one of the MITM Protection Not
Required options, authentication stage 1 shall function as if both devices set their IO
capabilities to DisplayOnly (e.g., Numeric comparison with automatic confirmation on
both devices).
Finally, if neither device has received OOB authentication data and if one or
both devices have set the Authentication_Requirements parameter to one of the
MITM Protection Required options, the IO and OOB capabilities are mapped to
the authentication stage 1 method as defined in Table 5.7. A Host that has set
the Authentication_Requirements parameter to one of the MITM Protection Required
options shall verify that the resulting Link Key is an Authenticated Combination Key (see
[Vol 4] Part E, Section 7.7.24). Table 5.7 also lists whether the combination key results
in an authenticated or unauthenticated link key.
Device A (Initiator)
Display Only DisplayYesNo KeyboardOnly NoInputNoOutput
DisplayOnly Numeric Com- Numeric Com- Passkey Entry: Numeric Compari-
parison with parison with Responder Dis- son with automatic
automatic con- automatic con- play, Initiator In- confirmation on both
firmation on firmation on put. devices.
both devices. device B only.
Unauthentica- Unauthentica- Authenticated Unauthenticated
ted ted
DisplayYesNo Numeric Com- Numeric Com- Passkey Entry: Numeric Compari-
Device B (Responder)
Device A (Initiator)
Display Only DisplayYesNo KeyboardOnly NoInputNoOutput
NoInputNoOut- Numeric Com- Numeric Com- Numeric Compari- Numeric
put parison with parison with son with automat- Comparison
automatic con- automatic con- ic confirmation on
firmation on firmation on both devices. with automatic con-
both devices. device B only firmation on both
and Yes/No devices.
confirmation
on whether to
pair on device
A. Device A
does not show
the confirma-
tion value.
Unauthentica- Unauthentica- Unauthenticated Unauthenticated
ted ted
Table 5.7: IO capability mapping to authentication stage 1
Mandatory contents:
• Length (2 bytes)
• BD_ADDR (6 bytes)
Optional contents:
The length field includes all bytes in the OOB data block including the length field itself.
The BD_ADDR will be a fixed field in the beginning of the OOB data block. Following
the BD_ADDR will be zero or more EIR tag fields containing optional contents. The EIR
tag format will be used for the optional contents. See Figure 5.6.
Length Data
If Secure Simple Pairing fails when one or both devices have OOB Authentication Data
present, both devices shall discard the OOB Authentication Data and the device that
originally initiated authentication shall re-initiate authentication. Although the user may
get involved in authentication as defined by the IO capabilities of the two devices, falling
back to the in-band association model will prevent deadlock conditions when one or
both devices has stale OOB Authentication Data.
There is a MIME type defined for use with the OOB data format. The MIME type can be
found from the following link: http://www.iana.org/assignments/media-types/application/
vnd.bluetooth.ep.oob
A Bluetooth device in security mode 4 shall classify and enforce the security
requirements of its services using the following levels attributes (in order of decreasing
security) for use when pairing with remote devices supporting Secure Simple Pairing:
The security level required for each service offered should be stored in a security
database that is accessed to determine the type of link key and the encryption key
size that is required for access to the respective service. The security level required
for service data transmitted on an L2CAP connection-oriented channel may differ from
the security level required for service data transmitted on another L2CAP connection-
oriented channel or on the connectionless L2CAP channel. Table 5.8 shows the type
of link key required for each security level for both remote devices that support Secure
Simple Pairing and for those that do not.
Security Level Required for Service Link Key type Link Key Comments
required for type
remote required for
devices that remote
support SSP devices that
do not
support SSP
Level 4 Authenticated NA Highest Security
• Authentication of the remote device (P-256 based Only possible when both
required Secure Simple devices support Secure
Pairing and Se- Connections
• MITM protection required
cure Authenti-
• Encryption required cation)
• User interaction acceptable
Level 3 Authenticated Combination High Security
• Authentication of the remote device (16 digit PIN
required recommen-
ded)
• MITM protection required
• Encryption required
• User interaction acceptable
Level 2 Unauthentica- Combination Medium Security
ted
• Authentication of the remote device
required
• MITM protection not necessary
• Encryption desired
Level 1 Unauthentica- None Low Security
ted
• Authentication of the remote device
required when encryption is enabled
• MITM protection not necessary
• Encryption not necessary1
• Minimal user interaction desired
Security Level Required for Service Link Key type Link Key Comments
required for type
remote required for
devices that remote
support SSP devices that
do not
support SSP
Level 0 None None Permitted only for SDP
and service data sent via
• Authentication of the remote device
either L2CAP fixed sig-
not required
naling channels or the
• MITM protection not necessary L2CAP connectionless
channel to PSMs that
• Encryption not necessary
correspond to service
• No user interaction desired class UUIDs which are
allowed to utilize Level 0.
1Though encryption is not necessary for the service for Level 1, the specification mandates the use of
encryption for all services other than SDP when the remote device supports SSP.
An authenticated link key is a link key where either the numeric comparison, out-
of-band, or passkey entry Secure Simple Pairing association models were used.
An authenticated link key has protection against MITM attacks. To ensure that an
authenticated link key is created during the Secure Simple Pairing procedure, the
Authentication_Requirements parameter should be set to one of the MITM Protection
Required options.
An unauthenticated link key is a link key where the “Just Works” Secure Simple
Pairing association model was used (see [Vol 1] Part A, Section 5.2.4). An
unauthenticated link key does not have protection against MITM attacks. To allow an
unauthenticated link key to be created during the Secure Simple Pairing procedure, the
Authentication_Requirements parameter may be set to one of the MITM Protection Not
Required options.
When both devices support Secure Simple Pairing and at least one device does not
support Secure Connections, the strength of the link key is 96 effective bits. When both
devices support Secure Connections, the strength of the link key is 128 effective bits.
Secure Connections does not change the protection against MITM attacks.
A combination link key is a link key where BR/EDR Legacy Pairing was used to
generate the link-key (see [Vol 2] Part C, Section 4.2.2.4).
When both devices support Secure Simple Pairing, GAP shall require at least an
unauthenticated link key and enable encryption for service traffic sent or received via
connection-oriented L2CAP channels. A profile or protocol may define services that
require more security (for example, an authenticated link key) or no security in the case
of SDP or service traffic sent via the L2CAP connectionless channel for services that do
not require security.
When the device is in Bondable Mode, it shall enable Secure Simple Pairing mode prior
to entering Connectable Mode or establishing a link.
The remote Controller's and remote Host's support for Secure Simple Pairing shall be
determined by the Link Manager Secure Simple Pairing (Host Support) feature bit.
A previously generated link key is considered “sufficient” if the link key type is of
the type required for the service, or of a higher strength. Authenticated link keys are
considered higher strength than Unauthenticated or Combination keys. Unauthenticated
link keys are considered higher strength than Combination keys.
A device shall enforce an encryption key with at least 128-bit equivalent strength for
all services that require Security Mode 4, Level 4. For all other services that require
encryption, a device should enforce an encryption key with at least 56-bit equivalent
strength, irrespective of whether the remote device supports Secure Simple Pairing.
After encryption has been enabled, the Host should check the encryption key size using
either the HCI_Read_Encryption_Key_Size command (see [Vol 4] Part E, Section 7.5.7)
or a vendor-specific method.
The requirements for devices initiating the inquiry and discovery procedures (device A)
are specified in Table 6.1. The requirements on the behavior of the responding device
(device B) are specified in Table 4.1.
Note: Support for LMP-pairing is mandatory (see [Vol 2] Part C, Section 4.2.2).
6.1.1 Purpose
The purpose of the general inquiry procedure is to provide the initiator with the
Bluetooth Device Address, clock, Class of Device, and extended inquiry response
information of devices in either general discoverable mode or limited discoverable
mode.
The general inquiry procedure should be used for general purpose discovery, i.e. to
discover all discoverable devices regardless of whether they are in general discoverable
mode or limited discoverable mode. A device which discovers devices using the general
inquiry procedure and presents them to users in some fashion should distinguish
devices in the limited discoverable mode from those in the general discoverable mode,
e.g., by sorting them to the top of a list of discovered devices or highlighting them in
some way.
Note: The rationale for distinguishing the devices in limited discoverable mode to the
end user is that devices typically enter limited discoverable mode only after explicit
action by the end user, indicating that the user’s immediate goal is to discover and
interact with that specific device.
6.1.3 Description
A B B’ B”
Inquiry (GIAC)
inquiry_res
inquiry_res
list of
Bluetooth
Device
Addresses
Figure 6.1: General inquiry, where B is a device in non-discoverable mode, B´ is a device in limited
discoverable mode and B” is a device in general discoverable mode. (Note: All discoverable devices are
discovered using general inquiry, independent of which discoverable mode they are in.)
6.1.4 Conditions
When general inquiry is initiated by a Bluetooth device, the INQUIRY state shall last
TGAP(100) or longer, unless the inquirer collects enough responses and determines to
abort the INQUIRY state earlier. The Bluetooth device shall perform inquiry using the
GIAC.
In order for Device A to receive inquiry responses, the remote devices in range have to
be made discoverable (limited or general).
The purpose of the limited inquiry procedure is to provide the initiator with the Bluetooth
Device Address, clock, Class of Device, and extended inquiry response information
of limited discoverable devices. The latter devices are devices that are in range with
regard to the initiator, and set to scan for inquiry messages with the Limited Inquiry
Access Code.
The limited inquiry procedure should only be used when it is known that the devices to
be discovered are using limited discoverable mode. The general inquiry procedure (see
Section 6.1) should be used for general purpose discovery when it is desired to discover
all devices regardless of whether they are using limited discoverable mode or general
discoverable mode.
6.2.3 Description
A B B’ B”
Inquiry (LIAC)
inquiry_res
list of
Bluetooth
Device
Addresses
Figure 6.2: Limited inquiry where B is a device in non-discoverable mode, B’ is a device in limited
discoverable mode and B” is a device in general discoverable mode. (Note: Only limited discoverable
devices can be discovered using limited inquiry.)
6.2.4 Conditions
When limited inquiry is initiated by a Bluetooth device, the INQUIRY state shall last
TGAP(100) or longer, unless the inquirer collects enough responses and determines to
abort the INQUIRY state earlier. The Bluetooth device shall perform inquiry using the
LIAC.
In order for Device A to receive inquiry responses, the remote devices in range has to
be made limited discoverable.
The purpose of name discovery is to provide the initiator with the Bluetooth Device
Name of connectable devices (i.e., devices in range that will respond to paging).
6.3.3 Description
Name request is the procedure for retrieving the Bluetooth Device Name from a
connectable Bluetooth device. It is not necessary to perform the full link establishment
procedure (see Section 7.1) in order to just to get the name of another device.
Figure 6.3 specifies the procedure.
A B
Paging
LMP_NAME_REQ
LMP_NAME_RES
LMP_DETACH
Name discovery is the procedure for retrieving the Bluetooth Device Name from
connectable Bluetooth devices by performing name request towards known devices
(i.e., Bluetooth devices for which the Bluetooth Device Addresses are available).
Figure 6.4 specifies the procedure.
A B B’ B”
list of
Bluetooth
Device
Addresses
Name request
Name request
Name request
list of
Bluetooth
Device
Names
6.3.4 Conditions
In the name request procedure, the initiator will use the Device Access Code of the
remote device as retrieved immediately beforehand – normally through an inquiry
procedure.
6.4.1 Purpose
The purpose of device discovery is to provide the initiator with the Bluetooth Device
Address, clock, Class of Device, Bluetooth Device Name, and extended inquiry
response information of discoverable devices.
6.4.3 Description
During the Device Discovery procedure, first an inquiry (either general or limited) is
performed, and then name discovery is done towards some or all of the devices that
responded to the inquiry. If the initiator of the device discovery receives a complete
local name or a shortened local name that is considered long enough, via an extended
inquiry response from a remote device, the initiator should not do a separate name
discovery for that device.
A B B’ B”
Inquiry
list of discovered
Bluetooth devices
(Bluetooth Device
Addresses and
Extended Inquiry
Response information)
Name discovery
list of discovered
Bluetooth devices
(Bluetooth
Device Names)
6.4.4 Conditions
Conditions for both inquiry (general or limited) and name discovery must be fulfilled
(i.e., devices discovered during device discovery must be both discoverable and
connectable).
6.5 Bonding
6.5.1 Purpose
The purpose of bonding is to create a relation between two Bluetooth devices based
on a common link key (a bond). The link key is created and exchanged (pairing) during
the bonding procedure and is expected to be stored by both Bluetooth devices, to be
used for future authentication. In addition to pairing, the bonding procedure can involve
higher-layer initialization procedures.
’Bluetooth Bonding’
6.5.3 Description
Two forms of bonding are described in the following sections: General Bonding and
Dedicated Bonding.
6.5.3.1 General Bonding
General Bonding refers to the process of performing bonding during connection setup
or channel establishment procedures as a precursor to accessing a service. Figure 6.6
specifies General Bonding.
When the devices that are performing General Bonding both support Secure Simple
Pairing, the Authentication_Requirements parameter should be set to MITM Protection
Not Required – General Bonding unless the security policy of an available local service
requires MITM Protection in which case the Authentication_Requirements parameter
shall be set to MITM Protection Required – General Bonding. 'No bonding' is used when
the device is performing a Secure Simple Pairing procedure, but does not intend to
retain the link key after the physical link is disconnected.
A B
Delete
link key
to paged
device
LMP_HOST_CONNECTION_REQ
LMP_ACCEPTED
LMP_SETUP_COMPLETE
LMP_SETUP_COMPLETE
Pairing
Dedicated Bonding refers to a procedure wherein one device connects to another only
for the purpose of pairing without accessing a particular service. Figure 6.7 specifies
When the devices that are performing Dedicated Bonding both support Secure Simple
Pairing, the Authentication_Requirements parameter should be set to MITM Protection
Not Required – Dedicated Bonding unless the security policy of an available local
service requires MITM Protection in which case the Authentication Required parameter
shall be set to MITM Protection Required – Dedicated Bonding. 'No bonding' is used
when the device is performing a Secure Simple Pairing procedure, but does not intend
to retain the link key after the physical link is disconnected.
As an exception to the normal process, device B shall also accept pairing before
the exchange of LMP_SETUP_COMPLETE PDUs (this can only happen if device A
conforms to a lower version of the specification).
A B
Delete
link key
to paged
device
LMP_HOST_CONNECTION_REQ
LMP_ACCEPTED
Pairing
(only when device
A is 2.0 or below)
LMP_SETUP_COMPLETE
LMP_SETUP_COMPLETE
Pairing
(normal case)
LMP_DETACH
6.5.4 Conditions
Before bonding can be initiated, the initiating device (A) must know the Device
Access Code of the device to pair with. This is normally done by first performing
device discovery. A Bluetooth Device that can initiate bonding (A) should use limited
inquiry, and a Bluetooth Device that accepts bonding (B) should support the limited
discoverable mode.
• The paged device (B) shall be set into bondable mode. The paging device (A) is
assumed to allow pairing since it has initiated the bonding procedure.
• The paging device (the initiator of the bonding procedure, A) shall initiate
authentication.
• Before initiating the authentication part of the bonding procedure, the paging device
should delete any link key corresponding to a previous bonding with the paged
device.
The establishment procedures defined here do not include any discovery part. Before
establishment procedures are initiated, the information provided during device discovery
(in the FHS packet or the extended inquiry response packet of the inquiry response
or in the response to a name request or in the synchronization train packet) must be
available in the initiating device.
• The Bluetooth Device Address (BD_ADDR) from which the Device Access Code is
generated
• The system clock of the remote device
Additional information provided during device discovery that may be useful for making
the decision to initiate an establishment procedure is:
7.1.1 Purpose
7.1.3 Description
In this subsection, the paging device (A) is in security mode 3. During link
establishment, the paging device cannot distinguish if the paged device (B) is in security
mode 1, 2 or 4.
A B
Paging
Switch negotiation
Link setup
LMP_HOST_CONNECTION_REQ
LMP_ACCEPTED
Authentication
Encryption negotiation
Figure 7.1: Link Establishment procedure when the paging device (A) is in security mode 3 and the paged
device (B) is in security mode 1, 2, or 4
A B
Paging
Link setup
LMP_HOST_CONNECTION_REQ
Switch negotiation
LMP_ACCEPTED
Authentication
Authentication
Encryption negotiation
Figure 7.2: Link Establishment procedure when both the paging device (A) and the paged device (B) are
in security mode 3
7.1.4 Conditions
The paging procedure shall be according to [Vol 2] Part B, Section 8.3 and the
paging device should use the Device Access Code and page mode received through a
previous inquiry. When paging is completed, a physical link between the two Bluetooth
devices is established.
If role switching is needed it should be done as early as possible after the physical link
is established. If the paging device does not accept the switch, the paged device has to
consider whether to keep the physical link or not.
Both devices may perform link setup (using LMP procedures that require no interaction
with the Host on the remote side). Optional LMP features can be used after having
confirmed (using LMP_FEATURES_REQ) that the other device supports the feature.
When the paging device needs to go beyond the link setup phase, it issues a request to
be connected to the Host of the remote device. If the paged device is in security mode
3, this is the trigger for initiating authentication.
After an authentication has been performed, any of the devices can initiate encryption.
7.2.3 Description
In this subsection, the initiator (A) is in security mode 3. During channel establishment,
the initiator cannot distinguish if the acceptor (B) is in security mode 1 or 3.
A B
established link
L2CAP_CONNECTION_REQ
Authentication
Encryption negotiation
L2CAP_CONNECTION_RSP (success)
Figure 7.3: Channel Establishment procedure when the initiator (A) is in security mode 3 and the acceptor
(B) is in security mode 2 or 4
A B
established link
L2CAP_CONNECTION_REQ
L2CAP_CONNECTION_RSP (success)
Figure 7.4: Channel Establishment procedure when the initiator (A) is in security mode 3 and the acceptor
(B) is in security mode 1 or 3
7.2.4 Conditions
Channel establishment starts after link establishment is completed when the initiator
sends a channel establishment request (L2CAP_CONNECTION_REQ).
Depending on security mode, security procedures may take place after the channel
establishment has been initiated.
7.3.3 Description
A B
established channel
Authentication
Encryption negotiation
Figure 7.5: Connection Establishment procedure when the initiator (A) is in security mode 3 and the
acceptor (B) is in security mode 2 or 4
A B
established channel
Figure 7.6: Connection Establishment procedure when the initiator (A) is in security mode 3 and the
acceptor (B) is in security mode 1 or 3
7.3.4 Conditions
When a Bluetooth device has established one connection with another Bluetooth
device, it may be available for establishment of:
If the new establishment procedure is to be towards the same device, the security part
of the establishment depends on the security modes used. If the new establishment
procedure is to be towards a new remote device, the device should behave according
to Active modes independent of the fact that it already has another physical link
established (unless allowed co-incident radio and Baseband events have to be
handled).
7.5.3 Description
In Figure 7.7 the receiving device (B) is attempting to receive synchronization train
packets from device (A).
A B
Set Connectionless
Peripheral Broadcast
Broadcast
Broadcast
Broadcast
Sync Train
Sync Train
7.5.4 Conditions
After receiving a synchronization train packet, the receiving device can listen to and
receive profile data sent via Connectionless Peripheral Broadcast by device A.
Devices A and B may go through a separate Link Establishment procedure any time
they desire to establish an ACL logical transport between each other. They may also
use Connectionless Peripheral Broadcast procedures with an ACL logical transport
already established.
The receiving device shall enter the Synchronization Scan substate using a scan
interval of TGAP(Sync_Scan_Interval) and a scan window of TGAP(Sync_Scan_Window).
The extended inquiry response data format is shown in Figure 8.1. The data is 240
octets and consists of a significant part and a non-significant part. The significant part
contains a sequence of data structures. Each data structure shall have a length field of
one octet, which contains the Length value, and a data field of Length octets. The first
n octets of the data field contain the extended inquiry response (EIR) data type. The
content of the remaining Length - n octets in the data field depends on the value of the
EIR data type and is called the EIR data. The non-significant part extends the extended
inquiry response to 240 octets and shall contain all-zero octets.
Length Data
The extended inquiry response data formats and meanings are defined in Section 1 of
[4].The extended inquiry response data type values are defined in Assigned Numbers.
If the length field is set to zero, then the data field has zero octets. This shall only occur
to allow an early termination of the tagged data.
To reduce interference, the Host should try to minimize the amount of EIR data such
that the Baseband can use a 1-slot or 3-slot EIR packet. This is advantageous because
it reduces interference and maximizes the probability that the EIR packet will be
received. If applications on a Host provide more than 240 bytes of extended inquiry
response data, it is up to the Host to limit it to 240 octets.
The EIR data shall be sent during the inquiry response state. In selecting the packet
type to be used, FEC (DM1 or DM3) should be considered to maximize the range.
The Host shall include the device name in the EIR data according to the following rules:
1. If the device does not have a device name (i.e., no octets) and
a. If there is no other data to be sent in the EIR packet, the Host shall send a
name tag with zero length and the type field set to indicate that this is the
complete name (i.e., total of 2 octets with length = 1).
b. If there is other important data to be sent in the EIR packet and a zero octet
name tag will not fit, the Host may avoid sending the name tag.
2. If the device has a device name (greater than zero octets) and
a. If it is too long be included in the EIR packet (given the choice of packet type
and any other data that is being sent), the Host may send a shortened version
of the name (even no octets) and shall mark the name as 'shortened' to inform
the receiver that a remote name request is required obtain the full name if the
name is needed.
b. If there are no other data to be sent in the EIR packet (given the choice of
packet type selected), the Host shall maximize the length of the device name
to be sent, this may be complete or shortened name (e.g., if DM1 packet is
chosen and device name characters equates to greater than 15 octets, then
Host sends first few characters that equates to 15 octets or less with shortened
flag).
Note: It is not necessary to understand each and every EIR data type. If the Host does
not understand a given EIR data type value it should just skip over Length octets and
look for the next EIR data structure.
Each of the above modes and procedures are independent from each other but are
closely related since a combination of the modes and procedures are necessary for
most devices to communicate with each other. Both the modes and procedures may be
entered or executed respectively as a result of direct user action or autonomously by a
device.
The Host shall configure the Controller with its local Link Layer feature information as
defined in [Vol 6] Part B, Section 4.6 before performing any of the above modes and
procedures.
The types of advertising used in these modes and procedures for each of the
associated GAP roles are defined in Section 2.2.2 Table 2.1.
9.1.1.1 Definition
The Broadcast mode provides a method for a device to send connectionless data in
advertising events.
9.1.1.2 Conditions
A device in the Broadcast mode shall send data using non-connectable advertising
events.
The advertising data shall be formatted using the Advertising Data (AD) type format
as defined in Section 1.3 of [4]. A device in the Broadcast mode shall not set the ‘LE
General Discoverable Mode’ flag or the ‘LE Limited Discoverable Mode’ flag in the Flags
AD Type as defined in Section 1.3 of [4].
Note: All data sent by a device in the Broadcast mode is considered unreliable since
there is no acknowledgment from any device that may have received the data.
The device may configure and enable multiple independent advertising sets. Each
advertising set may have an independent advertising filter policy.
9.1.2.1 Definition
9.1.2.2 Conditions
A device performing the Observation procedure may use passive scanning or active
scanning to receive advertising events.
A device performing the Observation procedure may use active scanning to also receive
scan response data sent by any device in the Broadcast mode that advertises using
scannable advertising events.
Note: In use cases where a device in the Broadcast mode sends dynamic data, the
receiving device should disable duplicate filtering capability in the Controller so that the
Host receives all advertising packets received by the Controller.
Some devices may only scan for advertising events using legacy advertising PDUs.
It is therefore recommended that devices using advertising events with the extended
advertising PDUs also use an advertising set with advertising events that use legacy
advertising PDUs.
If the device is in one of the discoverable modes, and if multiple advertising sets are
used with the same Identity Address or the same IRK, then those advertising sets shall
also share the same advertising filter policy.
9.2.1 Requirements
9.2.2.1 Description
A device configured in non-discoverable mode will not be discovered by any device that
is performing either the general discovery procedure or the limited discovery procedure.
9.2.2.2 Conditions
A device in the non-discoverable mode may send advertising events. If the device
sends advertising events, it shall not set the ‘LE General Discoverable Mode’ flag or ‘LE
Limited Discoverable Mode’ flag in the Flags AD type (see Section 1.3 of [4]).
If the device sends advertising events, then it is recommended that the Host configures
the Controller as follows:
• The Host should set the advertising filter policy for all advertising sets to either
‘process scan and connection requests only from devices in the Filter Accept List’ or
‘process scan and connection requests from all devices’.
• The Host should set the advertising intervals as defined in Section 9.3.11.
9.2.3.1 Description
Devices configured in the limited discoverable mode are discoverable for a limited
period of time by other devices performing the limited or general device discovery
procedure. Devices typically enter the limited discoverable mode when a user performs
a specific action.
• Limited discoverable mode can be used to allow remote devices using the general
discovery procedure to prioritize or otherwise identify devices in limited discoverable
mode when presenting discovered devices to the end user because, typically, the
user is interacting with them.
• Limited discoverable mode can also be used to allow remote devices using the limited
discovery procedure to filter out devices using the general discoverable mode.
9.2.3.2 Conditions
A device in the limited discoverable mode shall send advertising event types with the
advertising data including the Flags AD type as defined in Section 1.3 of [4] with all the
following flags set as described:
The advertising data should also include the following AD types to enable a faster
connectivity experience:
While a device is in limited discoverable mode the Host configures the Controller as
follows:
• The Host shall set the advertising filter policy for all advertising sets that share the
same Identity Address or the same IRK to ‘process scan and connection requests
from all devices’.
• The Host should set the advertising intervals as defined in Section 9.3.11.
The device shall remain in limited discoverable mode until a connection is established
or the Host terminates the mode.
Note: The choice of advertising interval is a trade-off between power consumption and
device discovery time.
The device may configure and enable multiple independent advertising sets.
9.2.4.1 Description
Devices configured in the general discoverable mode are discoverable for an indefinite
period of time by devices performing the general discovery procedure. Devices typically
enter general discoverable mode autonomously.
Devices in the general discoverable mode will not be discovered by devices performing
the limited discovery procedure. General discoverable mode should not be used if
it is known that the device performing discovery will be using the limited discovery
procedure (see Section 9.2.5).
9.2.4.2 Conditions
A device in general discoverable mode shall send advertising events with the
advertising data including the Flags AD data type as defined in Section 1.3 of [4] with all
the following flags set as described:
The advertising data should also include the following AD types to enable a faster
connectivity experience:
While a device is in general discoverable mode the Host configures the Controller as
follows:
• The Host shall set the advertising filter policy for all advertising sets that share the
same Identity Address or the same IRK to ‘process scan and connection requests
from all devices’.
• The Host should set the advertising intervals as defined in Section 9.3.11.
The device shall remain in general discoverable mode until a connection is established
or the Host terminates the mode.
Note: Host data used in legacy advertising events that change frequently should be
placed in the advertising data and static data should be placed in the scan response
data.
Note: The choice of advertising interval is a trade-off between power consumption and
device discovery time.
9.2.5.1 Description
A device performing the limited discovery procedure receives the device address,
advertising data and scan response data from devices in the limited discoverable mode
only.
The limited discovery procedure should only be used when it is known that the devices
to be discovered are using limited discoverable mode. The general discovery procedure
(see Section 9.2.6) should be used for general purpose discovery when it is desired to
discover all devices regardless of whether they are using limited discoverable mode or
general discoverable mode.
make general
discoverable
start scanning
stop scanning
list of limited
discoverable
mode
devices only
Figure 9.1: A Central performing limited discovery procedure discovering Peripherals in the limited
discoverable mode
9.2.5.2 Conditions
When a Host performs the limited discovery procedure, the Host configures the
Controller as follows:
1. The Host shall set the scanning filter policy to an unfiltered scanning policy (see
[Vol 6] Part B, Section 4.3.3).
2. The Host should set the scan interval and scan window as defined in
Section 9.3.11.
3. The Host should configure the Controller to use active scanning.
The Host shall begin scanning for advertising packets and should continue for
a minimum of TGAP(lim_disc_scan_min) when scanning on the LE 1M PHY and
TGAP(lim_disc_scan_min_coded) when scanning on the LE Coded PHY, unless the Host
ends the limited discovery procedure.
The Host shall check for the Flags AD type in the advertising data. If the Flags AD
type is present and the LE Limited Discoverable Flag is set to one then the Host shall
consider the device as a discovered device, otherwise the advertising data shall be
ignored. The Flag AD type is defined in Section 1.3 of [4]. The advertising data of the
discovered device may contain data with other AD types, e.g. Service UUIDs AD type,
TX Power Level AD type, Local Name AD type, Peripheral Connection Interval Range
AD type. The Host may use the data in performing any of the connection establishment
procedures.
The Host shall ignore the 'Simultaneous LE and BR/EDR to Same Device Capable
(Controller)' bit in the Flags AD type.
9.2.6.1 Description
A device performing the general discovery procedure receives the device address,
advertising data and scan response data from devices in the limited discoverable mode
or the general discoverable mode.
The general discovery procedure should be used for general purpose discovery, i.e. to
discover all discoverable devices regardless of whether they are in general discoverable
mode or limited discoverable mode. A device which discovers devices using the general
discovery procedure and presents them to users in some fashion should distinguish
devices in the limited discoverable mode from those in the general discoverable mode,
e.g., by sorting them to the top of a list of discovered devices or highlighting them in
some way.
Note: The rationale for distinguishing the devices in limited discoverable mode to the
end user is that devices typically enter limited discoverable mode only after explicit
action by the end user, indicating that the user’s immediate goal is to discover and
interact with that specific device.
make general
discoverable
start scanning
stop scanning
list of all
limited and
general
discoverable
mode
devices
Figure 9.2: A Central performing General Discovery procedure discovering Peripherals in the Limited
Discoverable mode and General Discoverable mode
9.2.6.2 Conditions
When a Host performs the general discovery procedure, the Host configures the
Controller as follows:
1. The Host shall set the scanning filter policy to an unfiltered scanning policy (see
[Vol 6] Part B, Section 4.3.3).
2. The Host should set the scan interval and scan window as defined in
Section 9.3.11.
3. The Host should configure the Controller to use active scanning.
The Host shall begin scanning for advertising packets and should continue for
a minimum of TGAP(gen_disc_scan_min) when scanning on the LE 1M PHY and
The Host shall check for the Flags AD type in the advertising data. If the Flags AD
type (see Section 1.3 of [4]) is present and either the LE General Discoverable Mode
flag is set to one or the LE Limited Discoverable Mode flag is set to one then the
Host shall consider the device as a discovered device, otherwise the advertising data
shall be ignored. The advertising data of the discovered device may contain data with
other AD types, e.g. Service UUIDs AD type, TX Power Level AD type, Local Name
AD type, Peripheral Connection Interval Range AD type. The Host may use the data in
performing any of the connection establishment procedures as defined in Section 9.3.
The Host shall ignore the 'Simultaneous LE and BR/EDR to Same Device Capable
(Controller)' bit in the Flags AD type.
9.2.7.1 Description
The name discovery procedure is used to obtain the Bluetooth Device Name of a
remote connectable device.
9.2.7.2 Conditions
If the complete device name is not acquired while performing either the limited
discovery procedure or the general discovery procedure, then the name discovery
procedure may be performed.
1. The Host shall establish a connection using one of the connection establishment
procedures as defined in Section 9.3.
2. The Host shall read the device name characteristic using the GATT procedure
Read Using Characteristic UUID [Vol 3] Part G, Section 4.8.2
3. The connection may be terminated after the GATT procedure has completed.
When devices are connected, the parameters of the connection can be updated with
the Connection Parameter Update procedure. The connected device may terminate
the connection using the Terminate Connection procedure. The requirements for a
device to support the connection modes and procedures are defined in Table 9.3. These
requirements refer to the specific role a device is operating in. Devices supporting
multiple roles shall support the specified modes and procedures for a given role while
operating in that role.
9.3.1 Requirements
9.3.2.1 Description
9.3.2.2 Conditions
• The Host should set the advertising filter policy to either ‘process scan and
connection requests only from devices in the Filter Accept List’ or ‘process scan and
connection requests from all devices’.
• The Host should set the advertising intervals as defined in Section 9.3.11.
The device may configure and enable multiple independent advertising sets. Each
advertising set may have an independent advertising filter policy.
9.3.3.1 Description
A device in the directed connectable mode shall accept a connection request from
a known peer device performing the auto connection establishment procedure or the
general connection establishment procedure.
9.3.3.2 Conditions
The device may configure and enable multiple independent advertising sets. Each
advertising set may have an independent advertising filter policy.
9.3.4.1 Description
A device in the undirected connectable mode shall accept a connection request from
a device performing the auto connection establishment procedure or the general
connection establishment procedure.
9.3.4.2 Conditions
A Peripheral should follow the guidelines defined in Section 9.3.11. A Peripheral shall
send either connectable and scannable undirected advertising events or connectable
undirected advertising events.
The device may configure and enable multiple independent advertising sets. Each
advertising set may have an independent advertising filter policy.
9.3.5.1 Description
The auto connection establishment procedure allows the Host to configure the
Controller to autonomously establish a connection with one or more devices in the
directed connectable mode or the undirected connectable mode. This procedure uses
the Filter Accept List in the initiator to store the addresses of the devices that can be
connected to. The Controller autonomously establishes a connection with a device with
the device address that matches the address stored in the Filter Accept List.
9.3.5.2 Conditions
Figure 9.3 shows the flow chart for a device performing the auto connection
establishment procedure.
Auto connection
establishment
procedure
End of procedure
Figure 9.3: Flow chart for a device performing the Auto Connection Establishment procedure
When a Host performs the auto connection establishment procedure, the Host
configures the Controller as follows:
1. The Host shall write the list of device addresses that are to be auto connected to
into the Filter Accept List.
2. The Host shall set the initiator filter policy to ‘process connectable advertising
packets from all devices in the Filter Accept List’.
3. The Host should set the scan interval and scan window as defined in
Section 9.3.11.
4. The Host should set connection parameters as defined in Section 9.3.12.
9.3.6.1 Description
9.3.6.2 Conditions
Figure 9.4 shows the flow chart for a device performing the general connection
establishment procedure.
General connection
establishment procedure
Connect to
Peripheral
device?
Yes
Stop scanning
Connection successful
End of procedure
Figure 9.4: Flow chart for a device performing the General Connection Establishment procedure
When a Host performs the general connection establishment procedure, the Host
configures the Controller as follows:
1. The Host shall set the scanning filter policy to an unfiltered scanning policy (see
[Vol 6] Part B, Section 4.3.3).
2. The Host should set the scan interval as defined in Section 9.3.11.
3. The Host should set the scan window as defined in Section 9.3.11.
4. The Host shall start active scanning or passive scanning.
5. The Host should set connection parameters as defined in Section 9.3.12.
When the Host discovers a device to which the Host may attempt to connect, the
Host shall stop the scanning, and initiate a connection using the direct connection
establishment procedure.
9.3.7.1 Description
9.3.7.2 Conditions
Figure 9.5 shows the flow chart for a device performing the selective connection
establishment procedure.
When a Host performs the selective connection establishment procedure, the Host
configures the Controller as follows:
1. The Host shall write the list of device addresses that are to be selectively
connected into the Filter Accept List.
2. The Host shall set the scanning filter policy to a filtered scanning policy (see [Vol 6]
Part B, Section 4.3.3).
3. The Host should set the scan interval as defined in Section 9.3.11.
4. The Host should set the scan window as defined in Section 9.3.11.
5. The Host shall start active scanning or passive scanning.
When the Host discovers one of the peer devices it is connecting to, the Host shall stop
scanning, and initiate a connection using the direct connection establishment procedure
with the connection configuration parameters for that peer device.
Selective connection
establishment procedure
Start scanning
Connect to
Peripheral no
device?
yes
Stop scanning
End of procedure
Figure 9.5: Flow chart for a device performing the Selective Connection Establishment procedure
9.3.8.1 Description
9.3.8.2 Conditions
Figure 9.6 shows the flow chart for a device performing the direct connection
establishment procedure.
Direct connection
establishment procedure
End of procedure
Figure 9.6: Flow chart for a device performing the Direct Connection Establishment procedure
When a Host performs the direct connection establishment procedure, the Host
configures the Controller as follows:
1. The Host shall set the initiator filter policy to ‘ignore the Filter Accept List and
process connectable advertising packets from a specific single device specified by
the Host’.
2. The Host shall set the peer address to the device address of the specific single
device.
9.3.9.1 Description
9.3.9.2 Conditions
A Central initiating the connection parameter update procedure shall use the Link Layer
Connection Update procedure defined in [Vol 6] Part B, Section 5.1.1 with the required
connection parameters if either the Central or the Peripheral does not support the
Connection Parameters Request Link Layer Control procedure.
If both the Central and Peripheral support the Connection Parameters Request Link
Layer control procedure, then the Central or Peripheral initiating the connection
parameter update procedure should use the Connection Parameters Request Link
Layer Control procedure defined in [Vol 6] Part B, Section 5.1.7 with the required
connection parameters.
If either the Central or the Peripheral does not support the Connection Parameters
Request Link Layer Control procedure, then the Peripheral initiating the connection
parameter update procedure shall use the L2CAP_CONNECTION_PARAMETER_-
UPDATE_REQ command defined in [Vol 3] Part A, Section 4.20 with the required
connection parameters. The Peripheral shall not send an L2CAP_CONNECTION_-
PARAMETER_UPDATE_REQ command within TGAP(conn_param_timeout) of an
L2CAP_CONNECTION_PARAMETER_UPDATE_RSP being received. When the
Central accepts the Peripheral initiated Connection Parameter Update, the
Central should initiate the Link Layer Connection Update procedure defined in
[Vol 6] Part B, Section 5.1.1 with the required connection parameters within
TGAP(conn_param_timeout).
9.3.10.1 Description
The Terminate Connection procedure allows a Host to terminate the connection with a
peer device.
9.3.10.2 Conditions
The Host should first terminate any associated CIS(es) prior to terminating the ACL.
The Host initiating the terminate connection procedure shall use the Link Layer ACL
Termination procedure defined in [Vol 6] Part B, Section 5.1.6.
9.3.11.1 Description
The connection establishment timing parameters are used during initial connection
establishment between a Central and a Peripheral.
A Central should use one of the GAP connection establishment procedures to initiate a
connection to a Peripheral in a connectable mode. The procedures and modes that may
use these timing parameters are defined in Section 9.3.4 to Section 9.3.8.
9.3.11.2 Conditions
A Peripheral entering any of the following GAP Modes should use the
recommended advertising interval TGAP(adv_fast_interval1) for TGAP(adv_fast_period)
A Peripheral when entering any of the following GAP Modes and sending non-
connectable advertising events should use the recommended advertising interval
TGAP(adv_fast_interval2) for TGAP(adv_fast_period) when advertising on the LE 1M
PHY and should use TGAP(adv_fast_interval2_coded) for TGAP(adv_fast_period) when
advertising on the LE Coded PHY:
• Non-Discoverable Mode
• Non-Connectable Mode
• Limited Discoverable Mode
• General Discoverable Mode
A Peripheral that is background advertising in any GAP Mode other than GAP Directed
Connectable Mode with high duty cycle connectable directed advertising events should
use the recommended advertising interval TGAP (adv_slow_interval) when advertising
on the LE 1M PHY and should use TGAP (adv_slow_interval_coded) when advertising
on the LE Coded PHY.
Note: When advertising interval values of less than 100 ms are used for non-
connectable or scannable undirected advertising in environments where the advertiser
can interfere with other devices, it is recommended that steps be taken to minimize the
interference. For example, the advertising might be alternately enabled for only a few
seconds and disabled for several minutes.
9.3.12.1 Description
The connection interval timing parameters are used within a connection. Initial
connection interval is used to ensure procedures such as bonding, encryption setup and
service discovery are completed quickly. The connection interval should be changed
to the value in the Peripheral Preferred Connection Parameters characteristic after
initiating procedures are complete.
9.3.12.2 Conditions
The Central should either read the Peripheral Preferred Connection Parameters
characteristic (see Section 12.3) or retrieve the parameters from advertising data (see
Section 12.3).
After the Central has no further pending actions to perform and the Peripheral has not
initiated any other actions within TGAP(conn_pause_central), then the Central should
invoke the Connection Parameter Update procedure (see Section 9.3.9) and change the
connection interval to that specified in the Peripheral Preferred Connection Parameters
characteristic.
If the Central has not read the Peripheral Preferred Connection Parameters
characteristic, then the Central may choose the connection parameters to be used.
After the Peripheral has no further pending actions to perform and the Central has
not initiated any other actions within TGAP(conn_pause_central), then the Peripheral
may perform a Connection Parameter Update procedure (see Section 9.3.9). The
Peripheral should not perform a Connection Parameter Update procedure within
TGAP(conn_pause_peripheral) after establishing a connection.
At any time a key refresh or encryption setup procedure is required and the current
connection interval is greater than TGAP(initial_conn_interval) when connected on the
LE 1M PHY or LE 2M PHY or greater than TGAP(initial_conn_interval_coded) when
connected on the LE Coded PHY, the key refresh or encryption setup procedure should
be preceded with a Connection Parameter Update procedure (see Section 9.3.9).
The connection interval should be set to TGAP(initial_conn_interval) when connected
on the LE 1M PHY or the LE 2M PHY and TGAP(initial_conn_interval_coded) when
connected on the LE Coded PHY, connSubrateFactor should be set to 1, and
connPeripheralLatency should be set to zero. This fast connection interval should
be maintained until the key refresh or encryption setup procedure is complete. It
should then switch to the value in the Peripheral Preferred Connection Parameters
characteristic.
9.3.13.1 Description
The Connected Isochronous Stream Central Establishment procedure allows the Host
of a Central to establish a CIS with a Peripheral using the Host selected parameters.
9.3.13.2 Conditions
When two devices are connected, a Central may establish one or more CISes with
a Peripheral. A CIS is established by the Central using the Connected Isochronous
Stream Creation procedure (see [Vol 6] Part B, Section 5.1.15). The Central and or
Peripheral may send isochronous data over the established CIS.
9.3.14.1 Description
9.3.14.2 Conditions
When two devices are connected, the Peripheral may receive a request from the
Central to establish a CIS. Once the request is received, the Host in the Peripheral shall
either accept or reject the request. If it accepts the request, the CIS can be established
using the Connected Isochronous Stream Creation procedure defined in [Vol 6] Part B,
Section 5.1.15.
9.3.15.1 Description
9.3.15.2 Conditions
The Host initiating the Connected Isochronous Stream Terminate procedure shall use
the Connected Isochronous Stream Termination control procedure defined in [Vol 6]
Part B, Section 5.1.16.
9.3.16.1 Description
9.3.16.2 Conditions
The Central initiating this procedure shall use the Link Layer Connection Subrate
Update procedure defined in [Vol 6] Part B, Section 5.1.19 and the Peripheral initiating
this procedure shall use the Connection Subrate Request procedure defined in [Vol 6]
Part B, Section 5.1.20.
If the requested subrate connection parameters are unacceptable to the Central then it
may reject them. If the updated subrate connection parameters are unacceptable to the
Peripheral it cannot reject them but may follow up by using the Connection Parameter
Request procedure (see [Vol 6] Part B, Section 5.1.7) or the Connection Subrate
Request procedure (see [Vol 6] Part B, Section 5.1.20) to change them. Devices should
be tolerant of the connection parameters requested by the peer device.
9.3.17.1 Definition
9.3.17.2 Conditions
A device performing the periodic advertising connection procedure shall initiate the Link
Layer connection procedure using periodic advertising trains with responses (see [Vol 6]
Part B, Section 4.4.2.12.2).
There are two modes for bonding, non-bondable mode and bondable mode. Bonding
may only occur between two devices in bondable mode. The requirements for a device
to support the bonding modes and procedure are defined in Table 9.4.
9.4.1 Requirements
9.4.2.1 Description
A device in the non-bondable mode does not allow a bond to be created with a peer
device.
9.4.2.2 Conditions
If a device does not support pairing as defined in the Security Manager section then it is
considered to be in non-bondable mode.
If Security Manager pairing is supported, the Host shall set the Bonding_Flags to ‘No
Bonding’ as defined in [Vol 3] Part H, Section 3.5.1 and bonding information shall not be
exchanged or stored.
9.4.3.1 Description
A device in the bondable mode allows a bond to be created with a peer device in the
bondable mode.
9.4.3.2 Conditions
The Host shall set the Bonding_Flags to ‘Bonding’ as defined in [Vol 3] Part H,
Section 3.5.1 during the pairing procedure.
9.4.4.1 Description
The bonding procedure may be performed when a non-bonded device tries to access
a service that requires bonding. The bonding procedure may be performed for the
purpose of creating a bond between two devices.
Central Peripheral
established link
9.4.4.2 Conditions
The Central shall be in the bondable mode and shall initiate the pairing process as
defined in Section 2.1. If the Peripheral is in the bondable mode, the devices shall
exchange and store the bonding information in the security database.
The periodic advertising modes and procedure allow two or more devices to
communicate in a connectionless manner using extended advertising events and
periodic advertising events. These modes and procedures can also make use of
existing connections. The requirements for a device operating in a specific GAP role
to support these modes and procedures are defined in Table 9.5.
Table 9.5: Periodic advertising modes and periodic advertising procedure requirements
9.5.1.1 Definition
9.5.1.2 Conditions
9.5.2.1 Definition
On periodic advertising trains without responses, the periodic advertising mode provides
a method for a device to send advertising data at periodic and deterministic intervals.
On periodic advertising trains with responses, a device may send advertising data in
one or more subevents to synchronized devices who may also send data back to the
device.
9.5.2.2 Conditions
A device in the periodic advertising mode shall send periodic advertising events at the
interval and using the frequency hopping sequence specified in the periodic advertising
A device entering periodic advertising mode shall also enter periodic advertising
synchronizability mode for at least long enough to complete one extended advertising
event (see [Vol 6] Part B, Section 4.4.2.12).
9.5.3.1 Definition
9.5.3.2 Conditions
9.5.4.1 Definition
9.5.4.2 Conditions
9.6.1.1 Definition
9.6.1.2 Conditions
A device shall also be in the Broadcast Isochronous Broadcasting mode while it is in the
Broadcast Isochronous Synchronizability mode. A device in the Broadcast Isochronous
Synchronizability mode shall send the BIGInfo in the ACAD field which is located in the
AUX_SYNC_IND PDU of periodic advertisement ([Vol 6] Part B, Section 2.3.4.8).
9.6.2.1 Definition
The Broadcast Isochronous Broadcasting mode provides a method for a device in the
Broadcaster role to send encrypted or unencrypted Broadcast Isochronous PDUs in
subevents of BISes of a BIG ([Vol 6] Part B, Section 4.4.6).
9.6.2.2 Conditions
9.6.3.1 Definition
9.6.3.2 Conditions
9.6.4.1 Definition
9.6.4.2 Conditions
In this procedure, the Broadcaster sends the channel map command in the BIG events
([Vol 6] Part B, Section 4.4.6.4). When an Observer receives a channel map message, it
uses the new channel when receiving data from the BIG.
9.6.5.1 Definition
9.6.5.2 Conditions
The Host initiating the Broadcast Isochronous Stream Terminate procedure shall use
the Broadcast Isochronous Stream Termination control procedure defined in [Vol 6] Part
B, Section 5.6.2.
The Channel Sounding procedures allow two devices to exchange information that may
be used for distance approximation between the two. During this exchange, each device
must select the alternate procedure type.
9.7.1.1 Description
9.7.1.2 Conditions
If the CS initiator role is supported by the Controller, then the Host may enable
the initiator role by commanding the Controller to set the initiator role flag in the
Configuration Exchange procedure as described in [Vol 6] Part B, Section 5.1.25.
If both the Central and Peripheral support the CS procedure, then the Central or
Peripheral initiating the CS procedure shall do so in the manner described in [Vol 6]
Part B, Section 5.1.26.
9.7.2.1 Description
9.7.2.2 Conditions
If the CS reflector role is supported by the Controller, then the Host may enable the
reflector role by commanding the Controller to set the Responder Role flag in the
Configuration Exchange procedure as described in [Vol 6] Part B, Section 5.1.25.
This section defines the modes and procedures that relate to the security of either an
ACL connection or broadcast. The modes and procedures that relate to the security of
a CIS shall be the same as that used in its associated ACL. The following modes and
procedures are defined:
• LE security mode 1
• LE security mode 2
• LE security mode 3
• Authentication procedure
• Authorization procedure
• Connection data signing procedure
• Authenticate signed data procedure
• Encrypted Advertising Data procedure
Requirements for a device to support the LE security modes and procedures is shown
in Table 10.1.
10.1 Requirements
There are three LE security modes, LE security mode 1, LE security mode 2, and LE
security mode 3.
For certain services that require LE security mode 1, levels 2 or 3, a device may enforce
the use of LE Secure Connections pairing before those services can be used.
A connection operating in LE security mode 1 level 2 shall also satisfy the security
requirements for LE security mode 1 level 1.
A connection operating in LE security mode 1 level 3 shall also satisfy the security
requirements for LE security mode 1 level 2 or LE security mode 1 level 1.
A connection operating in LE security mode 1 level 3 shall also satisfy the security
requirements for LE security mode 2.
A connection operating in LE security mode 1 level 4 shall also satisfy the security
requirements for LE security mode 1 level 3 or LE security mode 1 level 2 or LE security
mode 1 level 1.
A connection operating in LE security mode 1 level 4 shall also satisfy the security
requirements for LE security mode 2.
LE security mode 2 shall only be used for connection based data signing.
Data signing as defined in Section 10.4 shall not be used when a connection is
operating in LE security mode 1 level 2, LE security mode 1 level 3, or LE security
mode 1 level 4.
If there are requirements for both LE security mode 1 and LE security mode 2 level 2 for
a given physical link then LE security mode 1 level 3 shall be used.
If there are requirements for both LE security mode 1 level 3 and LE security mode 2 for
a given physical link then LE security mode 1 level 3 shall be used.
If there are requirements for both LE security mode 1 level 2 and LE security mode 2
level 1 for a given physical link then LE security mode 1 level 2 shall be used.
If there are requirements for both LE security mode 1 level 4 and any other security
mode or level for a given physical link then LE security mode 1 level 4 shall be used.
The device shall only accept new outgoing and incoming service level connections for
services that require Security Mode 1, Level 4 when the remote device supports LE
Secure Connections and authenticated pairing is used.
A device operating in security mode 3 level 1 shall require that the isochronous data is
unencrypted.
The authentication procedure describes how the required security is established when
a device initiates a service request to a remote device and when a device receives a
service request from a remote device. The authentication procedure covers LE security
mode 1. The authentication procedure shall only be initiated after a connection has
been established.
LE security mode 2 pertains to the use of data signing and is covered in Section 10.4.
Note: In this section, the terms “authenticated pairing” and “unauthenticated pairing”
refer to the security method used to perform pairing and are not related to the
authentication of previously bonded devices during a reconnection.
In this section the local device is the device responding to a service request made by
a remote device. In the L2CAP protocol the local device responds with a connection
response to a remote device making a connection request. In GATT, the local device is
the GATT Server and the remote device is the GATT Client.
When a local device receives a service request from a remote device, it shall respond
with an error code if the service request is denied. The error code is dependent on
whether the current connection is encrypted or not and on the type of pairing that was
performed to create the LTK or STK to be used.
When a local device receives a service request from a remote device it shall behave
according to the following rules:
• The local device’s security database specifies the security settings required to accept
a service request. If no encryption and no data signing are required, the service
request shall be accepted. If encryption is required the local device shall send an
error code as defined in Table 10.2. If no encryption is required, but data signing is
required, then the local device behavior is as defined in Section 10.4.
• If neither an LTK nor an STK is available, the service request shall be rejected with
the error code “Insufficient Authentication”.
Note: When the link is not encrypted, the error code “Insufficient Authentication” does
not indicate that MITM protection is required.
• If an LTK or an STK is available and encryption is required (LE security mode 1) but
encryption is not enabled, the service request shall be rejected with the error code
“Insufficient Encryption”. If the encryption is enabled with a key size that is too short
then the service request shall be rejected with the error code “Encryption Key Size
Too Short.”
• If an authenticated pairing is required but only an unauthenticated pairing has
occurred and the link is currently encrypted, the service request shall be rejected
with the error code “Insufficient Authentication.”
Note: When unauthenticated pairing has occurred and the link is currently encrypted,
the error code “Insufficient Authentication” indicates that MITM protection is required.
• If LE Secure Connections pairing is required but LE legacy pairing has occurred and
the link is currently encrypted, the service request shall be rejected with the error
code “Insufficient Authentication”.
The local device will respond with the minimum security level required for access to its
services. If the local device has no security requirement it should default to the minimum
security level that the local device is capable of as defined in pairing phase 1, (see [Vol
3] Part H, Section 2.1).
A local device shall not require an authenticated pairing (MITM) if the local device does
not support the required IO capabilities or OOB data1.
The local device responds to a service request from a remote device are summarized in
Table 10.2.
1If
an OOB mechanism is used, the level of MITM protection is dependent upon the properties of the OOB
communications channel. See [Vol 3] Part H, Section 2.3.5.1 for more information
Receive a Service
Request
Query security DB
Yes
No
Current security
No
Good Enough?
Pairing
Yes
Yes
Remote
No supports
encryption?
Yes
Encryption
Cross-transport
Key derivation No
possible?
Yes
Perform Service
Abort BR/EDR Request on
Link Key generation Local Device
Figure 10.1: Flow chart for a local device handling a service request from a remote device
After encryption is enabled, the correct security level has been achieved, and both
devices support cross-transport key generation, the both devices may perform BR/EDR
link key derivation.
Note: If the LTK has an encryption key size that is shorter than 16 octets (128 bits), the
BR/EDR link key is derived before the LTK gets masked.
In this section the local device is the device initiating a service request to a remote
device. In the L2CAP protocol the local device sends the connection request and the
remote device sends the connection response. In GATT, the local device is the GATT
Client and the remote device is the GATT Server.
When a local device initiates a service request to a remote device it shall behave
according to the following rules:
• The local device’s security database specifies the security required to initiate a
service request. If no encryption is required by the local device then the service
request may proceed without encryption or pairing.
• If an LTK is not available but encryption is required, the pairing procedure shall
be initiated with the local device’s required authentication settings. If the pairing
procedure fails then the service request shall be aborted.
Note: When encryption is not enabled, the error code “Insufficient Authentication”
does not indicate to the local device that MITM protection is required.
Note: If the local device is a Peripheral then it may send a Peripheral Initiated
Security Request as defined in [Vol 3] Part H, Section 2.4.6.
• If pairing has occurred but the encryption key size is insufficient the pairing procedure
shall be executed with the required encryption key size. If the pairing procedure fails
then the service request shall be aborted.
• If an LTK is available and encryption is required (LE security mode 1) then encryption
shall be enabled before the service request proceeds as defined in Section 10.6.
Once encryption is enabled the service request shall proceed. If encryption fails,
then either the bond no longer exists on the remote device or the wrong device has
been connected. If the local device does not abandon the service request, it shall
trigger a user interaction to confirm the remote device and then re-bond, perform
service discovery, and reconfigure the remote device (reconfiguring the remote device
can involve actions such as re-enabling indications and notifications on the relevant
characteristics). If the local device had previously determined that the remote device
did not have the «Service Changed» characteristic, or if the local device determines
by reading the «Database Hash» characteristic that the database has not changed,
then service discovery may be skipped.
• If an authenticated pairing is required but only an unauthenticated pairing has
occurred and the link is currently encrypted, the pairing procedure shall be executed
with the required authentication settings. If the pairing procedure fails or an
authenticated pairing cannot be performed with the IO capabilities of the local device
and remote device, then the service request shall be aborted.
When a bond has been created between two devices, any reconnection should result
in the local device enabling or requesting encryption with the remote device before
initiating any service request.
If a local device does not enable encryption before initiating a service request and
relies on the error codes to determine the security requirements, the local device
shall not request pairing with MITM protection in response to receiving an “Insufficient
Authentication” error code from the remote device while the link is unencrypted. The
local device shall only set the MITM protection required flag if the local device itself
requires MITM protection.
• If encryption is not enabled at the time of the service request, the error code
“Insufficient Authentication” is received, and the local device currently has an LTK,
then the encryption procedure should be started (see Section 10.6). If this fails (likely
indicating that the remote device has lost the bond and no longer has the LTK) or
the local device does not have the correct LTK, then it should re-pair. If it re-pairs, it
shall trigger a user interaction to confirm the remote device before starting the pairing
procedure. IO capabilities are exchanged in pairing phase 1, (see [Vol 3] Part H,
Section 2.1) and the security level shall be determined by the devices’ IO capabilities
and MITM requirements.
• If encryption is not enabled at the time of the service request, the error code
“Insufficient Encryption” is received, and the local device currently has an LTK, then
the encryption procedure shall be started (see Section 10.6). If starting encryption
fails (likely indicating that the remote device has lost the bond and no longer has the
LTK) or the local device does not have the correct LTK, then it should re-pair. If it
re-pairs, it shall trigger a user interaction to confirm the remote device before starting
the pairing procedure.
• If LE Secure Connections authenticated pairing is required but the remote device
does not support LE Secure Connections, then the service request shall be aborted.
Initiate a service
request to a
remote device
Local device
queries security
DB
Access
No to service
allowed?
Yes
Yes
Bond Exists
Yes
Locally?
No
No Current security
Good Enough?
Pairing
Yes
Success and
No correct Security Encryption
level?
Yes
Cross-transport
Key derivation No
possible?
Yes
Figure 10.2: Flow chart for a local device issuing a service request to a remote device
After encryption is enabled, the correct security level has been achieved, and both
devices support cross-transport key generation, the both devices may perform BR/EDR
link key derivation.
Note: If the LTK has an encryption key size that is shorter than 16 octets (128 bits), the
BR/EDR link key is derived before the LTK gets masked.
The data signing is used for transferring authenticated data between two devices in an
unencrypted connection. The data signing method is used by services that require fast
connection set up and fast data transfer.
If a service request specifies LE security mode 2, the connection data signing procedure
shall be used.
A device shall generate a new Connection Signature Resolving Key CSRK for each set
of peer device(s) to which it sends signed data in connections. CSRK is defined in [Vol
3] Part H, Section 2.4.2.2.
The data shall be formatted using the Signing Algorithm as defined in [Vol 3] Part
H, Section 2.4.5 where m is the Data PDU to be signed, k is the CSRK and the
SignCounter is the counter value. A Signature is composed of the counter value and the
Message Authentication Code (MAC) generated by the Signing Algorithm. The counter
value shall be incremented by one for each new Data PDU sent.
LSB MSB
Variable 12 octets
SignCounter MAC
LSB MSB
4 octets 8 octets
If encryption is not required and CSRK is available (LE security mode 2) then the
data signing procedure shall be used when making a service request involving a write
operation.
Note: The existence of the bond on the server can be determined by successfully
enabling encryption with the server using the encryption procedure defined in Section
10.6. A higher layer profile may allow a client to not perform the authentication
procedure. Alternatively, a higher layer protocol may signal the client that the signature
check has failed due to a lost bond, and the client may then take action to notify the
user or attempt to pair again to reestablish the bond.
A device receiving signed data shall authenticate it by performing the Signing Algorithm.
The signed data shall be authenticated by performing the Signing Algorithm where m
is the Data PDU to be authenticated, k is the stored CSRK and the SignCounter is the
received counter value. If the MAC computed by the Signing Algorithm does not match
the received MAC, the verification fails and the Host shall ignore the received Data
PDU.
Since the server does not respond to a Signed Write command, the higher layer
application is not necessarily notified of the ignored request. Hence, it is recommended
that the server disconnect the link in case the client is a malicious device attempting to
mount a security attack.
If the server has no stored CSRK upon receiving a signed write command, it shall
ignore the received Data PDU. Since the server does not respond to a Signed
Write command, the higher layer application is not necessarily notified of the ignored
request. Although the disconnection may be an adequate indication to the user that
the devices need to be paired, it is recommended that implementers consider providing
an explanatory indication to the user that the devices need to be paired to establish a
CSRK.
If the server receives a request from a client for a write operation that requires
a response (i.e. other than a Signed Write command or Write command), and
encryption is not enabled, then the server shall respond with the error code “Insufficient
Authentication”.
If the link is encrypted and the server receives a request from a client for which the
server requires data signing but does not require encryption, then the server shall
complete the request if it is otherwise valid as the encrypted state of the link is
considered to satisfy the signing requirement.
As required by Section 10.2.2, for a given link, signed data is not used at the same time
as encryption. Therefore, if the client wishes to test that the server is still bonded, and
thus enables encryption, further data transfer must occur without signing, assuming the
server does not disconnect the link as recommended above.
If a higher layer determines the bond no longer exists on the server, the client shall
trigger a user interaction to confirm the remote device and then re-bond, perform
service discovery, and reconfigure the server. If the client had previously determined
that the server did not have the «Service Changed» characteristic, or the client
determines by reading the «Database Hash» characteristic that the database has not
changed, then service discovery may be skipped.
The receiving device shall protect against a replay attack by comparing the received
SignCounter with previously received SignCounter from the same peer device. If the
SignCounter was previously used then the receiving device shall ignore the Data PDU.
A Peripheral may encrypt a connection using the Peripheral Initiated Security Request
as defined in [Vol 3] Part H, Section 2.4.6 to provide integrity and confidentiality.
If the encryption procedure fails and either the Central or Peripheral used a Resolvable
Private Address for the connection establishment, then the current Resolvable Private
Address(es) shall be immediately discarded and new Resolvable Private Address(es)
shall be generated.
The privacy feature provides a level of privacy which makes it more difficult for an
attacker to track a device over a period of time. The requirements for a device to
support the privacy feature are defined in Table 10.3.
• Device Privacy Mode: When a device is in device privacy mode, it is only concerned
about its own privacy. It should accept advertising packets from peer devices that
contain their Identity Addresses as well as their private address, even if the peer
device has distributed its IRK.
• Network Privacy Mode. When a device is in network privacy mode, it shall not
accept advertising packets containing the Identity Address of peer devices that have
distributed their IRK.
Note: If the Resolvable Private Address Only characteristic is not present in the GAP
service of the remote device then it may use its Identity Address over the air.
If a device, i.e. Host and Controller, claims support for the privacy feature, the
requirements in this section shall be met.
A device may support either just Host-based privacy or both Host-based and Controller-
based privacy. When a device supports Controller-based privacy, the Host configures
the Controller to perform some of the privacy functionality.
• The Host may maintain a resolving list by adding and removing device identities. A
device identity consists of the peer’s Identity Address and a local and peer’s IRK pair.
The local or peer’s IRK shall be an all-zero key if not applicable for the particular
device identity.
• If a peer device provides an all-zero Identity Address during pairing, the Host shall
choose a unique identifier to substitute the peer’s device Identity Address. The Host
shall ensure that all identities provided to the Controller are unique.
• When address resolution is enabled in the Controller, all references to peer devices
that are included in the resolving list from Host to the Controller shall be done using
the peer’s device Identity Address. Likewise, all incoming events from the Controller
to the Host will use the peer’s device identity, if the peer’s device address has been
resolved.
• If the Host wants to be in device privacy mode, it shall so instruct the Controller for
each peer in the resolving list.
The device should not send the device name or unique data in the advertising data that
can be used to recognize the device.
The Host shall enable resolvable private address generation by enabling it in the
Controller and populating the resolving list.
By default, network privacy mode is used when private addresses are resolved and
generated by the Controller.
If the advertising data or the scan response data change regularly then those changes
should be synchronized with any changes in private addresses (both local and remote).
For this purpose, the Host should either instruct the Controller to synchronize address
changes with those data changes or, if the Controller does not support that feature,
generate private addresses as described in Section 10.7.1.2 instead of offloading
private address generation to the Controller.
The Host shall generate a resolvable private address using the ‘resolvable private
address generation procedure’ as defined in Section 10.8.2.2 or non-resolvable private
address procedure as defined in Section 10.8.2.1. The Host shall set a timer equal to
TGAP(private_addr_int). The Host shall generate a new resolvable private address or
non-resolvable private address when the timer TGAP(private_addr_int) expires.
The privacy-enabled Central shall use a resolvable private address as the initiator's
device address.
If, a privacy-enabled Central, that has a stored bond, receives a resolvable private
address, the Host may resolve the resolvable private address by performing the
"resolvable private address resolution procedure" as defined in Section 10.8.2.3.
A privacy-enabled Central with Address Resolution enabled in the Controller can use
any of the connection establishment procedures defined in Section 9.3.
By default, network privacy mode is used when private addresses are resolved and
generated by the Controller.
The Host shall generate a resolvable private address using the ‘resolvable private
address generation procedure’ as defined in Section 10.8.2.2 or non-resolvable private
address procedure as defined in Section 10.8.2.1. The Host shall set a timer equal to
TGAP(private_addr_int). The Host shall generate a new resolvable private address or
non-resolvable private address when the timer TGAP(private_addr_int) expires.
A privacy-enabled Broadcaster shall use the Broadcast mode defined in Section 9.1.1.
The Broadcaster shall use either a resolvable private address or non-resolvable private
address.
If Address Resolution is not supported or disabled in the Controller, the following applies
to the Host: The Host shall generate a resolvable private address using the ‘resolvable
private address generation procedure’ as defined in Section 10.8.2.2 or non-resolvable
private address procedure as defined in Section 10.8.2.1. The Host shall set a timer
to TGAP(private_addr_int). The Host shall generate a new resolvable private address or
non-resolvable private address when the timer TGAP(private_addr_int) expires.
The device should not send the device name or unique data in the advertising data
which can be used to recognize the device.
If Address Resolution is not supported or disabled in the Controller, the following applies
to the Host: The Host shall generate a resolvable private address using the ‘resolvable
private address generation procedure’ as defined in Section 10.8.2.2 or non-resolvable
private address procedure as defined in Section 10.8.2.1. The Host shall set a timer
equal to TGAP(private_addr_int). The Host shall generate a new resolvable private
address or non-resolvable private address when the timer TGAP(private_addr_int)
expires. The value of TGAP(private_addr_int) shall not be greater than 1 hour.
For the purposes of this profile, the random device address may be of either of the
following two sub-types:
• Static address
• Private address
The term random device address refers to both static and private address types.
The transmission of a random device address is optional. A device shall accept the
reception of a random device address from a remote device.
After a device has distributed its IRK, it should use resolvable private addresses when
establishing a connection with a peer device to which the IRK has been distributed.
The Host can generate a static address using the procedure described in [Vol 6] Part B,
Section 1.3.2.1.
The Host can generate a non resolvable private address using the procedure described
in [Vol 6] Part B, Section 1.3.2.2.
The Host can generate a resolvable private address where the Host has its IRK using
the procedure described in [Vol 6] Part B, Section 1.3.2.2.
The Host can resolve a resolvable private address where the Host has the peer
device’s IRK or the local device's IRK, using the procedure described in [Vol 6] Part
B, Section 1.3.2.3.
When a user initiates a service that includes broadcasting an encrypted BIG, the Host
shall provide the Broadcast_Code associated with the encrypted BIG to the Controller.
When a user initiates a service that requires the reception of an encrypted BIS, the
device needs to know the Broadcast_Code for that encrypted BIS. If the device does
not have the Broadcast_Code or cannot obtain the Broadcast_Code and has a user
interface, then it shall indicate an appropriate error (e.g., Code Unavailable) to the user.
The key material is exposed using the Encrypted Data Key Material characteristic on
the Broadcaster.
The scanning device shall read the Encrypted Data Key Material characteristic on an
advertising device to obtain the key material for a device if it wants to interpret the
encrypted advertising data being sent.
Channel Sounding provides the following levels of channel measurement security for
the application layer:
A device that operates in security level 1 shall use CS tone or CS RTT within a CS
procedure.
A device that operates in security level 2 shall use 150 ns or better CS RTT accuracy
and CS tones within a CS procedure.
A device that operates in security level 3 shall use 10 ns or better CS RTT accuracy and
CS tones within a CS procedure.
A device that operates in security level 4 shall meet the requirements of security level
3 and shall also require that the CS procedure uses either CS RTT with sounding
sequence or CS RTT with random sequence, and that the device shall also support
the Normalized Attack Detector Metric requirements as described in [Vol 6] Part H,
Section 3.5.1.
The format of Advertising, Periodic Advertising, and Scan Response data is shown
in Figure 11.1. The data consists of a significant part and a non-significant part. The
significant part contains a sequence of AD structures. Each AD structure shall have a
Length field of one octet, which contains the Length value and shall not be zero, and
a Data field of Length octets. The first octet of the Data field shall contain the AD type
field. The content of the remaining Length - 1 octets in the Data field depends on the
value of the AD type field and is called the AD data. The non-significant part shall only
be present when necessary to fill a fixed-length field and shall contain all-zero octets.
Data
----------
AD Structure 1 AD Structure 2 AD Structure 'N Ob000 ...000
I
- ----------
I
Length octets ---
i Length
1 -·
I
I
Data
I
I 1 octet
I Length - 1 octets
Only the significant part of the data should be sent over the air.
The data is sent in advertising or periodic advertising events. Host Advertising data
is placed in the AdvData field of ADV_IND, ADV_NONCONN_IND, ADV_SCAN_IND,
AUX_ADV_IND, and AUX_CHAIN_IND PDUs. Additional Controller Advertising Data is
placed in the ACAD field of AUX_ADV_IND, AUX_SYNC_IND, and AUX_SCAN_RSP
PDUs. Periodic Advertising data is placed in the AdvData field of AUX_SYNC_IND,
AUX_SYNC_SUBEVENT_IND, AUX_SYNC_SUBEVENT_RSP, and AUX_CHAIN_IND
PDUs. Scan Response data is sent in the ScanRspData field of SCAN_RSP PDUs
or the AdvData field of AUX_SCAN_RSP PDUs. If the complete data cannot fit in
the AdvData field of an AUX_ADV_IND, AUX_SYNC_IND, or AUX_SCAN_RSP PDU,
AUX_CHAIN_IND PDUs are used to send the remaining fragments of the data. In this
case, an AD Structure may be fragmented over two or more PDUs.
The AD type data formats and meanings are defined in Section 1 of [4]. The AD type
identifier values are defined in Assigned Numbers.
The GATT Server shall contain the GAP service as defined in the GAP Service
Requirements in Table 12.1. A device shall have only one instance of the GAP service
in the GATT Server. The GAP service shall be a GATT based primary service with the
service UUID as «GAP Service» defined in Assigned Numbers.
The characteristics requirements for the GAP service in each of the GAP roles are
shown in Table 12.2.
A device that supports multiple GAP roles contains all the characteristics to meet
the requirements for the supported roles. The device shall continue to expose the
characteristics when the device is operating in the role in which the characteristics are
not valid.
The Device Name characteristic shall contain the name of the device as an UTF-8
string as defined in Section 3.2.2. When the device is discoverable, the Device Name
characteristic value shall be readable without authentication or authorization. When the
device is not discoverable, the Device Name Characteristic should not be readable
without authentication or authorization. The Device Name characteristic value may be
writable. If writable, authentication and authorization may be defined by a higher layer
specification or be implementation specific.
A device shall have only one instance of the Device Name characteristic.
Name Size
(Octet)
Interval_Min 2
Interval_Max 2
Latency 2
Timeout 2
Each field shall have the same meaning and requirements as the field of the
LL_CONNECTION_PARAM_REQ PDU (see [Vol 6] Part B, Section 2.4.2.16) with the
same name, or shall contain the value 0xFFFF which indicates that no specific value is
requested.
The Peripheral should check if the peer device supports address resolution by reading
the Central Address Resolution characteristic before using directed advertisement
where the target address is set to a Resolvable Private Address (RPA).
The Central Address Resolution characteristic defines whether the device supports
privacy with address resolution. See Table 12.7.
A device shall have only one instance of the Central Address Resolution characteristic.
If the Central Address Resolution characteristic is not present, then it shall be assumed
that Central Address Resolution is not supported.
The device should check if the peer will only use Resolvable Private Addresses (RPAs)
after bonding by reading the Resolvable Private Address Only characteristic, in order to
determine if it will satisfy its privacy mode as defined in Section 10.7.
The Resolvable Private Address Only characteristic defines whether the device will only
use Resolvable Private Addresses (RPAs) as local addresses. See Table 12.8.
The Resolvable Private Address Only characteristic value shall be 1 octet in length:
A device shall have only one instance of the Resolvable Private Address Only
characteristic. If the Resolvable Private Address Only characteristic is not present, then
it cannot be assumed that only Resolvable Private Addresses will be used over the air.
The Encrypted Data Key Material characteristic may support indications. If the
characteristic supports indications, the client has configured the characteristic for
indications, and the characteristic value changes after being authenticated and
authorized, then the characteristic shall be indicated by the server to the client.
The Encrypted Data Key Material characteristic can be used by other services to allow
those services to expose separate key material for encrypted advertising data used by
those services.
The Key Material is composed of a 128-bit value that is used as the session key and a
64-bit value that is used as the IV for encrypting and authenticating the Encrypted Data
as defined in Section 1.23.3 of [4], as shown in Table 12.10. The server should update
the Key Material periodically.
The LE GATT Security Levels characteristic shall contain the highest security
requirements of the GATT server when operating on a LE connection. The value of
the LE GATT Security Levels characteristic shall be static during a connection.
The format of the LE GATT Security Levels characteristic is given in Table 12.11.
The Attribute Value is a sequence of Security Level Requirements, each with the type
uint8[2]. Each Security Level Requirement consists of a Security Mode field followed by
a Security Level field. The Security Mode and Security Level shall be expressed as the
same number as used in their definitions; e.g., mode 1 is represented as 0x01 and level
4 is represented as 0x04.
Meeting any one of the security requirements provided for a given mode shall be
sufficient for the GATT server to allow the GATT client to use all the GATT procedures
permitted by the characteristic properties for all characteristics on the server operating
in that mode. If any one of the security requirements specified in the LE GATT Security
Levels characteristic is met, no GATT procedure will fail for a security-related reason
(such as insufficient authentication). For example, the attribute value 0x01 0x04 for the
LE GATT Security Levels characteristic means that the GATT server requires level 4
when operating in security mode 1 on a LE connection.
Note: The Security Level value is not a minimum; specifying (say) level 2 for a mode
does not mean that level 3, level 4, or even level 87 would suffice instead. However,
in many cases a given security level satisfies the security requirements of other levels
as well. For example, LE security mode 1 levels 3 and 4, by definition, both satisfy the
requirements for mode 1 level 2 and so could be used with a GATT server that requires
mode 1 level 2.
The security modes and levels for LE are defined in Section 10.
A device shall have at most one instance of a LE GATT Security Levels characteristic.
13 BR/EDR/LE OPERATION
All modes, procedures and security aspects shall follow the requirements as specified
for the physical transport over which they operate. Sections 4, 5, 6 and 7 specify the
requirements for the modes, procedures and security aspects for operations performed
over the BR/EDR physical transport. Sections 9 and 9.6 specify the requirements for the
modes, procedures and security aspects performed over the LE physical transport. It is
optional to support both physical transports simultaneously to the same remote device.
A device shall expose the capabilities of both physical transports for both Limited and
General Discoverable Mode using the advertisement Flag AD Type as follows:
a. The ‘BR/EDR Not Supported’ bit in the Flags AD type shall be set to 0 as defined in
Section 1.3 of [4].
b. The 'Simultaneous LE and BR/EDR to Same Device Capable (Controller)' bit in the
Flags AD type shall be set to 0.
The ‘LE Supported (Controller)’ and ‘LE Supported (Host)’ bits in the LMP features shall
be set as defined in [Vol 2] Part C, Section 3.2.
If the remote device supports the BR/EDR physical transport, the bonding procedures
for the BR/EDR physical transport as defined in Section 6.5 shall be used.
If the remote device supports the LE physical transport, the bonding procedures for the
LE physical transport as defined in Section 9.4.4 shall be used.
If the remote device supports the BR/EDR physical transport the security procedures for
the BR/EDR physical transport as defined in Section 5 shall be used.
If the remote device supports the LE physical transport the security procedures for the
LE physical transport as defined in Section 9.6 shall be used.
If both the local and remote devices support Secure Connections over the LE transport
but not over the BR/EDR transport, then the devices may optionally generate the
BR/EDR keys of identical strength and the same MITM protection as the LE keys as
part of the LE pairing procedure (see [Vol 3] Part H, Section 2.3.5.7).
If an LE LTK already exists and the BR/EDR link key is weaker in either strength or
MITM protection, then neither device shall generate an LE LTK using cross-transport
key derivation from a BR/EDR link key. If either device receives a request to generate
an LE LTK using cross-transport key derivation, it shall respond with a Pairing Failed
message with reason "Cross-transport Key Derivation/Generation not allowed".
If the BR/EDR link key has been generated by a Controller that does not perform
remote public key validation (see [Vol 2] Part H, Section 7.6), then the local device shall
not generate an LE LTK using cross-transport key derivation from a BR/EDR link key.
If the local device receives a request to generate an LE LTK using cross-transport key
derivation, it shall respond with a Pairing Failed message with reason "Cross-transport
Key Derivation/Generation not allowed".
If a BR/EDR link key already exists and the LE LTK is weaker in either strength or
MITM protection, then the local device shall not generate a BR/EDR link key using
cross-transport key derivation from the LE LTK. If both devices request cross-transport
key derivation during pairing, then the local device shall either silently skip deriving the
BR/EDR link key or stop the pairing procedure by sending a Pairing Failed message
with reason "Cross-transport Key Derivation/Generation not allowed".
Note: The Host can use the Remote Public Key Validation feature bit (see [Vol
6] Part B, Section 4.6) or vendor-specific methods to determine whether the
HCI_LE_Generate_DHKey command performs the remote public key validation.
A Bluetooth public address used as the BD_ADDR for the BR/EDR physical channel is
defined in [Vol 2] Part B, Section 1.2. A Bluetooth public address used as the BD_ADDR
for the LE physical channel is defined in [Vol 6] Part B, Section 1.3.
A random device address used as the BD_ADDR on the LE physical channel is defined
in Section 10.8.
BR/EDR LE LE LE LE
GAP Role Broadcaster Observer Peripheral Central
GATT Client O E E O O
GATT Server C.1 E E M M
C.1: Mandatory if the GATT Profile is supported on the BR/EDR physical transport; otherwise
excluded
Table 15.3: SDP record for the Generic Access Profile, if only one of ATT or EATT is supported
Table 15.4: SDP record for the Generic Access Profile, if both ATT and EATT are supported
16 DEFINITIONS
Idle: As seen from a remote device, a Bluetooth device is idle, or is in idle mode, when
there is no link established between them.
Bond: A relation between two Bluetooth devices defined by creating, exchanging and
storing a common link key. The bond is created through the bonding or LMP-pairing
procedures.
Piconet: A set of Bluetooth devices sharing the same physical channel defined by the
Central's parameters (clock and BD_ADDR).
PAGE: A Baseband state where a device transmits page trains, and processes any
eventual responses to the page trains.
1The term ’connection’ used here is not identical to the definition below. It is used in the absence of a more
concise term.
Page: The transmission by a device of page trains containing the Device Access Code
of the device to which the physical link is requested.
Page scan: The listening by a device for page trains containing its own Device Access
Code.
Channel: A logical connection on L2CAP level between two devices serving a single
application or higher layer protocol.
Silent device: A Bluetooth device appears as silent to a remote device if it does not
respond to inquiries made by the remote device. A device may be silent due to being
non-discoverable or due to baseband congestion while being discoverable.
Paired device: A Bluetooth device with which a link key has been exchanged (either
before connection establishment was requested or during connecting phase).
Pre-paired device: A Bluetooth device with which a link key was exchanged, and the
link key is stored, before link establishment.
Un-paired device: A Bluetooth device for which there was no exchanged link key
available before connection establishment was requested.
Known device: A Bluetooth device for which at least the BD_ADDR is stored.
Un-known device: Bluetooth device for which no information (BD_ADDR, link key or
other) is stored.
Authenticated device: A Bluetooth device whose identity has been verified during the
lifetime of the current link, based on the authentication procedure.
Device discovery: A procedure for retrieving the Bluetooth Device Address, clock, and
Class of Device from discoverable devices.
Name discovery: A procedure for retrieving the user-friendly name (the Bluetooth
Device Name) of a connectable device.
Service discovery: Procedures for querying and browsing for services offered by or
through another Bluetooth device.
Authorize: The act of granting a specific Bluetooth device access to a specific service.
It may be based upon user confirmation, or given the existence of a trusted relationship.
Trusting: The marking of a paired device as trusted. Trust marking can be done by the
user, or automatically by the device (e.g. when in bondable mode) after a successful
pairing.
17 REFERENCES
[1] RFCOMM
[2] Telephony Control Specification
[3] Assigned Numbers Specification: https://www.bluetooth.com/specifications/
assigned-numbers
[4] Core Specification Supplement, Part A, Data Types Specification
[5] Core Specification Supplement, Part C, Services Permitted to use Security Mode
4 Level 0
Verifier
(initiator) Claimant
init_authentication
secret key (link key or Kinit) secret key (link key or Kinit)
Generate
random
number
LMP_AU_RAND
Calculate Calculate
challenge response
(random
number)
LMP_SRES
Compare
Verifier
(initiator) Claimant
init_pairing
Generate
random
number
LMP_IN_RAND
LMP_ACCEPTED
PIN PIN
Calculate Calculate
Kinit Kinit
LMP authentication
The create link key procedure is described in [Vol 2] Part C, Section 4.2.2.4 and [Vol
2] Part H, Section 3.2. A mutual authentication takes place irrespective of the current
security mode.
services and capabilities using the Service Discovery Protocol are described in higher
layer specifications. This is just an example.
A B
Link establishment
Channel establishment
Channel release
LMP_DETACH
TEST SUPPORT
CONTENTS
1 TEST METHODOLOGY
This section describes the test modes for hardware and low-level functionality tests of
Bluetooth devices.
The BR/EDR Test mode supports testing of the Bluetooth transmitter and receiver
including transmitter tests (packets with constant bit patterns) and loopback tests. It
is intended mainly for testing of the radio and Baseband and may also be used for
in-production and after-sales testing.
A device in BR/EDR Test mode shall not support normal operation. For security reasons
the BR/EDR Test mode is designed such that it offers no benefit to the user. Therefore,
no data output or acceptance on a HW or SW interface shall be allowed.
The setup consists of an implementation under test (IUT) and a tester. Optionally,
additional measurement equipment may be used.
Tester and IUT form a piconet where the tester acts as Central and has full control over
the test procedure. The IUT acts as Peripheral.
The control is done via the air interface using LMP commands (see [Vol 2] Part
C, Section 4.7.3). Hardware interfaces to the IUT may exist, but are not subject to
standardization.
The test mode is a special state of the Bluetooth model. For security and type approval
reasons, a Bluetooth device in test mode shall not support normal operation. When
the IUT leaves the test mode it enters the standby state. After power-off the Bluetooth
device shall return to the standby state.
The Bluetooth device transmits a constant bit pattern. This pattern is transmitted
periodically with packets aligned to the Peripheral TX timing of the piconet formed by
tester and IUT. The same test packet is repeated for each transmission.
The transmitter test is started when the Central sends the first POLL packet. In non-
hopping mode the agreed frequency is used for this POLL packet.
The burst length may exceed the length of a one slot packet. In this case the tester may
take the next free Central TX slot for polling. The timing is illustrated in Figure 1.2.
time
Central TX Peripheral TX Central TX Peripheral TX Central TX Peripheral TX
The test packet is a normal Bluetooth packet, see Figure 1.3. For the payload itself see
below.
Packet
Access Code Payload
Header
Payload
AUX1 Packet Test Payload
Header
Guard &Sync
eSCO Packet Test Payload CRC
(EDR only)
For the payload length, the restrictions from the Baseband specification shall apply
(see [Vol 2] Part B, Section 6.5). In case of ACL, SCO and eSCO packets the payload
structure defined in the Baseband specification is preserved as well, see Figure 1.3.
For the transmitter test mode, only packets without FEC should be used; i.e. HV3, EV3,
EV5, DH1, DH3, DH5, 2-EV3, 2-EV5, 3-EV3, 3-EV5, 2-DH1, 2-DH3, 2-DH5, 3-DH1,
3-DH3, 3-DH5 and AUX1 packets.
In transmitter test mode, the packets exchanged between the tester and the IUT shall
not be scrambled with the whitening sequence. Whitening shall be turned off when the
IUT has accepted to enter the transmitter test mode, and shall be turned on when the
IUT has accepted to exit the transmitter test mode, see Figure 1.4. Implementations
shall ensure that retransmissions of the LMP_ACCEPTED messages use the same
whitening status as used in the original LMP_ACCEPTED.
TESTER IUT
LMP_TEST_CONTROL
(Enter Transmitter Test mode)
Whitening on
LMP_ACCEPTED
LMP_TEST_CONTROL
(Exit Transmitter Test mode) Whitening off
LMP_ACCEPTED
Whitening on
The same pseudorandom sequence of bits shall be used for each transmission (i.e. the
packet is repeated). A PRBS9 sequence is used, see [1] and [2].
The properties of this sequence are as follows (see [2]). The sequence may be
generated in a nine-stage shift register whose 5th and 9th stage outputs are XORed
(see Figure 1.5), and the result is fed back to the input of the first stage. The sequence
begins with the first ONE of 9 consecutive ONEs; i.e. the shift register is initialized with
nine ones.
Figure 1.5: Linear feedback shift register for generation of the PRBS sequence
1. Bit pattern:
• Constant zero
• Constant one
• Alternating 1010...1
• Alternating 1111 0000 1111 0000...1
• Pseudorandom bit pattern
• Transmission off
2. Frequency selection:
• Single frequency
• Normal hopping
3. TX frequency
• (2402 + k) MHz for channel k
4. Default poll period in TDD frames (n × 1.25 ms)
5. Packet Type
6. Length of test payload
When the legacy power control mechanism is tested the IUT shall start transmitting
at the maximum power and shall reduce/increase its power by one step on every
LMP_INCR_POWER_REQ or LMP_DECR_POWER_REQ PDU received. When the
enhanced power control mechanism is tested the IUT shall start transmitting at the
maximum power and shall reduce/increase its power by one step or go to the maximum
power level when a LMP_POWER_CONTROL_REQ PDU is received.
A change in the frequency selection becomes effective when the LMP procedure is
completed:
When the tester receives the LMP_ACCEPTED it shall then transmit POLL packets
containing the ACK for at least 8 slots (4 transmissions). When these transmissions
1It is recommended that the sequence starts with a one; but, as this is irrelevant for measurements, it is also
have been completed the tester shall change to the new frequency hop and whitening
settings.
After sending LMP_ACCEPTED the IUT shall wait for the LC level ACK for the
LMP_ACCEPTED. When this is received it shall change to the new frequency hop and
whitening settings.
Note: Loss of the LMP_ACCEPTED PDU will eventually lead to a loss of frequency
synchronization that cannot be recovered. Similar problems occur in normal operation,
when the hopping pattern changes.
Adaptive Frequency Hopping (AFH) shall only be used when the Hopping Mode is set
to 79 channels (e.g., Hopping Mode = 1) in the LMP_TEST_CONTROL PDU. If AFH is
used, the normal LMP commands and procedures shall be used. When AFH is enabled
prior to entering test mode it shall continue to be used with the same parameters if
Hopping Mode = 1 until the AFH parameters are changed by the LMP_SET_AFH PDU.
There is no signaling to determine or control the mode. The device behavior shall be
fixed or adjusted by other means, and shall not change randomly.
The tester can select whether whitening is on or off. This setting holds for both uplink
and downlink. For switching the whitening status, the same rules as in Section 1.1.2
(Figure 1.4) shall apply.
• If the synch word was not detected, the IUT shall not reply.
• If the header error check (HEC) fails, the IUT shall either reply with a NULL packet
with the ARQN bit set to NAK or send nothing.
• If the packet contains an LMP message relating to the control of the test mode this
command shall be executed and the packet shall not be returned, though ACK or
NAK shall be returned as per the usual procedure. Other LMP commands shall be
ignored and no packet returned.
• The payload FEC is decoded and the payload shall be encoded again for
transmission. This allows testing of the FEC handling. If the pure bit error rate shall be
determined the tester chooses a packet type without FEC.
• The CRC shall be evaluated. In the case of a failure, ARQN=NAK shall be returned.
The payload shall be returned as received.
A new CRC for the return packet shall be calculated for the returned payload
regardless of whether the CRC was valid or not.
• If the CRC fails for a packet with a CRC and a payload header, the number of bytes
as indicated in the (possibly erroneous) payload header shall be looped back.
Decode Header
faili
HEC
o.k.
Packet type Build NULL
without FEC + ARQN = NAK
Payload:
decode FEC
Send
Packet type
without CRC fail
CRC
o.k.
Transmit Path:
Packet type
without FEC Code FEC
Packet type
Add CRC
without CRC
Build packet
(incl. ARQN)
Send
The timing for normal and delayed loopback is illustrated in Figure 1.7 to Figure 1.9:
The whitening is performed in the same way as it is used in normal Active mode.
The following parameters can be set to configure the loop back test:
2. Frequency Selection
Single frequency (independent for RX and TX)
Normal hopping
3. Power level: (To be used according radio specification requirements)
power control or fixed TX power
The switch of the frequency setting is done exactly as for the transmitter test (see
Section 1.1.2.5).
Pause test is used by testers to put the implementation under test into Pause Test mode
from either the loopback or transmitter test modes.
When an LMP_TEST_CONTROL PDU that specifies Pause Test is received the IUT
shall stop the current test and enter Pause Test mode. In the case of a transmitter test
this means that no more packets shall be transmitted. While in Pause Test mode the
IUT shall respond normally to POLL packets (i.e. responds with a NULL packet). The
IUT shall also respond normally to all the LMP packets that are allowed in test mode.
When the test scenario is set to Pause Test all the other fields in the
LMP_TEST_CONTROL PDU shall be ignored. There shall be no change in hopping
scheme or whitening as a result of a request to pause test.
1.3 References
[1] CCITT Recommendation O.153 (1992), Basic parameters for the measurement
of error performance at bit rates below the primary rate.
[2] ITU-T Recommendation O.150 (1996), General requirements for instrumentation
for performance measurements on digital transmission equipment.
ATTRIBUTE PROTOCOL
(ATT)
CONTENTS
1 INTRODUCTION
1.1 Scope
The Attribute Protocol allows a device referred to as the server to expose a set of
attributes and their associated values to a peer device referred to as the client. These
attributes exposed by the server can be discovered, read, and written by a client, and
can be indicated and notified by the server.
1.3 Conventions
In this Part PDU names appear in italics. Error codes defined in Table 3.4 (see
Section 3.4.1.1) appear in italics followed by the numeric code (e.g. Attribute Not Found
(0x0A)). Other names such as parameters appear in Roman text.
2 PROTOCOL OVERVIEW
The Attribute Protocol defines two roles; a server role and a client role. It allows a server
to expose a set of attributes to a client that are accessible using the Attribute Protocol.
An attribute is a discrete value that has the following three properties associated with it:
The attribute type specifies what the attribute represents. Bluetooth SIG defined
attribute types are defined in Assigned Numbers and used by an associated higher
layer specification. Non-Bluetooth SIG attribute types may also be defined.
A client may send Attribute Protocol requests to a server, and the server shall respond
to all requests that it receives. A device can implement both client and server roles,
and both roles can function concurrently in the same device and between the same
devices. There shall be only one instance of a server on each Bluetooth device; this
implies that the attribute handles shall be identical for all supported bearers. For a given
client, the server shall have one set of attributes, which shall have the same value and
properties irrespective of which bearer is used. The server can support multiple clients.
The attribute values can be the same or different for each client as defined by GATT or
a higher layer specification.
The Attribute Protocol has notification and indication capabilities that provide an efficient
way of sending attribute values to a client without the need for them to be read; see
Section 3.3.
All Attribute Protocol requests are sent over an ATT bearer. There can be multiple ATT
bearers established between two devices. Each ATT bearer uses a separate L2CAP
channel and can have a different configuration.
In LE, there is a single ATT bearer that uses a fixed channel that is available as soon
as the ACL connection is established. Additional ATT bearers can be established using
L2CAP (see Section 3.2.11).
In BR/EDR, one or more ATT bearers can be established using L2CAP (see
Section 3.2.11).
3 PROTOCOL REQUIREMENTS
3.1 Introduction
Each attribute has an attribute type that identifies, by means of a UUID (Universally
Unique IDentifier), what the attribute represents so that a client can understand the
attributes exposed by a server. Each attribute has an attribute handle that is used for
accessing the attribute on a server, as well as an attribute value.
An attribute value is accessed using its attribute handle. The attribute handles are
discovered by a client using Attribute Protocol PDUs (Protocol Data Unit). Attributes that
have the same attribute type may exist more than once in a server. Attributes also have
a set of permissions that controls whether they can be read or written, or whether the
attribute value shall be sent over an encrypted link. Security aspects of the Attribute
Protocol are defined in Section 4.
A universally unique identifier (UUID) is used to identify every attribute type. A UUID is
considered unique over all space and time. A UUID can be independently created by
anybody and distributed or published as required. There is no central registry for UUIDs,
as they are based off a unique identifier that is not duplicated. The Attribute Protocol
allows devices to identify attribute types using UUIDs regardless of the local handle
used to identify them in a read or write request.
Universal unique identifiers are defined in SDP [Vol 3] Part B, Section 2.5.1.
All 32-bit Attribute UUIDs shall be converted to 128-bit UUIDs when the Attribute UUID
is contained in an ATT PDU.
An attribute handle is a 16-bit value that is assigned by each server to its own attributes
to allow a client to reference those attributes. An attribute handle shall not be reused
while an ATT bearer exists between a client and its server.
Attribute handles on any given server shall have unique, non-zero values. Attributes are
ordered by attribute handle.
An attribute handle of value 0x0000 is reserved for future use. An attribute handle of
value 0xFFFF is known as the maximum attribute handle.
Note: Attributes can be added or removed while an ATT bearer is established; however,
an attribute that has been removed cannot be replaced by another attribute with the
same handle while any ATT bearer is established.
An attribute value is an octet array that may be either fixed or variable length. For
example, it can be a one octet value, or a four octet integer, or a variable length string.
An attribute may contain a value that is too large to transmit in a single PDU and can be
sent using multiple PDUs. The values that are transmitted are opaque to the Attribute
Protocol. The encoding of these octet arrays is defined by the attribute type.
• Only one attribute value can be placed in a single request, response, notification
or indication unless the attribute values have lengths known by both the server and
client, as defined by the attribute type.
• This attribute value will always be the only variable length field of a request,
response, notification or indication.
• The bearer protocol (e.g. L2CAP) preserves datagram boundaries.
Note: Some responses include multiple attribute values, for example when client
requests multiple attribute reads. For the client to determine the attribute value
boundaries, the attribute values must have a fixed size defined by the attribute type.
There are some PDUs where the length of attribute values is included as a field within
the PDU and therefore the above implications do not apply to these PDUs.
An attribute has a set of permission values associated with it. The permissions
associated with an attribute specifies that it may be read and/or written. The
permissions associated with the attribute specifies the security level required for read
and/or write access, as well as notification and/or indication. The permissions of a given
attribute are defined by a higher layer specification, and are not discoverable using the
Attribute Protocol.
If access to a secure attribute requires an encrypted link, and the link is not encrypted,
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Insufficient Encryption (0x0F). When a client receives this error code it may try to
encrypt the link and if the encryption is successful, it can then access the secure
attribute.
If access to a secure attribute requires an encrypted link, and the link is encrypted but
with an encryption key size that is too short for the level of security required, then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Encryption
Key Size Too Short (0x0C). When a client receives this error code it may try to encrypt
the link with a longer key size, and if the encryption is successful, it can then access the
secure attribute.
• Readable
• Writeable
• Readable and writable
• Encryption required
• No encryption required
• Authentication Required
• No Authentication Required
• Authorization Required
• No Authorization Required
Access permissions are used by a server to determine if a client can read and/or write
an attribute value.
Different bearers for the same client may be on links with different security properties.
Therefore, the server must not assume that when a client has been authenticated on
the link carrying one bearer, it has been authenticated on all bearers. The different
security properties might have other implications that an implementation needs to take
into account.
Attributes that cannot be read, but can only be written, notified or indicated are called
control-point attributes. These control-point attributes can be used by higher layers
to enable device specific procedures, for example the writing of a command or the
indication when a given procedure on a device has completed.
The Attribute Protocol uses methods defined in Section 3.4 to find, read, write,
notify, and indicate attributes. A method is categorized as either a command, a
request, a response, a notification, an indication, or a confirmation; see Section 3.3.
Some Attribute Protocol PDUs can also include an Authentication Signature, to allow
authentication of the originator of this PDU without requiring encryption. The method
and signed bit are known as the opcode.
ATT_MTU is defined as the maximum size of any packet sent between a client and a
server. A higher layer specification defines the default ATT_MTU value.
When using an L2CAP channel with a fixed CID, the client and server may
optionally exchange the maximum size of a packet that can be received using the
ATT_EXCHANGE_MTU_REQ and ATT_EXCHANGE_MTU_RSP PDUs. Both devices
then use the minimum of these exchanged values for all further communication (see
Section 3.4.2). A device that is acting as a server and client at the same time shall use
the same value for Client Rx MTU and Server Rx MTU.
When using an L2CAP channel with a dynamically allocated CID, the ATT_MTU shall
be set to the L2CAP MTU size.
The ATT_MTU value is a per ATT bearer value. A device with multiple ATT bearers may
have a different ATT_MTU value for each ATT bearer.
The longest attribute that can be sent in a single packet is (ATT_MTU-1) octets in size.
At a minimum, the Attribute Opcode is included in an Attribute PDU.
An attribute value may be defined to be larger than (ATT_MTU-1) octets in size. These
attributes are called long attributes.
To read the entire value of an attributes larger than (ATT_MTU-1) octets, the
ATT_READ_BLOB_REQ PDU is used. It is possible to read the first (ATT_MTU-1)
octets of a long attribute value using the ATT_READ_REQ PDU.
To write the entire value of an attribute larger than (ATT_MTU-3) octets, the
ATT_PREPARE_WRITE_REQ and ATT_EXECUTE_WRITE_REQ PDUs are used. It
is possible to write the first (ATT_MTU-3) octets of a long attribute value using the
ATT_WRITE_CMD PDU.
Note: The protection of an attribute value changing when reading the value using
multiple Attribute Protocol PDUs is the responsibility of the higher layer.
The server shall treat each request or command as an atomic operation that cannot be
affected by another ATT bearer sending a request or command at the same time. If an
ATT bearer is terminated for any reason (user action or loss of the radio link), the value
of any modified attribute is the responsibility of the higher layer specification.
An ATT bearer is a channel used to send Attribute Protocol PDUs. Each ATT bearer
uses an L2CAP channel which shall be either a dynamically allocated channel or the
LE Attribute Protocol fixed channel (see [Vol 3] Part A, Section 2.1). A device may have
any number of dynamically allocated channels and at most one fixed channel as ATT
bearers to a peer device.
An ATT bearer connects an ATT Client on one device to an ATT Server on the peer
device and may also connect an ATT Server on the first device to an ATT Client on the
peer device. Whether a received Attribute PDU is intended for the ATT Client or for the
ATT Server is determined by the PDU type (see Section 3.3).
The L2CAP channel mode determines the behavior of Attribute Protocol on that ATT
bearer. If the L2CAP channel mode is using Enhanced Credit Based Flow Control
mode or (on BR/EDR) Enhanced Retransmission mode, the ATT bearer is known as an
Enhanced ATT bearer. Any ATT bearer that is not an Enhanced ATT bearer, using any
other L2CAP channel mode, is known as an Unenhanced ATT bearer.
Except where explicitly stated, the behavior of an Enhanced ATT bearer that uses
Enhanced Credit Based Flow Control mode shall be identical to the behavior of an ATT
bearer that does not use Enhanced Credit Based Flow Control mode.
An ATT bearer is terminated when either the L2CAP channel (if dynamically allocated)
or the underlying physical link is disconnected.
A device that supports L2CAP over multiple logical transports may, subject to any
other requirements in this specification, support ATT bearers on some or all of those
transports.
Attribute PDUs have one of six types, which are indicated by the suffix to the PDU name
as shown in Table 3.1:
A server shall be able to receive and properly respond to the following request PDUs:
• ATT_FIND_INFORMATION_REQ
• ATT_READ_REQ
Support for all other PDU types in a server can be specified in a higher layer
specification, see Section 3.4.8.
If a client sends a request, then the client shall support all possible response PDUs for
that request.
If a server receives a request that it does not support, then the server shall respond
with the ATT_ERROR_RSP PDU with the Error Code parameter set to Request Not
Supported (0x06), with the Attribute Handle In Error set to 0x0000.
If a server receives a command that it does not support, indicated by the Command
Flag of the PDU set to one, then the server shall ignore the command.
If the server receives an invalid request – for example, the PDU is the wrong length
– then the server shall respond with the ATT_ERROR_RSP PDU with the Error Code
parameter set to Invalid PDU (0x04), with the Attribute Handle In Error set to 0x0000.
If a server does not have sufficient resources to process a request, then the server
shall respond with the ATT_ERROR_RSP PDU with the Error Code parameter set to
Insufficient Resources (0x11), with the Attribute Handle In Error set to 0x0000.
If a server cannot process a request because an error was encountered during the
processing of this request, then the server shall respond with the ATT_ERROR_RSP
PDU with the Error Code parameter set to Unlikely Error (0x0E), with the Attribute
Handle In Error set to 0x0000.
Multi-octet fields within the Attribute Protocol shall be sent least significant octet first
(little-endian) with the exception of the Attribute Value field. The endian-ness of the
Attribute Value field is defined by a higher layer specification.
The Attribute Opcode is composed of three fields, the Authentication Signature Flag, the
Command Flag, and the Method. The Method is a 6-bit value that determines the format
and meaning of the Attribute Parameters.
If the Authentication Signature Flag of the Attribute Opcode is set to one, the
Authentication Signature value shall be appended to the end of the attribute PDU, and
X is 13. If the Authentication Signature Flag of the Attribute Opcode is set to zero, the
Authentication Signature value shall not be appended, and X is 1.
Note: An encrypted link already includes authentication data on every packet and
therefore adding more authentication data is not required.
If the Command Flag of the Attribute Opcode is set to one, the PDU shall be considered
to be a command.
Once a client sends a request to a server, that client shall send no other request to the
same server on the same ATT bearer until a response PDU has been received.
For notifications, which do not have a response PDU, there is no flow control and a
notification can be sent at any time.
For commands, which do not have a response PDU, there is no flow control and a
command can be sent at any time.
Note: A server can be flooded with commands, and a higher layer specification can
define how to prevent this from occurring.
Commands that are received but cannot be processed, due to buffer overflows or
a change-unaware client (see [Vol 3] Part G, Section 2.5.2.1), shall be discarded.
Therefore, those PDUs must be considered to be unreliable.
On an Unenhanced ATT bearer, notifications that are received but cannot be processed
due to buffer overflows shall be discarded. Therefore, those PDUs must be considered
to be unreliable.
Note: It is possible for a server to receive a request, send one or more notifications, and
then the response to the original request. The flow control of requests is not affected by
the transmission of the notifications.
Note: It is possible for a server to receive a request and then a command before
responding to the original request. The flow control of requests is not affected by the
transmission of commands.
Note: It is possible for a notification from a server to be sent after an indication has been
sent but the confirmation has not been received. The flow control of indications is not
affected by the transmission of notifications.
Note: It is possible for a client to receive an indication from a server and then send
a request or command to that server before sending the confirmation of the original
indication.
3.3.3 Transaction
On the client, a transaction shall start when the request is sent by the client. A
transaction shall complete when the response is received by the client.
A transaction not completed within 30 seconds shall time out. Such a transaction shall
be considered to have failed and the local higher layers shall be informed of this failure.
No more Attribute Protocol requests, commands, indications or notifications shall be
sent to the target device on this ATT bearer.
To send another Attribute Protocol PDU, a new ATT bearer must be established
between these devices. The existing ATT bearer may need to be terminated before
the new ATT bearer is established.
If the ATT bearer is terminated during a transaction, then the transaction shall be
considered to be closed, and any values that were being modified on the server will be
in an undetermined state.
3.4.1.1 ATT_ERROR_RSP
The ATT_ERROR_RSP PDU is used to state that a given request cannot be performed,
and to provide the reason.
The Request Opcode In Error parameter shall be set to the Attribute Opcode of the
request that generated this error.
The Attribute Handle In Error parameter shall be set to the attribute handle in the
original request that generated this error. If there was no attribute handle in the original
request or if the request is not supported, then the value 0x0000 shall be used for this
field.
The Error Code parameter shall be set to one of the following values:
The Error Code values listed in Section 3.4.2 to Section 3.4.8 are not necessarily the
only ones permitted in response to those PDUs. See Section 3.4.9 for the definitive list
of which Error Code values are permitted.
If more than one error code applies, then it is vendor-specific which error code is
transmitted in the ATT_ERROR_RSP PDU.
If an error code is received in the ATT_ERROR_RSP PDU that is not understood by the
client, for example an error code that was reserved for future use that is now being used
in a future version of the specification, then the ATT_ERROR_RSP PDU shall still be
considered to state that the given request cannot be performed for an unknown reason.
Note: Sending an ATT_ERROR_RSP PDU should not cause the ATT Server to
disconnect from the client. The client may upgrade the security and retry the request, so
the server should give the client sufficient time to perform such an upgrade.
3.4.2.1 ATT_EXCHANGE_MTU_REQ
The ATT_EXCHANGE_MTU_REQ PDU is used by the client to inform the server of the
client’s maximum receive MTU size and request the server to respond with its maximum
receive MTU size.
The Client Rx MTU shall be greater than or equal to the default ATT_MTU.
This request shall only be sent once during a connection by the client. The Client Rx
MTU parameter shall be set to the maximum size of the Attribute Protocol PDU that the
client can receive.
3.4.2.2 ATT_EXCHANGE_MTU_RSP
The Server Rx MTU shall be greater than or equal to the default ATT_MTU.
The Server Rx MTU parameter shall be set to the maximum size of the Attribute
Protocol PDU that the server can receive.
The server and client shall set ATT_MTU to the minimum of the Client Rx MTU and the
Server Rx MTU. The size is the same to ensure that a client can correctly detect the
final packet of a long attribute read.
This ATT_MTU value shall be applied in the server after this response has been sent
and before any other Attribute Protocol PDU is sent.
This ATT_MTU value shall be applied in the client after this response has been received
and before any other Attribute Protocol PDU is sent.
If either Client Rx MTU or Service Rx MTU are incorrectly less than the default
ATT_MTU, then the ATT_MTU shall not be changed and the ATT_MTU shall be the
default ATT_MTU.
If a device is both a client and a server, the following rules shall apply:
Note: This stops the risk of a cross-over condition where the MTU size is unknown
for the Indication or Notification.
A B
Exchange U=23)
MTU Req (using MT
(150) ATT Req
MTU=100
MTU=100
3.4.3.1 ATT_FIND_INFORMATION_REQ
Only attributes with attribute handles between the Starting Handle parameter and the
Ending Handle parameter will be returned. To read all attributes, the Starting Handle
parameter shall be set to 0x0001, and the Ending Handle parameter shall be set to
0xFFFF. The Starting Handle parameter shall be less than or equal to the Ending
Handle parameter.
3.4.3.2 ATT_FIND_INFORMATION_RSP
The Find Information Response shall have complete handle-UUID pairs. Such pairs
shall not be split across response packets; this also implies that a handle-UUID pair
shall fit into a single response packet. The handle-UUID pairs shall be returned in
ascending order of attribute handles.
The information data field is comprised of a list of data defined in Table 3.10 and
Table 3.11 depending on the value chosen for the format.
3.4.3.3 ATT_FIND_BY_TYPE_VALUE_REQ
range of handles associated with a given attribute to be discovered when the attribute
type determines the grouping of a set of attributes.
Only attributes with attribute handles between the Starting Handle parameter and the
Ending Handle parameter that match the requested attribute type and the attribute value
that have sufficient permissions to allow reading will be returned. To read all attributes,
the Starting Handle parameter shall be set to 0x0001, and the Ending Handle parameter
shall be set to 0xFFFF.
Note: Attribute values will be compared in terms of length and binary representation.
Note: It is not possible to use this request on an attribute that has a value longer than
(ATT_MTU-7).
3.4.3.4 ATT_FIND_BY_TYPE_VALUE_RSP
The Handles Information List field is a list of one or more Handle Informations. The
Handles Information field is an attribute handle range as defined in Table 3.14.
For each handle that matches the attribute type and attribute value in the
ATT_FIND_BY_TYPE_VALUE_REQ PDU a Handles Information shall be returned.
The Found Attribute Handle shall be set to the handle of the attribute that has the
exact attribute type and attribute value from the ATT_FIND_BY_TYPE_VALUE_REQ
PDU. If the attribute type in the ATT_FIND_BY_TYPE_VALUE_REQ PDU is a
grouping attribute as defined by a higher layer specification, the Group End Handle
shall be defined by that higher layer specification. If the attribute type in the
ATT_FIND_BY_TYPE_VALUE_REQ PDU is not a grouping attribute as defined by a
higher layer specification, the Group End Handle shall be equal to the Found Attribute
Handle.
Note: The Group End Handle may be greater than the Ending Handle in the
ATT_FIND_BY_TYPE_VALUE_REQ PDU.
3.4.4.1 ATT_READ_BY_TYPE_REQ
Only the attributes with attribute handles between the Starting Handle and the Ending
Handle with the attribute type that is the same as the Attribute Type given will be
returned. To search through all attributes, the starting handle shall be set to 0x0001 and
the ending handle shall be set to 0xFFFF.
Note: All attribute types are effectively compared as 128-bit UUIDs, even if a 16-bit
UUID is provided in this request or defined for an attribute. See [Vol 3] Part B,
Section 2.5.1.
The starting handle shall be less than or equal to the ending handle. If a server
receives an ATT_READ_BY_TYPE_REQ PDU with the Starting Handle parameter
greater than the Ending Handle parameter or the Starting Handle parameter is 0x0000,
an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Invalid
Handle (0x01). The Attribute Handle In Error parameter shall be set to the Starting
Handle parameter.
If no attribute with the given type exists within the handle range, then no attribute handle
and value will be returned, and an ATT_ERROR_RSP PDU shall be sent with the
Error Code parameter set to Attribute Not Found (0x0A). The Attribute Handle In Error
parameter shall be set to the starting handle.
The attributes returned shall be the attributes with the lowest handles within the handle
range. These are known as the requested attributes.
If the attributes with the requested type within the handle range have attribute
values that have the same length, then these attributes can all be read in a
single request. However, if those attributes have different lengths, then multiple
ATT_READ_BY_TYPE_REQ PDUs must be issued.
The ATT Server shall include as many attributes as possible in the response in order to
minimize the number of PDUs required to read attributes of the same type.
When multiple attributes match, then the rules below shall be applied to each in turn.
If the client has insufficient authorization to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08). The Attribute Handle In Error parameter shall be set to the handle
of the attribute causing the error.
If the client has insufficient security to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05). The Attribute Handle In Error parameter shall be set to the
handle of the attribute causing the error.
If the client has an encryption key size that is too short to read the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C). The Attribute Handle In Error parameter shall be
set to the handle of the attribute causing the error.
If the client has not enabled encryption, and encryption is required to read the requested
attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter
set to Insufficient Encryption (0x0F). The Attribute Handle In Error parameter shall be
set to the handle of the attribute causing the error.
Note: If there are multiple attributes with the requested type within the handle range,
and the client would like to get the next attribute with the requested type, it would have
to issue another ATT_READ_BY_TYPE_REQ PDU with its starting handle updated.
The client can be sure there are no more such attributes remaining once it gets an
ATT_ERROR_RSP PDU with the Error Code parameter set to Attribute Not Found
(0x0A).
3.4.4.2 ATT_READ_BY_TYPE_RSP
The Length parameter shall be set to the size of one attribute handle-value pair.
The maximum length of an attribute handle-value pair is 255 octets, bounded by the
Length parameter that is one octet. Therefore, the maximum length of an attribute value
returned in this response is (Length – 2) = 253 octets.
The attribute handle-value pairs shall be set to the value of the attributes identified by
the attribute type within the handle range within the request. If the attribute value is
longer than (ATT_MTU - 4) or 253 octets, whichever is smaller, then the first (ATT_MTU
- 4) or 253 octets shall be included in this response.
Note: The ATT_READ_BLOB_REQ PDU (see Section 3.4.4.5) can be used to read the
remaining octets of a long attribute value.
The Attribute Data field is comprised of a list of attribute handle and value pairs as
defined in Table 3.17.
3.4.4.3 ATT_READ_REQ
The ATT_READ_REQ PDU is used to request the server to read the value of an
attribute and return its value in an ATT_READ_RSP PDU.
The server shall respond with an ATT_READ_RSP PDU if the handle is valid and the
attribute has sufficient permissions to allow reading.
If the client has insufficient authorization to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08).
If the client has insufficient security to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05).
If the client has an encryption key size that is too short to read the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C).
If the client has not enabled encryption, and encryption is required to read the requested
attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter
set to Insufficient Encryption (0x0F).
If the handle is invalid, then an ATT_ERROR_RSP PDU shall be sent with the Error
Code parameter set to Invalid Handle (0x01).
3.4.4.4 ATT_READ_RSP
The ATT_READ_RSP PDU is sent in reply to a received Read Request and contains
the value of the attribute that has been read.
The attribute value shall be set to the value of the attribute identified by the attribute
handle in the request. If the attribute value is longer than
(ATT_MTU-1) then the first (ATT_MTU-1) octets shall be included in this response.
Note: The ATT_READ_BLOB_REQ PDU (see Section 3.4.4.5) can be used to read the
remaining octets of a long attribute value.
3.4.4.5 ATT_READ_BLOB_REQ
The ATT_READ_BLOB_REQ PDU is used to request the server to read part of the
value of an attribute at a given offset and return a specific part of the value in an
ATT_READ_BLOB_RSP PDU.
The value offset parameter is based from zero; the first value octet has an offset of zero,
the second octet has a value offset of one, etc.
The server shall respond with an ATT_READ_BLOB_RSP PDU if the handle is valid
and the attribute and value offset is not greater than the length of the attribute value and
has sufficient permissions to allow reading.
If the client has insufficient authorization to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08).
If the client has insufficient security to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05).
If the client has an encryption key size that is too short to read the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C).
If the client has not enabled encryption, and encryption is required to read the requested
attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter
set to Insufficient Encryption (0x0F).
If the handle is invalid, then an ATT_ERROR_RSP PDU shall be sent with the Error
Code parameter set to Invalid Handle (0x01).
If the value offset of the Read Blob Request is greater than the length of the attribute
value, an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Invalid Offset (0x07).
If the attribute value has a fixed length that is less than or equal to (ATT_MTU - 1) octets
in length, then an ATT_ERROR_RSP PDU may be sent with the Error Code parameter
set to Attribute Not Long (0x0B).
If the value offset of the ATT_READ_BLOB_REQ PDU is equal to the length of the
attribute value, then the length of the part attribute value in the response shall be zero.
Note: Some, but not all, long attributes have their length specified by a higher layer
specification. If the long attribute has a variable length, the only way to get to the end
of it is to read it part by part until the value in the ATT_READ_BLOB_RSP PDU has a
length shorter than (ATT_MTU-1) or an ATT_ERROR_RSP PDU is sent with the Error
Code parameter set to Invalid Offset (0x07).
Note: The value of a Long Attribute may change between the server receiving one
ATT_READ_BLOB_REQ PDU and the next ATT_READ_BLOB_REQ PDU. A higher
layer specification should be aware of this and define appropriate behavior.
3.4.4.6 ATT_READ_BLOB_RSP
The part attribute value shall be set to part of the value of the attribute identified by the
attribute handle and the value offset in the request. If the value offset is equal to the
length of the attribute value, then the length of the part attribute value shall be zero. If
the attribute value is longer than (Value Offset + ATT_MTU-1) then (ATT_MTU-1) octets
from Value Offset shall be included in this response.
3.4.4.7 ATT_READ_MULTIPLE_REQ
The attribute handles in the Set Of Handles parameter shall be valid handles.
The server shall respond with an ATT_READ_MULTIPLE_RSP PDU if all the handles
are valid and all attributes have sufficient permissions to allow reading.
Note: The attribute values for the attributes in the Set Of Handles parameters do not
have to all be the same size.
Note: The attribute handles in the Set Of Handles parameter do not have to be in
attribute handle order; they are in the order that the values are required in the response.
If the client has insufficient authorization to read any of the attributes then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08).
If the client has insufficient security to read any of the attributes then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05).
If the client has an encryption key size that is too short to read any of the attributes
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C).
If the client has not enabled encryption, and encryption is required to read the requested
attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter
set to Insufficient Encryption (0x0F).
If any of the handles are invalid, then an ATT_ERROR_RSP PDU shall be sent with the
Error Code parameter set to Invalid Handle (0x01).
3.4.4.8 ATT_READ_MULTIPLE_RSP
The Set Of Values parameter shall be a concatenation of attribute values for each of
the attribute handles in the request in the order that they were requested. If the Set Of
Values parameter is longer than (ATT_MTU-1) then only the first (ATT_MTU-1) octets
shall be included in this response.
Note: A client should not use this request for attributes when the Set Of Values
parameter could be (ATT_MTU-1) as it will not be possible to determine if the last
attribute value is complete, or if it overflowed.
3.4.4.9 ATT_READ_BY_GROUP_TYPE_REQ
Only the attributes with attribute handles between the Starting Handle and the Ending
Handle with the attribute type that is the same as the Attribute Group Type given will be
returned. To search through all attributes, the starting handle shall be set to 0x0001 and
the ending handle shall be set to 0xFFFF.
Note: All attribute types are effectively compared as 128-bit UUIDs, even if a 16-bit
UUID is provided in this request or defined for an attribute. See [Vol 3] Part B,
Section 2.5.1.
The starting handle shall be less than or equal to the ending handle. If a server receives
an ATT_READ_BY_GROUP_TYPE_REQ PDU with the Starting Handle parameter
greater than the Ending Handle parameter or the Starting Handle parameter is 0x0000,
an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Invalid
Handle (0x01). The Attribute Handle In Error parameter shall be set to the Starting
Handle parameter.
If no attribute with the given type exists within the handle range, then no attribute handle
and value will be returned, and an ATT_ERROR_RSP PDU shall be sent with the
Error Code parameter set to Attribute Not Found (0x0A). The Attribute Handle In Error
parameter shall be set to the starting handle.
The attributes returned shall be the attributes with the lowest handles within the handle
range. These are known as the requested attributes.
If the attributes with the requested type within the handle range have attribute
values that have the same length, then these attributes can all be read in a
single request. However, if those attributes have different lengths, then multiple
ATT_READ_BY_GROUP_TYPE_REQ PDUs must be issued.
The ATT Server shall include as many attributes as possible in the response in order to
minimize the number of PDUs required to read attributes of the same type.
When multiple attributes match, then the rules below shall be applied to each in turn.
If the client has insufficient authorization to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08). The Attribute Handle In Error parameter shall be set to the handle
of the attribute causing the error.
If the client has insufficient security to read the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05). The Attribute Handle In Error parameter shall be set to the
handle of the attribute causing the error.
If the client has an encryption key size that is too short to read the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C). The Attribute Handle In Error parameter shall be
set to the handle of the attribute causing the error.
If the client has not enabled encryption, and encryption is required to read the requested
attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter
set to Insufficient Encryption (0x0F). The Attribute Handle In Error parameter shall be
set to the handle of the attribute causing the error.
Note: If there are multiple attributes with the requested type within the handle range,
and the client would like to get the next attribute with the requested type, it would have
to issue another ATT_READ_BY_GROUP_TYPE_REQ PDU with its starting handle
updated. The client can be sure there are no more such attributes remaining once it
gets an ATT_ERROR_RSP PDU with the Error Code parameter set to Attribute Not
Found (0x0A).
3.4.4.10 ATT_READ_BY_GROUP_TYPE_RSP
The Length parameter shall be set to the size of the one Attribute Data.
The maximum length of an Attribute Data is 255 octets, bounded by the Length
parameter that is one octet. Therefore, the maximum length of an attribute value
returned in this response is (Length – 4) = 251 octets.
The Attribute Data List shall be set to the value of the attributes identified by the
attribute type within the handle range within the request. If the attribute value is longer
than (ATT_MTU - 6) or 251 octets, whichever is smaller, then the first (ATT_MTU - 6) or
251 octets shall be included in this response.
Note: The ATT_READ_BLOB_REQ PDU (see Section 3.4.4.5) can be used to read the
remaining octets of a long attribute value.
The Attribute Data List is comprised of a list of Attribute Data as defined in Table 3.26.
3.4.4.11 ATT_READ_MULTIPLE_VARIABLE_REQ
The attribute handles in the Set Of Handles parameter shall all be valid handles.
Note: The attribute values for the attributes in the Set Of Handles parameters do not
have to all be the same size.
Note: The attribute handles in the Set Of Handles parameter do not have to be in
attribute handle order; they are in the order that the values are required in the response.
If the client has insufficient authorization to read any of the attributes, then an
ATT_ERROR_RSP PDU shall be sent with the error code Insufficient Authorization.
If the client has insufficient security to read any of the attributes, then an
ATT_ERROR_RSP PDU shall be sent with the error code Insufficient Authentication.
If the client has an encryption key size that is too short to read any of the attributes, then
an ATT_ERROR_RSP PDU shall be sent with the error code Encryption Key Size Too
Short.
If the client has not enabled encryption, and encryption is required to read any of the
attributes, then an ATT_ERROR_RSP PDU shall be sent with the error code Insufficient
Encryption.
If any of the handles are invalid, then an ATT_ERROR_RSP PDU shall be sent with the
error code Invalid Handle.
3.4.4.12 ATT_READ_MULTIPLE_VARIABLE_RSP
The Length Value Tuple List shall be a concatenation of Length Value Tuples for each of
the attribute handles in the request in the order that they were requested. If the Length
Value Tuple List is longer than (ATT_MTU-1) octets, then it shall be truncated after
(ATT_MTU-1) or, if that would be within the Value Length field of a Length Value Tuple,
at the start of the Length Value Tuple.
Note: The ATT_READ_BLOB_REQ PDU (see Section 3.4.4.5) can be used to read the
remaining octets of a long attribute value.
The Value Length field in a Length Value Tuple shall be set to the length of the Attribute
Value field. The Attribute Value field in a Length Value Tuple shall be set to the value of
the attribute being read.
Note: If a Length Value Tuple is truncated, then the amount of Attribute Value will be
less than the value of the Value Length field. The client must therefore not use the Value
Length to determine the amount of the Attribute Value actually included in the PDU.
3.4.5.1 ATT_WRITE_REQ
The ATT_WRITE_REQ PDU is used to request the server to write the value of an
attribute and acknowledge that this has been achieved in an ATT_WRITE_RSP PDU.
The Attribute Value shall be set to the new value of the attribute.
If the attribute value has a variable length, then the attribute value shall be truncated or
lengthened to match the length of the Attribute Value parameter.
Note: If an attribute value has a variable length and if the Attribute Value parameter is of
zero length, the attribute value will be fully truncated.
If the attribute value has a fixed length and the Attribute Value parameter length is
less than or equal to the length of the attribute value, the octets of the attribute
value parameter length shall be written; all other octets in this attribute value shall be
unchanged.
The server shall respond with an ATT_WRITE_RSP PDU if the handle is valid, the
attribute has sufficient permissions to allow writing, and the attribute value has a valid
size and format, and it is successful in writing the attribute.
If the attribute value has a variable length and the Attribute Value parameter length
exceeds the maximum valid length of the attribute value then the server shall respond
with an ATT_ERROR_RSP PDU with the Error Code parameter set to Invalid Attribute
Value Length (0x0D).
If the attribute value has a fixed length and the requested attribute value parameter
length is greater than the length of the attribute value then the server shall respond with
an ATT_ERROR_RSP PDU with the Error Code parameter set to Invalid Attribute Value
Length (0x0D).
If the client has insufficient authorization to write the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08).
If the client has insufficient security to write the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05).
If the client has an encryption key size that is too short to write the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C).
If the client has not enabled encryption, and encryption is required to write the
requested attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code
parameter set to Insufficient Encryption (0x0F).
If the handle is invalid, then an ATT_ERROR_RSP PDU shall be sent with the Error
Code parameter set to Invalid Handle (0x01).
3.4.5.2 ATT_WRITE_RSP
The ATT_WRITE_RSP PDU shall be sent after the attribute value is written.
3.4.5.3 ATT_WRITE_CMD
The ATT_WRITE_CMD PDU is used to request the server to write the value of an
attribute, typically into a control-point attribute.
The attribute value parameter shall be set to the new value of the attribute.
If the attribute value has a variable length, then the attribute value shall be truncated or
lengthened to match the length of the attribute value parameter.
Note: If an attribute value has a variable length and if the attribute value parameter is of
zero length, the attribute value will be fully truncated.
If the attribute value has a fixed length and the attribute value parameter length is
less than or equal to the length of the attribute value, the octets up to the attribute
value parameter length shall be written; all other octets in this attribute value shall be
unchanged.
If the attribute value has a variable length and the attribute value parameter length
exceeds the maximum valid length of the attribute value then the server shall ignore the
command.
If the attribute value has a fixed length and the requested attribute value parameter
length is greater than the length of the attribute value then the server shall ignore the
command.
3.4.5.4 ATT_SIGNED_WRITE_CMD
The ATT_SIGNED_WRITE_CMD PDU is used to request the server to write the value
of an attribute with an authentication signature, typically into a control-point attribute.
The attribute value parameter shall be set to the new value of the attribute.
then message to be signed (M) by the CMAC function is the octet sequence
‘D21200133701000000’.
If the attribute value has a variable length, then the attribute value shall be truncated or
lengthened to match the length of the attribute value parameter.
Note: If an attribute value has a variable length and if the attribute value parameter is of
zero length, the attribute value will be fully truncated.
If the attribute value has a fixed length and the attribute value parameter length is
less than or equal to the length of the attribute value, the octets up to the attribute
value parameter length shall be written; all other octets in this attribute value shall be
unchanged.
If the attribute value has a variable length and the attribute value parameter length
exceeds the maximum valid length of the attribute value then the server shall ignore the
command.
If the attribute value has a fixed length and the requested attribute value parameter
length is greater than the length of the attribute value then the server shall ignore the
command.
If the authentication signature verification fails, then the server shall ignore the
command.
Each client's queued values are separate; the execution of one queue shall not affect
the preparation or execution of any other client's queued values. Each client has a
single queue regardless of how many ATT bearers are currently established.
3.4.6.1 ATT_PREPARE_WRITE_REQ
A client may send more than one ATT_PREPARE_WRITE_REQ PDU to a server, which
will queue and send a response for each handle value pair.
A server may limit the number of prepared writes that it can queue. A higher layer
specification should define this limit.
Any actions on attributes that exist in the prepare queue shall proceed as if the prepare
queue did not exist, and the prepare queue shall be unaffected by these actions. A
subsequent execute write will write the values in the prepare queue even if the value of
the attribute has changed since the prepare writes were started.
The Attribute Protocol makes no determination on the validity of the Part Attribute Value
or the Value Offset. A higher layer specification determines the meaning of the data.
If all ATT bearers belonging to the same client are lost while a number of pending
prepare write values have been queued, the queue will be cleared and no writes will be
executed.
The Value Offset parameter shall be set to the offset of the first octet where the Part
Attribute Value parameter is to be written within the attribute value. The Value Offset
parameter is based from zero; the first octet has an offset of zero, the second octet has
an offset of one, etc.
If the client has insufficient authorization to write the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authorization (0x08).
If the client has insufficient security to write the requested attribute then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Insufficient
Authentication (0x05).
If the client has an encryption key size that is too short to write the requested attribute
then an ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to
Encryption Key Size Too Short (0x0C).
If the client has not enabled encryption, and encryption is required to write the
requested attribute, then an ATT_ERROR_RSP PDU shall be sent with the Error Code
parameter set to Insufficient Encryption (0x0F).
If the server does not have sufficient space to queue this request then an
ATT_ERROR_RSP PDU shall be sent with the Error Code parameter set to Prepare
Queue Full (0x09).
If the handle is invalid, then an ATT_ERROR_RSP PDU shall be sent with the Error
Code parameter set to Invalid Handle (0x01).
If the attribute value cannot be written then an ATT_ERROR_RSP PDU shall be sent
with the Error Code parameter set to Write Not Permitted (0x03).
The server shall not change the value of the attribute until an
ATT_EXECUTE_WRITE_REQ PDU is received.
3.4.6.2 ATT_PREPARE_WRITE_RSP
The attribute handle shall be set to the same value as in the corresponding
ATT_PREPARE_WRITE_REQ PDU.
The value offset and part attribute value shall be set to the same values as in the
corresponding ATT_PREPARE_WRITE_REQ PDU.
3.4.6.3 ATT_EXECUTE_WRITE_REQ
When the flags parameter is set to 0x01, all pending prepare write values that are
currently queued shall be written in the order they were received in the corresponding
ATT_PREPARE_WRITE_REQ PDUs. The queue shall then be cleared and an
ATT_EXECUTE_WRITE_RSP PDU shall be sent.
When the flags parameter is set to 0x00 all pending prepare write values
shall be discarded for this client. The queue shall then be cleared, and an
ATT_EXECUTE_WRITE_RSP PDU shall be sent.
Note: If multiple ATT bearers were used to send the prepare write requests, then the
order that writes sent on different ATT bearers are executed is not specified and is
not reported to the client. In addition, if the ATT_EXECUTE_WRITE_REQ PDU is sent
before the client has received responses to all the prepare write requests, the requests
for which the client has not yet received a response might form part of a subsequent
write rather than this one; this is also not reported to the client.
If there are no pending prepared write values, then no values are written, and an
ATT_EXECUTE_WRITE_RSP PDU shall be sent.
If the prepared Attribute Value exceeds the maximum valid length of the attribute value
then all pending prepare write values shall be discarded for this client, the queue shall
then be cleared, and an ATT_ERROR_RSP PDU shall be sent with the Error Code
parameter set to Invalid Attribute Value Length (0x0D).
If the prepare Value Offset is greater than the current length of the attribute value
then all pending prepare write values shall be discarded for this client, the queue shall
be cleared and then an ATT_ERROR_RSP PDU shall be sent with the Error Code
parameter set to Invalid Offset (0x07).
If the pending prepared write values cannot be written, due to an application error, the
queue shall be cleared and then an ATT_ERROR_RSP PDU shall be sent with a higher
layer specification defined error code. The Attribute Handle In Error parameter shall
be set to the attribute handle of the attribute from the prepare queue that caused this
application error. The state of the attributes that were to be written from the prepare
queue is not defined in this case.
3.4.6.4 ATT_EXECUTE_WRITE_RSP
The ATT_EXECUTE_WRITE_RSP PDU shall be sent after the attributes are written. In
case an action is taken in response to the write, an indication may be used once the
action is complete.
3.4.7.1 ATT_HANDLE_VALUE_NTF
The attribute value shall be set to the current value of the attribute identified by the
attribute handle.
If the attribute value is longer than (ATT_MTU-3) octets, then only the first (ATT_MTU-3)
octets of this attributes value can be sent in a notification.
Note: For a client to get a long attribute, it must use the ATT_READ_BLOB_REQ PDU
(see Section 3.4.4.5) following the receipt of this notification.
If the attribute handle or the attribute value is invalid, then this notification shall be
ignored upon reception.
3.4.7.2 ATT_HANDLE_VALUE_IND
The attribute value shall be set to the current value of the attribute identified by the
attribute handle.
If the attribute value is longer than (ATT_MTU-3) octets, then only the first (ATT_MTU -
3) octets of this attributes value can be sent in an indication.
Note: For a client to get a long attribute, it must use the ATT_READ_BLOB_REQ PDU
(see Section 3.4.4.5) following the receipt of this indication.
If the attribute handle or the attribute value is invalid, the client shall send an
ATT_HANDLE_VALUE_CFM PDU in response and shall discard the handle and value
from the received indication.
3.4.7.3 ATT_HANDLE_VALUE_CFM
3.4.7.4 ATT_MULTIPLE_HANDLE_VALUE_NTF
A server can send a notification of two or more attributes' values at any time.
The Handle Length Value Tuple List shall be a concatenation of Handle Length Value
Tuples for each of the attributes being notified.
The Attribute Handle field in a Handle Length Value Tuple shall be set to the handle of
the attribute being notified. The Value Length field in a Handle Length Value Tuple shall
be set to the length of the Attribute Value field. The Attribute Value field in a Handle
Length Value Tuple shall be set to the value of the attribute being notified.
If an attribute handle or an attribute value is invalid, then the client shall ignore that
attribute when receiving this notification.
Table 3.44 gives a summary of the Attribute PDU Method responses that are allowed.
Each method indicates the method that should be sent as a successful response,
and whether an ATT_ERROR_RSP PDU can be sent in response instead. If an
ATT_ERROR_RSP PDU can be sent, then Table 3.44 also indicates the error codes
that are valid within this ATT_ERROR_RSP PDU for the given method.
4 SECURITY CONSIDERATIONS
The Attribute Protocol can be used to access information that may require both
authorization and an authenticated and encrypted physical link before an attribute can
be read or written.
If such a request is issued when the client has not been authorized to access this
information, the server shall send an ATT_ERROR_RSP PDU with the Error Code
parameter set to Insufficient Authorization (0x08). The authorization requirements for
access to a given attribute are not defined in this Part. Each device implementation will
determine how authorization occurs. Authorization procedures are defined in GAP, and
may be further refined in a higher layer specification.
If such a request is issued when the physical link is unauthenticated, the server shall
send an ATT_ERROR_RSP PDU with the Error Code parameter set to Insufficient
Authentication (0x05). A client wanting to read or write this attribute can then request
that the physical link be authenticated, and once this has been completed, send the
request again.
The Attribute Protocol can be used to notify or indicate the value of an attribute that
may require an authenticated and encrypted physical link before an attribute notification
or indication is performed. A server wanting to notify or indicate this attribute can then
request that the physical link be authenticated, and once this has been completed, send
the notification or indication.
The list of attributes that a device supports is not considered private or confidential
information, and therefore the ATT_FIND_INFORMATION_REQ PDU shall always
be permitted. This implies that the error code Insufficient Authorization (0x08) or
Insufficient Authentication (0x05) shall not be used in an ATT_ERROR_RSP PDU for
an ATT_FIND_INFORMATION_REQ PDU.
For example, an attribute value may be allowed to be read by any device, but only
written by an authenticated device. An implementation should take this into account,
and not assume that just because it can read an attribute’s value, it will also be able to
write the value. Similarly, just because an attribute value can be written, does not mean
that an attribute value can also be read. Each individual attribute could have different
security requirements.
When a client accesses an attribute, the order of checks that are performed on
the server will have security implications. A server shall check authentication and
authorization requirements before any other check is performed.
Note: For example, if the authentication and authorization requirement checks are not
performed first then the size of an attribute could be determined by sending repeated
ATT_READ_BLOB_REQ PDUs for an attribute that a client does not have access to,
because either the error code Invalid Offset (0x07) or Insufficient Authentication (0x05)
would be returned.
5 REFERENCES
[1] Core Specification Supplement, Part B, Common Profile and Service Error
Codes
Previous versions of this specification used different names for the PDUs defined in
Section 3.4. Table A.1 shows the previous and current names of these PDUs.
GENERIC ATTRIBUTE
PROFILE (GATT)
CONTENTS
1 INTRODUCTION
1.1 Scope
The Generic Attribute profile (GATT) defines a service framework using the Attribute
Protocol. This framework defines procedures and formats of services and their
characteristics. The procedures defined include discovering, reading, writing, notifying
and indicating characteristics, as well as configuring the broadcast of characteristics.
Example Application
Profile
Figure 1.1 depicts the structure and the dependencies of the profiles. A profile is
dependent upon another profile if it re-uses parts of that profile by implicitly or explicitly
referencing it.
1.5 Conventions
In this Part the use of literal terms such as procedure, PDUs, opcodes, or function
names appear in italics. Specific names of fields in structures, packets, etc. also appear
in italics. The use of « » (e.g. «Primary Service») indicates a UUID. Attribute Protocol
error codes (see [Vol 3] Part F, Table 3.4) appear in italics followed by the numeric error
code.
2 PROFILE OVERVIEW
Application Application
Attribute Attribute
Protocol Protocol
L2CAP L2CAP
Controller Controller
The following roles are defined for devices that implement this profile:
Client—This is the device that initiates commands and requests towards the server and
can receive responses, indications and notifications sent by the server.
Server—This is the device that accepts incoming commands and requests from the
client and sends responses, indications and notifications to a client.
Note: The roles are not fixed to the device. The roles are determined when a device
initiates a defined procedure, and they are released when the procedure ends.
In Figure 2.2, the computer is the temperature service client and the sensor is the
temperature service server. The computer initiates procedures to configure the sensor
or to read the sensor values. In this example the sensor provides information about the
characteristics the sensor device exposes as part of the temperature service and may
permit some characteristics to be written. Also, the sensor responds to read requests
with the appropriate values.
• Exchanging configuration
• Discovery of services and characteristics on a device
• Reading a characteristic value
• Writing a characteristic value
• Notification of a characteristic value
• Indication of a characteristic value
2.5.1 Overview
The GATT Profile uses the Attribute Protocol to transport data in the form of commands,
requests, responses, indications, notifications and confirmations between devices. This
data is contained in Attribute Protocol PDUs as specified in Figure 2.3.
The Opcode contains the specific command, request, response, indication, notification
or confirmation opcode and a flag for authentication. The Attribute Parameters contain
data for the specific command or request or the data returned in a response, indication,
or notification. The Authentication Signature is optional and is described in [Vol 3] Part
H, Section 2.4.5.
Attribute Protocol commands and requests act on values stored in Attributes on the
server device. An Attribute is composed of four parts: Attribute Handle, Attribute Type,
Attribute Value, and Attribute Permissions. Figure 2.4 shows a logical representation
of an Attribute. The actual representation for a given implementation is specific to that
implementation.
implementation
2 Octets 2 or 16 Octets variable length specific
Attribute Permissions is part of the Attribute that cannot be read from or written to using
the Attribute Protocol. It is used by the server to determine whether read or write access
is permitted for a given attribute. Attribute Permissions are established by the GATT
profile, a higher layer profile or are implementation specific if not specified.
Attribute caching is an optimization that allows the client to discover the Attribute
information such as Attribute Handles used by the server once and use the same
Attribute information across reconnections without rediscovery. If the client does not
cache the Attribute information, then it must rediscover the Attribute information at each
reconnection. With caching, time is saved and a significant number of packets need
not be exchanged between the client and server. The Attribute information that shall be
cached by a client is the Attribute Handles of all server attributes and the GATT service
characteristics values.
Attribute Handles used by the server should not change over time. This means that
once an Attribute Handle is discovered by a client the Attribute Handle for that Attribute
should not be changed.
Some circumstances may cause servers to change the Attribute Handles used for
services, perhaps due to a factory reset or a firmware upgrade procedure being
performed. The following is only required on the server if the services on the server
can be added, modified or removed. If GATT based services on the server cannot be
changed during the usable lifetime of the device, the Service Changed characteristic
shall not exist on the server and the client does not need to ever perform service
discovery after the initial service discovery for that server.
For clients that have a trusted relationship (i.e. bond) with the server, the attribute
cache is valid across connections. For clients with a trusted relationship and not in a
connection when a service change occurs, the server shall send an indication when
the client reconnects to the server (see Section 7.1). For clients that do not have a
trusted relationship with the server and that do not support reading the Database Hash
characteristic, the attribute cache is valid only during the connection. Clients without
a trusted relationship that do support reading the Database Hash characteristic may
validate the attribute cache on connection setup. Clients without a trusted relationship
shall receive an indication when the service change occurs only during the current
connection.
Note: Clients without a trusted relationship that support caching must either
perform service discovery or detect service changes by reading the Database
Hash characteristic on each connection if the server supports the Service Changed
characteristic.
Note: A server may set the affected Attribute Handle range to 0x0001 to 0xFFFF to
indicate to the client to rediscover the entire set of Attribute Handles on the server.
If the Database Hash characteristic exists on the server then, each time a service
change occurs, the server shall update the Database Hash characteristic value with the
new Database Hash (see Section 7.3).
If the Database Hash characteristic value has changed since the last time it was read,
the client shall consider its attribute cache invalid and shall not make use of the cached
information until it has performed service discovery or obtained the changed database
definitions using an out-of-band mechanism.
Once the server has received the ATT_HANDLE_VALUE_CFM PDU, the server can
consider the client to be aware of the updated Attribute Handles.
The client shall consider the affected Attribute Handle range to be invalid in its attribute
cache and perform the discovery procedures to restore the attribute cache. The server
shall store service changed information for all bonded devices.
Robust Caching is a feature where the server sends an ATT_ERROR_RSP PDU to the
client if the server does not consider the client to be aware of a service change.
If the Database Hash and Service Changed characteristics are both present on the
server, then the server shall support the Robust Caching feature.
Whenever the server updates the database definitions, all connected clients become
change-unaware. A change-unaware connected client becomes change-aware when
it reads the Database Hash characteristic and then the server receives another ATT
request from the client. A change-unaware client using multiple ATT bearers shall wait
until the server has responded to all pending requests before reading the Database
Hash characteristic (see Figure 2.5).
Client - Client -
Server
Bearer 1 Bearer 2
Database
updated
Client is
change-unaware
ATT Request 1 (Handle)
Attribute cache
is invalid
ATT Request
Client is
change-aware
ATT Response
Figure 2.5: Transition to change-aware state for a client using multiple ATT bearers
In addition, a change-unaware connected client using exactly one ATT bearer becomes
change-aware when either of the following happen:
• The client receives and confirms a Handle Value Indication for the Service Changed
characteristic (see Figure 2.6).
• The server sends the client a response with the Error Code parameter set to
Database Out Of Sync (0x12) and then the server receives another ATT request
from the client (see Figure 2.7).
Client Server
Database
updated
Client is
change-unaware
Server ignores
the command
Attribute cache
is invalid
Server ignores
the command
Client is
change-aware
Server accepts
the command
Figure 2.6: Transition to change-aware state for a client using exactly one ATT bearer, triggered by a
Service Changed confirmation
Client Server
Database
updated
Client is
change-unaware
Server ignores
the command
Server ignores
the command
Attribute cache
is invalid
ATT Request
Client is
change-aware
Server accepts
the command
Figure 2.7: Transition to change-aware state for a client using exactly one ATT bearer, triggered by the
ATT response "Database Out Of Sync" or "Hash Read"
If a client that has indicated support for robust caching (by setting the Robust Caching
bit in the Client Supported Features characteristic) is change-unaware then the server
shall send an ATT_ERROR_RSP PDU with the Error Code parameter set to Database
Out Of Sync (0x12) when either of the following happen:
• That client requests an operation at any Attribute Handle or list of Attribute Handles
by sending an ATT request.
• That client sends an ATT_READ_BY_TYPE_REQ PDU with Attribute Type other than
«Include» or «Characteristic» and an Attribute Handle range other than 0x0001 to
0xFFFF.
The ATT_ERROR_RSP PDU is sent only once per bearer after the client becomes
change-unaware, unless the client disconnects or the database changes again before
the client becomes change-aware in which case the ATT_ERROR_RSP PDU shall
be sent again. If a change-unaware client sends an ATT command, the server shall
ignore it. Except for a Handle Value Indication for the Service Changed characteristic,
the server shall not send notifications and indications to such a client until it becomes
change-aware. If a client is change-aware, then the server shall perform the operation
normally.
Note: To reduce the probability of blocked notifications and indications, servers should
send this indication as soon as possible after a service change.
If a client receives an ATT_ERROR_RSP PDU with the Error Code parameter set to
Database Out Of Sync (0x12), it shall consider its attribute cache invalid and shall not
make use of the cached information until it has performed service discovery or obtained
the changed database definitions using an out-of-band mechanism.
The Generic Attribute Profile defines the grouping of attributes for three
attribute types: «Primary Service», «Secondary Service» and «Characteristic».
A group begins with a declaration, and ends as defined in Section 3.1 for
services and Section 3.3 for characteristics. Not all of the grouping attributes
can be used in the ATT_READ_BY_GROUP_TYPE_REQ PDU. The «Primary
Service» and «Secondary Service» grouping types may be used in the
ATT_READ_BY_GROUP_TYPE_REQ PDU. The «Characteristic» grouping type shall
not be used in the ATT_READ_BY_GROUP_TYPE_REQ PDU.
2.5.4 UUIDs
All 16-bit UUIDs shall be contained in exactly 2 octets. All 128-bit UUIDs shall be
contained in exactly 16 octets.
All 32-bit UUIDs shall be converted to 128-bit UUIDs when the UUID is contained in an
ATT PDU. See [Vol 3] Part B, Section 2.5.1 for the method of conversion.
2.6.1 Overview
The GATT Profile specifies the structure in which profile data is exchanged. This
structure defines basic elements such as services and characteristics, used in a profile.
All of the elements are contained by Attributes. Attributes used in the Attribute Protocol
are containers that carry this profile data.
The top level of the hierarchy is a profile. A profile is composed of one or more services
necessary to fulfill a use case. A service is composed of characteristics or inclusions
of other services. Each characteristic contains a value and may contain optional
information about the value. The service and characteristic and the components of the
characteristic (i.e. value and descriptors) contain the profile data and are all stored in
Attributes on the server.
Profile
Service Service
Include Include
Include Include
Characteristic Characteristic
Properties Properties
Value Value
Descriptor Descriptor
Descriptor Descriptor
Characteristic Characteristic
Properties Properties
Value Value
Descriptor Descriptor
Descriptor Descriptor
2.6.2 Service
There are two types of services: primary service and secondary service. A primary
service is a service that exposes functionality of this device. A primary service can be
included by another service. Primary services can be discovered using Primary Service
Discovery procedures. A secondary service is a service that should only be included
from a primary service or another secondary service or other higher layer specification.
A secondary service is only relevant in the context of the entity that includes it.
Services may be used in one or more higher layer specifications to fulfill a particular use
case.
2.6.4 Characteristic
the server is executing the Broadcast mode procedure. For BR/EDR physical links,
Configured Broadcast is not supported.
All include definitions and characteristic definitions contained within the service
definition are considered to be part of the service. All include definitions shall
immediately follow the service declaration and precede any characteristic definitions. A
service definition may have zero or more include definitions. All characteristic definitions
shall be immediately following the last include definition or, in the event of no include
definitions, immediately following the service declaration. A service definition may
have zero or more characteristic definitions. There is no upper limit for include or
characteristic definitions.
A service declaration is an Attribute with the Attribute Type set to the UUID for «Primary
Service» or «Secondary Service». The Attribute Value shall be the 16-bit Bluetooth
UUID or 128-bit UUID for the service, known as the service UUID. A client shall
support the use of both 16-bit and 128-bit UUIDs. A client may ignore any service
definition with an unknown service UUID. An unknown service UUID is a UUID for an
unsupported service. The Attribute Permissions shall be read-only and shall not require
authentication or authorization.
When multiple services exist, services definitions with service declarations using 16-
bit Bluetooth UUID should be grouped together (i.e. listed sequentially) and services
definitions with service declarations using 128-bit UUID should be grouped together.
A device or higher level specification may have multiple service definitions and may
have multiple service definitions with the same service UUID.
All Attributes on a server shall either contain a service declaration or exist within a
service definition.
Service definitions contained in a server may appear in any order; a client shall not
assume the order of service definitions on a server.
The include declaration is an Attribute with the Attribute Type set to the UUID for
«Include». The Attribute Value shall be set to the included service Attribute Handle,
the End Group Handle, and the service UUID. The Service UUID shall only be present
when the UUID is a 16-bit Bluetooth UUID.The Attribute Permissions shall be read only
and not require authentication or authorization.
A server shall not contain a service definition with an include definition to another
service that includes the original service. This applies to each of the services the
included definition references. This is referred to as a circular reference.
and writes of multiple Characteristic Values through the reading and writing of a
single aggregated Characteristic Value. This type of characteristic definition is the
same as a normal characteristic definition. The characteristic declaration shall use
a characteristic UUID that is unique to the aggregated characteristic definition. The
aggregated characteristic definition may also contain a characteristic aggregate format
descriptor that describes the display format of the aggregated Characteristic Value.
A characteristic declaration is an Attribute with the Attribute Type set to the UUID for
«Characteristic» and Attribute Value set to the Characteristic Properties, Characteristic
Value Attribute Handle and Characteristic UUID. The Attribute Permissions shall be
readable and not require authentication or authorization.
If the server changes any characteristic declaration Attribute Value while the server has
a trusted relationship with any client, then it shall send each client a Service Changed
Indication indicating a change in the service holding the Characteristic Declaration (see
Section 7.1).
A service may have multiple characteristic definitions with the same Characteristic
UUID.
that are optional within a service definition. Whenever possible and within the
requirements stated earlier, characteristics definitions with characteristic declarations
using 16-bit Bluetooth UUIDs should be grouped together (i.e. listed sequentially) and
characteristics definitions with characteristic declarations using 128-bit UUIDs should be
grouped together.
The Characteristic Properties bit field determines how the Characteristic Value can be
used, or how the characteristic descriptors (see Section 3.3.3) can be accessed. If the
bits defined in Table 3.5 are set, the action described is permitted. Multiple characteristic
properties can be set.
These bits shall be set according to the procedures allowed for this characteristic, as
defined by higher layer specifications, without regard to security requirements.
The Characteristic Value Attribute Handle field is the Attribute Handle of the Attribute
that contains the Characteristic Value.
The Characteristic UUID field is a 16-bit Bluetooth UUID or 128-bit UUID that describes
the type of Characteristic Value. A client shall support the use of both 16-bit and 128-bit
Characteristic UUIDs. A client may ignore any characteristic definition with an unknown
Characteristic UUID. An unknown characteristic UUID is a UUID for an unsupported
characteristic.
The Characteristic Value declaration contains the value of the characteristic. It is the
first Attribute after the characteristic declaration. All characteristic definitions shall have
a Characteristic Value declaration.
A Characteristic Value declaration is an Attribute with the Attribute Type set to the
16-bit Bluetooth or 128-bit UUID for the Characteristic Value used in the characteristic
declaration. The Attribute Value is set to the Characteristic Value. The Attribute
Permissions are specified by the service or may be implementation specific if not
specified otherwise.
The characteristic descriptor is contained in an Attribute and the Attribute Type shall
be set to the UUID for «Characteristic Extended Properties» and the Attribute Value
shall be two octets in length and shall contain the Characteristic Extended Properties
Bit Field. The Attribute Permissions shall be readable without authentication and
authorization being required.
the Characteristic Value. If the Writable Auxiliaries bit of the Characteristic Extended
Properties is set then this characteristic descriptor can be written. The characteristic
descriptor may occur in any position within the characteristic definition after the
Characteristic Value. Only one Characteristic User Description declaration shall exist
in a characteristic definition.
The characteristic descriptor is contained in an Attribute and the Attribute Type shall be
set to the UUID for «Characteristic User Description» and the Attribute Value shall be
set to the characteristic user description UTF-8 string. The Attribute Permissions are
specified by the profile or may be implementation specific if not specified otherwise.
A client may write this configuration descriptor to control the configuration of this
characteristic on the server for the client. Each client has its own instantiation of the
Client Characteristic Configuration. Reads of the Client Characteristic Configuration
only shows the configuration for that client and writes only affect the configuration of
that client. Authentication and authorization may be required by the server to write
the configuration descriptor. The Client Characteristic Configuration declaration shall be
readable and writable.
If both the Notification and Indication bits are set, then the server shall use the
notification procedure (see Section 4.10) when an acknowledgment is not required by a
higher-layer specification or shall use the indication procedure (see Section 4.11) when
an acknowledgment is required. The server should not use both procedures to send the
same characteristic value.
The server may reject a request to set both the Notification and Indication bits for the
same characteristic.
The default value for the Client Characteristic Configuration descriptor value shall be
0x0000.
Between a client and a server there shall be a single Client Characteristic Configuration
Descriptor irrespective of the number of ATT bearers between them.
A client may write this configuration descriptor to control the configuration of this
characteristic on the server for all clients. There is a single instantiation of the
Server Characteristic Configuration for all clients. Reads of the Server Characteristic
Configuration shows the configuration all clients and writes affect the configuration for
all clients. Authentication and authorization may be required by the server to write the
configuration descriptor.
The characteristic descriptor is contained in an Attribute. The Attribute Type shall be set
to the UUID for «Characteristic Presentation Format». The Attribute Value shall be set
to the characteristic descriptor value. The Attribute Permissions shall be read only and
not require authentication or authorization.
The definition of the Characteristic Presentation Format descriptor Attribute Value field
is the following.
The bit ordering used for the Characteristic Presentation Format descriptor shall be
little-endian.
3.3.3.5.2 Format
The format field determines how a single value contained in the Characteristic Value is
formatted. The values of this field are defined in Assigned Numbers [1].
3.3.3.5.3 Exponent
The exponent field is used with integer data types to determine how the value is further
formatted. The exponent field is only used on integer format types. The exponent field
has type sint8.
As can be seen in the above equation, the actual value is a combination of the
Characteristic Value and the value 10 to the power Exponent. This is sometimes known
as a fixed point number.
For example, if the Exponent is 2 and the Characteristic Value is 23, the actual value
would be 2300.
For example, if the Exponent is -3 and the Characteristic Value is 3892, the actual value
would be 3.892.
3.3.3.5.4 Unit
The Name Space field is used to identify the organization, as defined in Assigned
Numbers [1], that is responsible for defining the enumerations for the description field.
3.3.3.5.6 Description
The Description is an enumerated value as defined in Assigned Numbers [1] from the
organization identified by the Name Space field.
The characteristic descriptor may occur in any position within the characteristic
definition after the Characteristic Value. Only one Characteristic Aggregate Format
declaration shall exist in a characteristic definition.
The Attribute Permissions shall be read only and not require authentication or
authorization.
The List of Attribute Handles is the concatenation of multiple 16-bit Attribute Handle
values into a single Attribute Value. The list shall contain at least two Attribute Handle
for Characteristic Presentation Format declarations. The Characteristic Value shall be
decomposed by each of the Characteristic Presentation Format declarations pointed to
by the Attribute Handles. The order of the Attribute Handles in the list is significant.
4.1 Overview
1. Server Configuration
2. Primary Service Discovery
3. Relationship Discovery
4. Characteristic Discovery
5. Characteristic Descriptor Discovery
6. Reading a Characteristic Value
7. Writing a Characteristic Value
8. Notification of a Characteristic Value
9. Indication of a Characteristic Value
10. Reading a Characteristic Descriptor
11. Writing a Characteristic Descriptor
Table 4.1 maps each feature to the procedures used for that feature, and indicates
whether the procedure is optional or mandatory for that feature. The procedures are
described in the referenced section.
If an ATT PDU is supported on any ATT bearer, then it shall be supported on all
supported ATT bearers with the following exceptions:
• The Exchange MTU sub-procedure shall only be supported on the LE Fixed Channel
Unenhanced ATT bearer.
• The Signed Write Without Response sub-procedure shall only be supported on the LE
Fixed Channel Unenhanced ATT bearer.
This procedure is used by the client to configure the Attribute Protocol. This procedure
has only one sub-procedure used to set the MTU sizes.
This sub-procedure is used by the client to set the ATT_MTU to the maximum possible
value that can be supported by both devices when the client supports a value greater
than the default ATT_MTU for the Attribute Protocol. This sub-procedure shall only be
initiated once during a connection.
This sub-procedure shall not be used on a BR/EDR physical link since the MTU size is
negotiated using L2CAP channel configuration procedures.
If the ATT_ERROR_RSP PDU is sent by the server with the Error Code parameter set
to Request Not Supported (0x06), the Attribute Opcode is not supported and the default
MTU shall be used.
Once the messages have been exchanged, the ATT_MTU shall be set to the minimum
of the Client Rx MTU and Server Rx MTU values.
Client Server
ATT_EXCHANGE_MTU_REQ (0x0200)
ATT_EXCHANGE_MTU_RSP (0x0032)
For example, in Figure 4.1, based on the exchanged ATT_MTU values, the ATT_MTU
would be 0x0032.
There are two sub-procedures that can be used for primary service discovery: Discover
All Primary Services and Discover Primary Service by Service UUID.
This sub-procedure is used by a client to discover all the primary services on a server.
Two possible responses can be sent from the server for the
ATT_READ_BY_GROUP_TYPE_REQ PDU: ATT_READ_BY_GROUP_TYPE_RSP
and ATT_ERROR_RSP PDUs.
This sub-procedure is complete when the ATT_ERROR_RSP PDU is received and the
Error Code parameter is set to Attribute Not Found (0x0A) or when the End Group
Handle in the Read by Type Group Response is 0xFFFF.
The sub-procedure may end early if a desired primary service is found prior to
discovering all the primary services on the server.
The service declaration described in Section 3.1 specifies that the service declaration
is readable and requires no authentication or authorization, therefore insufficient
authentication or read not permitted errors shall not occur.
Client Server
Two possible responses can be sent from the server for the
ATT_FIND_BY_TYPE_VALUE_REQ PDU: ATT_FIND_BY_TYPE_VALUE_RSP and
ATT_ERROR_RSP PDUs.
This sub-procedure is complete when the ATT_ERROR_RSP PDU is received and the
Error Code parameter is set to Attribute Not Found (0x0A) or when the End Group
Handle in the ATT_FIND_BY_TYPE_VALUE_RSP PDU is 0xFFFF.
The sub-procedure may end early if a desired primary service is found prior to
discovering all the primary services of the specified service UUID supported on the
server.
The service declaration described in Section 3.1 specifies that the service declaration
is readable and requires no authentication or authorization, therefore insufficient
authentication or read not permitted errors shall not occur.
Client Server
There is one sub-procedure that can be used for relationship discovery: Find Included
Services.
The ATT_READ_BY_TYPE_REQ PDU shall be used with the Attribute Type parameter
set to the UUID for «Include» The Starting Handle shall be set to the starting handle
of the specified service and the Ending Handle shall be set to the ending handle of
the specified service. The sub-procedure may end early if a desired included service is
found prior to discovering all the included services of the specified service supported on
the server.
To get the included service UUID when the included service uses a 128-bit UUID, the
ATT_READ_REQ PDU is used. The Attribute Handle for the ATT_READ_REQ PDU is
the Attribute Handle of the included service.
The include declaration described in Section 3.2 specifies that the include declaration
is readable and requires no authentication or authorization, therefore insufficient
authentication or read not permitted errors shall not occur.
Client Server
ATT_READ_REQ («0x0550»)
ATT_READ_RSP («UUID2»)
There are two sub-procedures that can be used for characteristic discovery: Discover
All Characteristics of a Service and Discover Characteristics by UUID.
This sub-procedure is used by a client to find all the characteristic declarations within a
service definition on a server when only the service handle range is known. The service
specified is identified by the service handle range.
The ATT_READ_BY_TYPE_REQ PDU shall be used with the Attribute Type parameter
set to the UUID for «Characteristic» The Starting Handle shall be set to starting handle
of the specified service and the Ending Handle shall be set to the ending handle of the
specified service.
Handle is the handle for the characteristic declaration. The Attribute Value is the
Characteristic Properties, Characteristic Value Handle and Characteristic UUID. The
ATT_READ_BY_TYPE_REQ PDU shall be issued again with the Starting Handle set to
one greater than the last Attribute Handle in the ATT_READ_BY_TYPE_RSP PDU.
The sub-procedure may end early if a desired characteristic is found prior to discovering
all the characteristics of the specified service supported on the server.
Note: The characteristic declaration described in Section 3.3 specifies that the
characteristic declaration is readable and requires no authentication or authorization,
therefore insufficient authentication or read not permitted errors should not occur.
Client Server
If they were 128 bits (16 octets) then the ATT_READ_BY_TYPE_RSP PDU data would
instead be:
If the ATT_ERROR_RSP PDU is sent by the server with the Error Code parameter set
to Attribute Not Found (0x0A), the characteristic does not exist on the server within the
handle range provided.
The sub-procedure may end early if a desired characteristic is found prior to discovering
all the characteristics for the specified service supported on the server.
The characteristic declaration described in Section 3.3 specifies that the characteristic
declaration is readable and requires no authentication or authorization, therefore
insufficient authentication or read not permitted errors shall not occur.
Client Server
There is one sub-procedure that can be used for characteristic descriptor discovery:
Discover All Characteristic Descriptors.
The ATT_FIND_INFORMATION_REQ PDU shall be used with the Starting Handle set
to the handle of the specified characteristic value + 1 and the Ending Handle set to the
ending handle of the specified characteristic.
Two possible responses can be sent from the server for the
ATT_FIND_INFORMATION_REQ PDU: ATT_FIND_INFORMATION_RSP and
ATT_ERROR_RSP PDUs.
The sub-procedure may end early if a desired Characteristic Descriptor is found prior to
discovering all the characteristic descriptors of the specified characteristic.
Client Server
This sub-procedure is used to read a Characteristic Value from a server when the
client knows the Characteristic Value Handle. The ATT_READ_REQ PDU is used
with the Attribute Handle parameter set to the Characteristic Value Handle. The
ATT_READ_RSP PDU returns the Characteristic Value in the Attribute Value parameter.
The ATT_READ_RSP PDU only contains the complete Characteristic Value if that is
less than or equal to (ATT_MTU – 1) octets in length. If the Characteristic Value is
greater than (ATT_MTU – 1) octets in length, the ATT_READ_RSP PDU only contains
the first portion of the Characteristic Value and the Read Long Characteristic Value
procedure may be used if the rest is required.
Client Server
ATT_READ_REQ (0x0002)
This sub-procedure is used to read a Characteristic Value from a server when the client
only knows the characteristic UUID and does not know the handle of the characteristic.
If the ATT_ERROR_RSP PDU is sent by the server with the Error Code parameter set
to Attribute Not Found (0x0A), the characteristic does not exist on the server within the
handle range provided.
Client Server
This sub-procedure is used to read a Characteristic Value from a server when the client
knows the Characteristic Value Handle and the length of the Characteristic Value is
longer than can be sent in a single ATT_READ_RSP PDU.
Note: The ATT_READ_BLOB_REQ PDU with zero offset may be used to read the first
part of the value of the Attribute.
Client Server
ATT_READ_REQ (0x0003)
ATT_READ_BLOB_RSP ("te")
This sub-procedure is used to read multiple Characteristic Values from a server when
the client knows the Characteristic Value Handles. The ATT_READ_MULTIPLE_REQ
PDU is used with the Set Of Handles parameter set to the Characteristic Value Handles.
The ATT_READ_MULTIPLE_RSP PDU returns the Characteristic Values in the Set Of
Values parameter.
Note: A client should not request multiple Characteristic Values when the response’s
Set Of Values parameter is equal to (ATT_MTU – 1) octets in length since it is
not possible to determine if the last Characteristic Value was read or additional
Characteristic Values exist but were truncated.
Refer to the Attribute Protocol specification for the format of the Set Of Handles and Set
Of Values parameter.
Client Server
Refer to the Attribute Protocol specification for the format of the Set Of Handles and
Length Value Tuple List parameter.
Client Server
There are five sub-procedures that can be used to write a Characteristic Value: Write
Without Response, Signed Write Without Response, Write Characteristic Value, Write
Long Characteristic Value and Characteristic Value Reliable Writes.
The ATT_WRITE_CMD PDU is used for this sub-procedure. The Attribute Handle
parameter shall be set to the Characteristic Value Handle. The Attribute Value
parameter shall be set to the new Characteristic Value.
If the Characteristic Value write request is too long (see [Vol 3] Part F, Section 3.4.5.1)
or has an invalid value as defined by the profile, then the write shall not succeed and no
error shall be generated by the server.
Client Server
This sub-procedure is used to write a Characteristic Value to a server when the client
knows the Characteristic Value Handle and the ATT bearer is not encrypted. This
sub-procedure shall only be used if the Characteristic Properties authenticated bit is
enabled and the client and server device share a bond as defined in [Vol 3] Part C,
Generic Access Profile.
This sub-procedure only writes the first (ATT_MTU – 15) octets of an Attribute Value.
This sub-procedure cannot be used to write a long Attribute.
parameter shall be set to the new Characteristic Value authenticated by signing the
value, as defined in the Security Manager [Vol 3] Part H, Section 2.4.5.
If the authenticated Characteristic Value that is written is too long (see [Vol 3] Part F,
Section 3.4.5.4), has an invalid value as defined by the profile, or the signed value
does not authenticate the client, then the write shall not succeed and no error shall be
generated by the server.
On BR/EDR, the ATT bearer is always encrypted, due to the use of Security Mode 4,
therefore this sub-procedure shall not be used.
Client Server
The ATT_WRITE_REQ PDU is used to for this sub-procedure. The Attribute Handle
parameter shall be set to the Characteristic Value Handle. The Attribute Value
parameter shall be set to the new characteristic.
An ATT_WRITE_RSP PDU shall be sent by the server if the write of the Characteristic
Value succeeded.
Client Server
ATT_WRITE_RSP ()
This sub-procedure is used to write a Characteristic Value to a server when the client
knows the Characteristic Value Handle but the length of the Characteristic Value is
longer than can be sent in a single ATT_WRITE_REQ PDU.
Client Server
ATT_EXECUTE_WRITE_REQ (0x01)
ATT_EXECUTE_WRITE_RSP ()
This sub-procedure is used to write a Characteristic Value to a server when the client
knows the Characteristic Value Handle, and assurance is required that the correct
Characteristic Value is going to be written by transferring the Characteristic Value to be
written in both directions before the write is performed. A higher-layer protocol can also
use this sub-procedure to write multiple values in order in a single operation.
The sub-procedure has two phases; the first phase prepares the Characteristic Values
to be written. To do this, the client transfers the Characteristic Values to the server.
The server checks the validity of the Characteristic Values. The client also checks each
Characteristic Value to verify it was correctly received by the server using the server
responses. Once this is complete, the second phase performs the execution of all of the
prepared Characteristic Value writes on the server from this client.
In the first phase, the ATT_PREPARE_WRITE_REQ PDU is used. The Attribute Handle
shall be set to the Characteristic Value Handle that is to be prepared to write. The Value
Offset and Part Attribute Value parameter shall be set to the new Characteristic Value.
Two possible responses can be sent from the server for the ATT_PREPARE_WRITE_-
REQ PDU: ATT_PREPARE_WRITE_RSP and ATT_ERROR_RSP PDUs.
If the number of prepared write requests exceeds the number of prepared writes
supported, then an ATT_ERROR_RSP PDU with the Error Code parameter set to
Prepare Queue Full (0x09) shall be sent by the server.
If a Characteristic Value is prepared two or more times during this sub-procedure, then
all prepared values are written to the same Characteristic Value in the order that they
were prepared.
Client Server
ATT_EXECUTE_WRITE_REQ (0x01)
ATT_EXECUTE_WRITE_RSP ()
Client Server
Client Server
4.11.1 Indication
Client Server
ATT_HANDLE_VALUE_CFM ()
This sub-procedure is used to read a characteristic descriptor from a server when the
client knows the characteristic descriptor declaration’s Attribute handle.
The ATT_READ_REQ PDU is used for this sub-procedure. The ATT_READ_REQ PDU
is used with the Attribute Handle parameter set to the characteristic descriptor handle.
The ATT_READ_RSP PDU returns the characteristic descriptor value in the Attribute
Value parameter.
Client Server
ATT_READ_REQ (0x0206)
Client Server
ATT_READ_BLOB_RSP ("te")
Client Server
ATT_READ_REQ (0x0214)
ATT_READ_BLOB_RSP ("umidity")
Figure 4.23: Read Long Characteristic Descriptor (following simple read) example
The ATT_WRITE_REQ PDU is used for this sub-procedure. The Attribute Handle
parameter shall be set to the characteristic descriptor handle. The Attribute Value
parameter shall be set to the new characteristic descriptor value.
An ATT_WRITE_RSP PDU shall be sent by the server if the write of the characteristic
descriptor value succeeded.
Client Server
ATT_WRITE_RSP ()
client, or if a write operation is not permitted on the Characteristic Value. The Error
Code parameter is set as specified in the Attribute Protocol. If the Attribute Value that is
written is the wrong size, or has an invalid value as defined by the profile, then the write
shall not succeed and an ATT_ERROR_RSP PDU shall be sent with the Error Code
parameter set to Application Error (0x80 – 0x9F) by the server.
Client Server
ATT_EXECUTE_WRITE_REQ (0x01)
ATT_EXECUTE_WRITE_RSP ()
If the Attribute Protocol transaction times out, the procedure shall be considered to have
failed, and the local higher layer shall be notified. No further GATT procedures shall
be performed on that ATT bearer. A new GATT procedure shall only be performed on
another ATT bearer.
The following default values shall be used by an implementation of this profile. The
default values used may be different depending on the physical channel that the
Attribute Protocol is being sent over.
5.1.1 ATT_MTU
At the end of the L2CAP configuration phase, upon transition to the OPEN state, the
ATT_MTU for this ATT bearer shall be set to the minimum of the negotiated Maximum
Transmission Unit configuration options.
Note: The minimum ATT_MTU for BR/EDR is 48 octets, as defined by L2CAP in [Vol 3]
Part A, Section 5.1.
All Attribute Protocol messages sent by GATT over an L2CAP channel are sent using a
dynamic channel ID derived by connecting using a fixed PSM. The use of a fixed PSM
allows rapid reconnection of the L2CAP channel for Attribute Protocol as a preliminary
SDP query is not required.
The flow specification for the Attribute Protocol shall be best effort.
If operating in Basic L2CAP mode, the information payload of the L2CAP B-frame shall
be a single Attribute PDU.
5.2.1 ATT_MTU
Both GATT Client and GATT Server implementations shall support an ATT_MTU not
less than the default value.
L2CAP fixed CID 0x0004 shall be used for the Attribute Protocol. All packets sent on
this fixed channel shall be Attribute Protocol PDUs.
The flow specification for the Attribute Protocol shall be best effort.
The retransmission and flow control mode for this channel shall be Basic L2CAP mode
The default parameters for the payload of the L2CAP B-frame shall be a single Attribute
PDU.
Parameter Value
MTU 23
Flush Timeout 0xFFFF (Infinite)
QoS Best Effort
Mode Basic Mode
In both cases, the EATT fixed PSM [1] is used and the ATT bearer is the established
L2CAP connection-oriented channel.
5.3.1 ATT_MTU
All Attribute Protocol messages sent by GATT over an L2CAP Enhanced Credit Based
Flow Control mode channel are sent using one of the dynamic channel IDs derived by
connecting using a fixed PSM.
The flow specification for the Attribute Protocol shall be best effort.
The information payload of the L2CAP K-frame shall be a single Attribute PDU.
Note: A GATT implementation supporting bearers over both BR/EDR and LE therefore
may support any combination of bearers provided that it supports Unenhanced ATT
bearers over LE and at least one type of ATT bearer over BR/EDR.
To establish an Enhanced ATT bearer, the Section 5.3 procedure shall be used with
the fixed PSM set to EATT. A device shall not attempt to establish an Enhanced
ATT bearer with a peer unless it is aware that the peer supports Enhanced ATT
bearers, for example by using an out of band method, via a higher layer protocol, or
because the device has checked the peer’s Server Supported Features characteristic
(see Section 7.4) or its SDP record.
To establish an Enhanced ATT bearer, the Section 5.3 procedure shall be used with the
fixed PSM set to EATT.
Note: Unlike BR/EDR, it is not necessary to check the Server Supported Features
characteristic before attempting to establish an Enhanced ATT bearer.
This profile can be used in the following profile roles (as defined in [Vol 3] Part C,
Section 2.2.2):
• Central
• Peripheral
If a client has configured the server to send a notification or indication to the client, it
shall be configured to allow re-establishment of the connection when it is disconnected.
If the client is disconnected, but intends to become a Central in the connection it shall
perform a GAP connection establishment procedure. If the client is disconnected, but
intends to become a Peripheral in the connection it shall go into a GAP connectable
mode.
A server shall re-establish a connection with a client when an event or trigger operation
causes a notification or indication to a client.
If the server cannot re-establish a connection, then the notification or indication for this
event shall be discarded and no further connection re-establishment shall occur, until
another event occurs.
All characteristics defined within this section shall be contained in a primary service with
the service UUID set to «GATT Service» as defined in Section 3.1. Only one instance of
the GATT service shall be exposed on a GATT Server.
Table 7.1 lists characteristics that may be present in the server and the characteristics
that may be supported by the client.
The assigned UUIDs for these characteristics are defined in Assigned Numbers [1].
The Service Changed Characteristic Value is two 16-bit Attribute Handles concatenated
together indicating the beginning and ending Attribute Handles affected by an addition,
removal, or modification to a GATT-based service on the server. A change to a
characteristic value is not considered a modification of the service. If a change has
been made to any of the GATT service definition characteristic values other than the
Service Changed characteristic value and the Client Supported Features characteristic
value, the range shall also include the beginning and ending Attribute Handle for the
GATT service definition.
There shall be only one instance of the Service Changed characteristic within the GATT
service definition. A Service Changed characteristic value shall exist for each client with
a trusted relationship.
If the list of GATT based services and the service definitions cannot change for the
lifetime of the device then this characteristic shall not exist, otherwise this characteristic
shall exist.
If the Service Changed characteristic exists on the server, the Characteristic Value
Indication support on the server is mandatory.
The client shall support Characteristic Value Indication of the Service Changed
characteristic.
The Service Changed characteristic Attribute Handle on the server shall not change if
the server has a trusted relationship with any client.
client may update the Client Supported Features bit field. If a client feature bit is set
by a client and the server supports that feature, the server shall fulfill all requirements
associated with this feature when communicating with this client. If a client feature bit is
not set by a client, then the server shall not use any of the features associated with that
bit when communicating with this client.
The format of the Client Supported Features characteristic is defined in Table 7.5.
The Client Supported Features characteristic value is an array of octets, each of which
is a bit field. The allocation of these bits is specified in Table 7.6. All bits not listed are
reserved for future use. The array should not have any trailing all-zero octets.
If any octet number in Table 7.6 does not appear in the attribute value because it is too
short, the server shall behave as if that octet were present with a value of zero.
The default value for the Client Supported Features characteristic value shall be all bits
set to zero.
There shall be only one instance of the Client Supported Features characteristic within
the GATT service definition.
A Client Supported Features characteristic value shall exist for each connected client.
For clients with a trusted relationship, the characteristic value shall be persistent across
connections. For clients without a trusted relationship the characteristic value shall be
set to the default value at each connection.
The Attribute Handle of the Client Supported Features characteristic on the server shall
not change during a connection or if the server has a trusted relationship with any client.
A client shall not clear any bits it has set. The server shall respond to any such request
with the Error Code parameter set to Value Not Allowed (0x13).
The Database Hash characteristic contains the result of a hash function applied to the
service definitions in the GATT database. The client may read the characteristic at any
time to determine if services have been added, removed, or modified. If any of the input
fields to the hash function (as listed in Section 7.3.1) have changed, the server shall
calculate a new Database Hash and update the characteristic value.
The characteristic value is a 128-bit unsigned integer number. The calculation of the
Database Hash is specified in Section 7.3.1.
There is only one instance of the Database Hash characteristic within the GATT service
definition. The same Database Hash value is used for all clients, whether a trusted
relationship exists or not.
In order to read the value of this characteristic the client shall always use the GATT
Read Using Characteristic UUID sub-procedure. The Starting Handle should be set to
0x0001 and the Ending Handle should be set to 0xFFFF.
If a client reads the value of this characteristic while the server is re-calculating the hash
following a change to the database, the server shall return the new hash, delaying its
response until it is available.
The Database Hash shall be calculated according to RFC-4493[2]. This RFC defines
the Cipher-based Message Authentication Code (CMAC) using AES-128 as the block
cipher function, also known as AES-CMAC.
The formats of the fields Attribute Handle, Attribute Type, and Attribute Value for
the Attribute Types listed above are defined in Section 3 (Service Interoperability
Requirements).
If the length of m is not a multiple of the AES-CMAC block length of 128 bits, padding
shall be applied as specified in RFC-4493 Section 2.4.
If any octet number in Table 7.11 does not appear in the attribute value because it is too
short, the client shall behave as if that octet were present with the value of zero.
There shall be only one instance of the Server Supported Features characteristic within
the GATT service definition.
8 SECURITY CONSIDERATIONS
The GATT Profile procedures are used to access information that may require the client
to be authenticated and have an encrypted connection before a characteristic can be
read or written.
If such a request is issued when the physical link is unauthenticated or unencrypted, the
server shall send an ATT_ERROR_RSP PDU. The client wanting to read or write this
characteristic can then request that the physical link be authenticated using the GAP
authentication procedure, and once this has been completed, send the request again.
The list of services and characteristics that a device supports is not considered private
or confidential information, and therefore the Service and Characteristic Discovery
procedures shall always be permitted. This implies that an Error Code parameter set
to Insufficient Authentication (0x05) shall not be used in an ATT_ERROR_RSP PDU for
a Find Information Request.
Note: A characteristic may be allowed to be read by any device, but only written by an
authenticated device. An implementation should take this into account, and not assume
that if it can read a Characteristic Value, it will also be able to write the Characteristic
Value. Similarly, if a characteristic can be written, it does not mean the characteristic
can also be read. Each individual characteristic could have different security properties.
Once sufficient authentication of the client has been established to allow access
to one characteristic within a service definition, a server may also allow access to
other characteristics within the service definition depending on the higher level or
implementation specific requirements.
A server may allow access to most characteristics within a service definition once
sufficient authentication has been performed, but restrict access to other characteristics
within the same service definition. This may result due to some characteristics requiring
stronger authentication requirements than currently enabled.
The GATT Profile can be used to access information that may require authorization
before a characteristic can be read or written.
Once a server has authorized a client for access to characteristics in one group or
service definition, it may automatically allow access to characteristics in other service
definitions.
A device that supports GATT over BR/EDR and only one of ATT or EATT shall publish
the SDP record shown in Table 9.1; if both ATT and EATT are supported, the device
shall publish the SDP record shown in Table 9.2. The GATT Service Start Handle shall
be set to the attribute handle of the «GATT Service» service declaration. The GATT
Service End Handle shall be set to the attribute handle of the last attribute within the
«GATT Service» service definition group.
Table 9.1: SDP record for the Generic Attribute Profile, if only one of ATT or EATT is supported
Table 9.2: SDP record for the Generic Attribute Profile, if both ATT and EATT are supported
10 REFERENCES
Table A.1 shows an example ATT Server and the attributes contained on the server.
Note: This example does not necessarily use UUIDs or services defined by the
Bluetooth SIG or in adopted profiles.
As can be seen, the ATT Server indicates support for ten services: GAP Service, GATT
Service, Battery State Service, Thermometer Humidity Service, Weight Service, Position
Service, Alert Service, two Manufacturer Services, and a Vendor Specific Service.
The server contains the following information about each of the services:
• The characteristic containing the battery state with a value of 0x04, meaning it is
discharging.
• The characteristic containing the outside temperature with a value of 6.5 °C.
• The characteristic containing the outside relative humidity with a value of 39%.
• The characteristic containing the weight hanging off the device with a value of 21.89
kg.
• The characteristic containing the position of this device with the value of 68.3585444
degrees north, 18.7830222 degrees east, with an elevation of 374 meters.
• The characteristic containing the temperature sensor manufacturer with the value of
ACME Temperature Sensor.
• The characteristic containing the serial number for the temperature sensor with a
value of 237495-3282-A.
• The characteristic containing the weighing sensor is manufacturer with a value of
ACME Weight Scales.
• The characteristic containing the serial number for the weighing sensor with a value
of 11267-2327A00239.
The device is therefore on the side of the Abisko Turiststation, Norrbottens Län,
Sweden, with a battery in good state, measuring a relatively warm day, with low
humidity, and a heavy rucksack.
Table B.1 shows how the variable length data m for calculating the Database Hash is
constructed from an example GATT database. The column Included in Hash indicates
whether the Attribute Handle (H), Attribute Type (T), or Attribute Value (V) are included
in m.
Note: The bytes in M0 to M6 and the Database Hash are ordered from the most
significant on the left to the least significant on the right.
SECURITY MANAGER
SPECIFICATION
CONTENTS
1 INTRODUCTION
1.1 Scope
The Security Manager defines methods of pairing and key distribution, a protocol for
those methods and a security toolbox to be used by those methods and other parts of
an LE-only or BR/EDR/LE device.
GAP
SM ATT
L2CAP
Figure 1.1: Relationship of the Security Manager to the rest of the LE Bluetooth architecture
The document describes Central and Peripheral roles in terms of protocol and
requirements; these have the same meaning and are mapped to the LE device roles
described in [Vol 1] Part A, Section 1.2 or BR/EDR device roles (see [Vol 1] Part A,
Section 1.1).
1.2 Conventions
1.2.1 Bit and byte ordering conventions
When multiple bit fields are contained in a single octet and represented in a drawing
in this Part, the least significant (low-order) bits are shown toward the left and most
significant (high-order) bits toward the right.
Multiple-octet fields are drawn with the least significant octets toward the left and the
most significant octets toward the right. Multiple-octet fields shall be transmitted with the
least significant octet first.
Multiple-octet values written in hexadecimal notation have the most significant octet
towards the left and the least significant octet towards the right, for example if ‘12’ is the
most significant octet and ‘34’ is the least significant octet it would be written as 0x1234.
2 SECURITY MANAGER
2.1 Introduction
The Security Manager (SM) uses a key distribution approach to perform identity
and encryption functionalities in radio communication. This means that each device
generates and controls the keys it distributes and no other device affects the generation
of these keys. The strength of a key is as strong as the algorithms implemented inside
the distributing device.
The security architecture is designed such that memory and processing requirements
for a responding device are lower than the memory and processing requirement for an
initiating device.
Pairing is performed to establish keys which can then be used to encrypt a link. A
transport-specific key distribution is then performed to share the keys, which can be
used to encrypt a link in future reconnections, to verify signed data, and to resolve
private addresses.
Pairing is a three-phase process. The first two phases are always used and may be
followed by an optional transport specific key distribution phase (see Figure 2.1):
Initiator Responder
(Optional) Security_Request
Pairing_Request
Pairing_Response
Key Distribution
Key Distribution
Key Distribution
The devices shall first exchange authentication requirements and IO capabilities in the
Pairing Feature Exchange to determine which of the following methods shall be used in
Phase 2:
• Just Works
• Numeric Comparison (Only for LE Secure Connections)
• Passkey Entry
• Out Of Band (OOB)
Optionally, Phase 3 may then be performed to distribute transport specific keys, for
example the Identity Resolving Key (IRK) value and Identity Address information. Phase
1 and Phase 3 are identical regardless of the method used in Phase 2.
Phase 1 and Phase 2 may be performed on a link which is either encrypted or not
encrypted.
• ah is used to create a 24-bit hash used in random address creation and resolution.
The following cryptographic functions are defined to support the LE legacy pairing
process:
The following cryptographic functions are defined to support the LE Secure Connections
pairing process:
The building block for the cryptographic functions ah, c1 and s1 is the security function
e.
The building block for the cryptographic functions f4, f5, f6, g2, h6, and h7 is the security
function AES-CMAC.
Inside the f4, f5, f6, g2, h6, and h7 functions when a multi-octet integer parameter is
used as input to AES-CMAC the most significant octet of the integer shall be the first
octet of the stream and the least significant octet of the integer shall be the last octet
of the stream. The output of AES-CMAC inside these functions is a multi-octet integer
where the first octet is MSB and the last octet is LSB of this integer.
Security function e generates 128-bit encryptedData from a 128-bit key and 128-bit
plaintextData using the AES-128-bit block cypher as defined in FIPS-1971:
The most significant octet of key corresponds to key[0], the most significant octet
of plaintextData corresponds to in[0] and the most significant octet of encryptedData
corresponds to out[0] using the notation specified in FIPS-1971.
The random address hash function ah is used to generate a hash value that is used in
resolvable private addresses, see [Vol 3] Part C, Section 10.8.2.
The following are inputs to the random address hash function ah:
k is 128 bits
r is 24 bits
padding is 104 bits
r is concatenated with padding to generate r' which is used as the 128-bit input
parameter plaintextData to security function e:
r’ = padding || r
The least significant octet of r becomes the least significant octet of r’ and the most
significant octet of padding becomes the most significant octet of r’.
The output of the security function e is then truncated to 24 bits by taking the least
significant 24 bits of the output of e as the result of ah.
During the LE legacy pairing process confirm values are exchanged. This confirm value
generation function c1 is used to generate the confirm values.
The following are inputs to the confirm value generation function c1:
k is 128 bits
r is 128 bits
pres is 56 bits
preq is 56 bits
iat is 1 bit
ia is 48 bits
rat is 1 bit
ra is 48 bits
padding is 32 zero bits
iat is concatenated with 7 zero bits to create iat’ which is 8 bits in length. iat is the least
significant bit of iat’.
rat is concatenated with 7 zero bits to create rat’ which is 8 bits in length. rat is the least
significant bit of rat’.
pres, preq, rat’ and iat’ are concatenated to generate p1 which is XORed with r and
used as 128-bit input parameter plaintextData to security function e:
The octet of iat’ becomes the least significant octet of p1 and the most significant octet
of pres becomes the most significant octet of p1.
For example, if the 8-bit iat’ is 0x01, the 8-bit rat’ is 0x00, the 56-bit preq
is 0x07071000000101 and the 56 bit pres is 0x05000800000302 then p1 is
0x05000800000302070710000001010001.
ra is concatenated with ia and padding to generate p2 which is XORed with the result of
the security function e using p1 as the input parameter plaintextData and is then used
as the 128-bit input parameter plaintextData to security function e:
p2 = padding || ia || ra
The least significant octet of ra becomes the least significant octet of p2 and the most
significant octet of padding becomes the most significant octet of p2.
c1 (k, r, preq, pres, iat, rat, ia, ra) = e(k, e(k, r ⊕ p1) ⊕ p2)
The 128-bit output of the security function e is used as the result of confirm value
generation function c1.
The key generation function s1 is used to generate the STK during the LE legacy
pairing process.
k is 128 bits
r1 is 128 bits
r2 is 128 bits
The most significant 64-bits of r1 are discarded to generate r1’ and the most significant
64-bits of r2 are discarded to generate r2’.
r1’ is concatenated with r2’ to generate r’ which is used as the 128-bit input parameter
plaintextData to security function e:
r’ = r1’ || r2’
The least significant octet of r2’ becomes the least significant octet of r’ and the most
significant octet of r1’ becomes the most significant octet of r’.
The 128-bit output of the security function e is used as the result of key generation
function s1.
0x00000000000000000000000000000000
0x112233445566778899AABBCCDDEEFF00
0x9a1fe1f0e8b0f49b5b4216ae796da062.
RFC-44931 defines the Cipher-based Message Authentication Code (CMAC) that uses
AES-128 as the block cipher function, also known as AES-CMAC.
MAC = AES-CMACk(m)
A device can implement AES functions in the Host or can use the HCI_LE_Encrypt
command (see [Vol 4] Part E, Section 7.8.22) in order to use the AES function in the
Controller.
During the LE Secure Connections pairing process, confirm values are exchanged.
These confirm values are computed using the confirm value generation function f4.
This confirm value generation function makes use of the MAC function AES-CMACX,
with a 128-bit key X.
U is 256 bits
V is 256 bits
1http://www.ietf.org/rfc/rfc4493.txt
2RFC4493 uses the notation MAC = AES-CMAC(k,m) where k is the key. This is functionally the same as the
notation used in this specification MAC = AES-CMACk(m)
X is 128 bits
Z is 8 bits
Z is zero (i.e. 8 bits of zeros) for Numeric Comparison and OOB protocol. In the
Passkey Entry protocol, the most significant bit of Z is set equal to one and the least
significant bit is made up from one bit of the passkey e.g. if the passkey bit is 1, then Z =
0x81 and if the passkey bit is 0, then Z = 0x80.
U, V and Z are concatenated and used as input m to the function AES-CMAC and X is
used as the key k.
Nai is the nonce value of ith round. For each round Nai value is a new 128-bit number.
Similarly, rai is a one bit value of the passkey expanded to 8 bits (either 0x80 or 0x81).
Na and Nb are nonces from Devices A and B. ra and rb are random values generated
by devices A and B.
f4(U, V, X, Z) = AES-CMACX (U || V || Z)
The least significant octet of Z becomes the least significant octet of the AES-CMAC
input message m and the most significant octet of U becomes the most significant octet
of the AES-CMAC input message m.
The definition of this key generation function makes use of the MAC function AES-
CMACT with a 128-bit key T.
W is 256 bits
N1 is 128 bits
N2 is 128 bits
A1 is 56 bits
A2 is 56 bits
T = AES-CMACSALT (W)
0x6C888391_AAF5A538_60370BDB_5A6083BE
Counter, keyID, N1, N2, A1, A2, and Length are concatenated and used as input m to
the function AES-CMAC and T is used as the key k.
The least significant octet of Length becomes the least significant octet of the AES-
CMAC input message m and the most significant octet of Counter becomes the most
significant octet of the AES-CMAC input message m.
Nc is whichever of N1 and N2 was generated by the Central and sent to the Peripheral;
Np is the other.
BD_ADDR_C is the device address of the Central and BD_ADDR_P is the device
address of the Peripheral. The device addresses are the values used during connection
setup. The least significant bit in the most significant octet in both BD_ADDR_C and
BD_ADDR_P is set to 1 if the address is a random address and set to 0 if the address
is a public address. The 7 most significant bits of the most significant octet in both
BD_ADDR_C and BD_ADDR_P are set to 0.
The LTK is the least significant 128 bits (Counter = 1) of f5. The MacKey (see
Section 2.2.8) is the most significant 128 bits (Counter = 0) of f5.
A device can implement Diffie-Hellman key generation in the Host or can use the
HCI_LE_Generate_DHKey command (see [Vol 4] Part E, Section 7.8.37) to generate
the key in the Controller.
Note: When using the HCI_LE_Generate_DHKey command, the device can only pair
one remote device at a time.
The definition of the f6 function makes use of the MAC function AES-CMACW with a
128-bit key W.
W is 128 bits
N1 is 128 bits
N2 is 128 bits
R is 128 bits
IOcap is 24 bits
A1 is 56 bits
A2 is 56 bits
N1, N2, R, IOcap, A1 and A2 are concatenated and used as input m to the function
AES-CMAC and W is used as the key k.
Na is the random number sent by the Central to the Peripheral and Nb is the random
number sent by the Peripheral to the Central.
IOcapA is the capabilities of the Central and IOcapB is the capabilities of the Peripheral.
IOcapA and IOcapB are both three octets with the most significant octet as the AuthReq
parameter, the middle octet as the OOB data flag and the least significant octet as the
IO capability parameter. The AuthReq, OOB data flag and IO capability parameters are
present in the Pairing Request and Pairing Response SMP packets.
In Passkey Entry, ra and rb are 6-digit passkey values expressed as a 128-bit integer.
For instance, if the 6-digit value of ra is 131313 then
ra = 0x 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 f1
A is the device address of the Central and B is the device address of the Peripheral.
The least significant bit in the most significant octet in both A and B is set to 1 if the
address is a random address and set to 0 if the address is a public address. The 7 most
significant bits of the most significant octet in both A and B are set to 0.
The least significant octet of A2 becomes the least significant octet of the AES-CMAC
input message m and the most significant octet of N1 becomes the most significant
octet of the AES-CMAC input message m.
The definition of g2 makes use of the MAC function AES-CMACX with 128-bit key X.
U is 256 bits
V is 256 bits
X is 128 bits
Y is 128 bits
U, V, and Y are concatenated and used as input m to the function AES-CMAC and X is
used as the key k.
The least significant octet of Y becomes the least significant octet of the AES-CMAC
input message m and the most significant octet of U becomes the most significant octet
of the AES-CMAC input message m.
The numeric verification value is taken as the six least significant digits of the 32-bit
integer g2(PKax, PKbx, Na, Nb) where PKax denotes the x-coordinate of the public key
PKa of A and PKbx denotes the x-coordinate of the public key PKb of B. Na and Nb are
nonces from devices A and B. The value is then converted to decimal numeric value.
The checksum used for numeric comparison is the least significant six digits.
The function h6 is used to convert keys of a given size from one key type to another key
type with equivalent strength.
The definition of the h6 function makes use of the hashing function AES-CMACW with
128-bit key W.
W is 128 bits
keyID is 32 bits
keyID is used as input m to the hashing function AES-CMAC and the most significant
128-bits of W are used as the key k (2.2.5).
The function h7 is used to convert keys of a given size from one key type to another key
type with equivalent strength.
The definition of the h7 function makes use of the hashing function AES-CMACSALT with
128-bit key SALT.
W is used as input m to the hashing function AES-CMAC and SALT is used as the key k
(2.2.5).
h7(SALT, W) = AES-CMACSALT(W)
1. Temporary Key (TK): a 128-bit temporary key used in the pairing process which is
used to generate STK (see Section 2.3.5.5).
2. Short Term Key (STK): a 128-bit temporary key used to encrypt a connection
following pairing.
1. Long Term Key (LTK): a 128-bit key used to encrypt the connection following
pairing and subsequent connections.
Authentication requirements are set by GAP, (see [Vol 3] Part C, Section 10.3).
The authentication requirements include the type of bonding and man-in-the-middle
protection (MITM) requirements.
The initiating device indicates to the responding device which transport specific keys it
would like to send to the responding device and which keys it would like the responding
device to send to the initiator. The responding device replies with the keys that the
initiating device shall send and the keys that the responding device shall send. The keys
that can be distributed are defined in Section 2.4.3. If the device receives a command
with invalid parameters, it shall respond with Pairing Failed command with the error
code “Invalid Parameters.”
LE Secure Connections pairing utilizes the P-256 elliptic curve (see [Vol 2] Part H,
Section 7.6).
Unauthenticated no MITM Protection does not have protection against MITM attacks.
For LE Legacy Pairing, none of the pairing methods provide protection against a
passive eavesdropper during the pairing process as predictable or easily established
values for TK are used. If the pairing information is distributed without an eavesdropper
being present then all the pairing methods provide confidentiality.
An initiating device shall maintain a record of the Security Properties for the distributed
keys in a security database.
A responding device may maintain a record of the distributed key sizes and Security
Properties for the distributed keys in a security database. Depending upon the key
generation method and negotiated key size a responding device may have to shorten
the key length (see Section 2.3.4) so that the initiator and responder are using identical
keys.
Security Properties of the key generated in phase 2 under which the keys are
distributed shall be stored in the security database.
2.3.2 IO capabilities
Input and output capabilities of a device are combined to generate its IO capabilities.
The input capabilities are described in Table 2.3. The output capabilities are described
in Table 2.4.
Capability Description
No input Device does not have the ability to indicate ‘yes’ or ‘no’
Yes / No Device has at least two buttons that can be easily mapped to 'yes' and 'no' or the device
has a mechanism whereby the user can indicate either 'yes' or 'no' (see note below).
Keyboard Device has a numeric keyboard that can input the numbers '0' to '9' and a confirmation.
Device also has at least two buttons that can be easily mapped to 'yes' and 'no' or the
device has a mechanism whereby the user can indicate either 'yes' or 'no' (see note
below).
Table 2.3: User input capabilities
Note: 'yes' could be indicated by pressing a button within a certain time limit otherwise
'no' would be assumed.
Capability Description
No output Device does not have the ability to display or communicate a 6 digit decimal number
Numeric output Device has the ability to display or communicate a 6 digit decimal number
Table 2.4: User output capabilities
The individual input and output capabilities are mapped to a single IO capability for
that device which is used in the pairing feature exchange. The mapping is described in
Table 2.5.
1None of the pairing algorithms can use Yes/No input and no output, therefore NoInputNoOutput is used as
the resulting IO capability.
The OOB data flag shall be set if a device has the peer device's out of band
authentication data. A device uses the peer device's out of band authentication data
to authenticate the peer device. In LE legacy pairing, the out of band method is used if
both the devices have the other device's out of band authentication data available. In LE
Secure Connections pairing, the out of band method is used if at least one device has
the peer device's out of band authentication data available.
Each device shall have maximum and minimum encryption key length parameters
which defines the maximum and minimum size of the encryption key allowed in octets.
The maximum and minimum encryption key length parameters shall be between 7
octets (56 bits) and 16 octets (128 bits), in 1 octet (8 bit) steps. This is defined by a
profile or device application.
The shorter of the initiating and responding devices’ maximum encryption key length
parameters shall be used as the encryption key size.
Both the initiating and responding devices shall check that the resultant encryption key
size is not shorter than the minimum key size parameter for that device and if it is, the
device shall send the Pairing Failed command with error code “Encryption Key Size”.
The encryption key size may be stored so it can be checked by any service that has
minimum encryption key length requirements.
If a key has an encryption key size that is shorter than 16 octets (128 bits), it shall be
created by masking the appropriate number of most significant octets of the generated
key to provide a resulting key that has the agreed encryption key size. The key shall
be masked after generation and, if required, after the key is used to derive a BR/EDR
link key. The key shall be masked before the key is distributed, used for encryption, or
stored.
0x12345678_9ABCDEF0_12345678_9ABCDEF0
0x00000000_00000000_00345678_9ABCDEF0.
The information exchanged in Phase 1 is used to select which key generation method is
used in Phase 2.
When LE legacy pairing is used, the pairing is performed by each device generating
a Temporary Key (TK). The method to generate TK depends upon the pairing method
chosen using the algorithm described in Section 2.3.5.1. If Just Works is used then
TK shall be generated as defined in Section 2.3.5.2. If Passkey Entry is used then
TK shall be generated as defined in Section 2.3.5.3. If Out Of Band is used then TK
shall be generated as defined in Section 2.3.5.4. The TK value shall be used in the
authentication mechanism defined in Section 2.3.5.5 to generate the STK and encrypt
the link.
If both devices have not set the MITM option in the Authentication Requirements Flags,
then the IO capabilities shall be ignored and the Just Works association model shall be
used.
In LE legacy pairing, if both devices have Out of Band authentication data, then the
Authentication Requirements Flags shall be ignored when selecting the pairing method
and the Out of Band pairing method shall be used. Otherwise, the IO capabilities of the
device shall be used to determine the pairing method as defined in Table 2.8.
Table 2.6 defines the STK generation method when at least one of the devices does not
support LE Secure Connections.
Initiator
OOB Set OOB Not Set
MITM Set MITM Not MITM Set MITM Not Set
Set
OOB Set MITM Set Use OOB Use OOB Use IO Capabili- Use IO Capabil-
ties ities
MITM Not Use OOB Use OOB Use IO Capabili- Use Just Works
Responder
Set ties
OOB Not MITM Set Use IO Capa- Use IO Capa- Use IO Capabili- Use IO Capabil-
Set bilities bilities ties ities
MITM Not Use IO Capa- Use Just Use IO Capabili- Use Just Works
Set bilities Works ties
Table 2.6: Rules for using Out-of-Band and MITM flags for LE legacy pairing
Table 2.7 defines the LTK generation method when both devices support LE Secure
Connections.
Initiator
OOB Set OOB Not Set
MITM Set MITM Not MITM Set MITM Not Set
Set
OOB Set MITM Set Use OOB Use OOB Use OOB Use OOB
MITM Not Use OOB Use OOB Use OOB Use OOB
Responder
Set
OOB Not MITM Set Use OOB Use OOB Use IO Capabili- Use IO Capabili-
Set ties ties
MITM Not Use OOB Use OOB Use IO Capabili- Use Just Works
Set ties
Table 2.7: Rules for using Out-of-Band and MITM flags for LE Secure Connections pairing
Initiator
Responder DisplayOnly Keyboard Keyboard
Display Only NoInput Display
YesNo NoOutput
Display On- Just Works Just Works Passkey Entry: Just Works Passkey Entry:
ly responder dis- responder dis-
Unauthenticated Unauthen- Unauthen-
plays, initiator plays, initiator
ticated ticated
inputs inputs
Authenticated Authenticated
Display Just Works Just Works Passkey Entry: Just Works Passkey Entry
YesNo (For LE Lega- responder dis- (For LE Legacy
Unauthenticated Unauthen-
cy Pairing) plays, initiator Pairing): res-
ticated
inputs ponder dis-
Unauthen-
plays, initiator
ticated Authenticated
inputs
Authenticated
Numeric Com- Numeric Com-
parison (For parison (For LE
LE Secure Secure Con-
Connections) nections)
Authenticated Authenticated
Keyboard Passkey Entry: Passkey Entry: Passkey Entry: Just Works Passkey Entry:
Only initiator dis- initiator dis- initiator and initiator dis-
Unauthen-
plays, respond- plays, res- responder in- plays, respond-
ticated
er inputs ponder inputs put er inputs
Authenticated Authenticated Authenticated Authenticated
Initiator
Responder DisplayOnly Keyboard Keyboard
Display Only NoInput Display
YesNo NoOutput
NoInput Just Works Just Works Just Works Just Works Just Works
NoOutput Unauthenticated Unauthen- Unauthen- Unauthen- Unauthen-
ticated ticated ticated ticated
Keyboard Passkey Entry: Passkey Entry Passkey Entry: Just Works Passkey Entry
Display initiator dis- (For LE Lega- responder dis- (For LE Legacy
Unauthen-
plays, respond- cy Pairing): plays, initiator Pairing):
ticated
er inputs inputs
initiator dis- initiator dis-
Authenticated plays, res- Authenticated plays, respond-
ponder inputs er inputs
Authenticated Authenticated
Numeric Com- Numeric Com-
parison (For parison (For LE
LE Secure Secure Con-
Connections) nections)
Authenticated Authenticated
The generated key will either be an Authenticated or Unauthenticated key. If the out
of band authentication method is used and the Out of Band mechanism is known to
be secure from eavesdropping the key is assumed to be Authenticated; however, the
exact strength depends upon the method used to transfer the out of band information.
If the Out of Band method is used and the Out of Band mechanism is not secure from
eavesdropping or the level of eavesdropping protection is unknown, the key shall be
Unauthenticated. The mapping of IO capabilities to an authenticated or unauthenticated
key is described in Table 2.8.
In LE legacy pairing, if the initiating device has Out of Band data and the responding
device does not have Out of Band data then the responding device may send the
Pairing Failed command with the error code “OOB Not Available” instead of the Pairing
Response command.
If the key generation method does not result in a key that provides sufficient Security
Properties (see Section 2.3.1) then the device shall send the Pairing Failed command
with the error code “Authentication Requirements”.
The Just Works STK generation method provides no protection against eavesdroppers
or man in the middle attacks during the pairing process. If the attacker is not present
during the pairing process then confidentiality can be established by using encryption on
a future connection.
Both devices set the TK value used in the authentication mechanism defined in
Section 2.3.5.5 to zero.
2.3.5.3 LE legacy pairing - Passkey Entry
The Passkey Entry STK generation method uses 6 numeric digits passed out of band
by the user between the devices. A 6 digit numeric randomly generated passkey
achieves approximately 20 bits of entropy.
If the IO capabilities of a device are DisplayOnly or if Table 2.8 defines that the device
displays the passkey, then that device shall display a randomly generated passkey
value between 000,000 and 999,999. The display shall ensure that all 6 digits are
displayed – including zeros. The other device shall allow the user to input a value
between 000,000 and 999,999.
If the IO capabilities of both devices are KeyboardOnly then the user generates a
random 6-digit passkey value and enters it into both devices. Both devices shall allow
the user to input a value between 000,000 and 999,999.
The passkey should be generated randomly during each pairing procedure and not be
reused from a previous procedure. Static passkeys should not be used since they can
compromise the security of the link.
If entry of passkey in UI fails to occur or is cancelled then the device shall send Pairing
Failed command with reason code “Passkey Entry Failed”.
The passkey Entry method does not provide protection against active “man-in-the-
middle” (MITM) attacks.
The Passkey Entry STK generation method provides very limited protection against
eavesdroppers during the pairing process because of the limited range of possible TK
values which STK is dependent upon. If the attacker is not present during the pairing
process then confidentiality and authentication can be established by using encryption
on a future connection.
An out of band mechanism may be used to communicate information to help with device
discovery, for example device address, and the 128-bit TK value used in the pairing
process. The TK value shall be a 128-bit random number using the requirements for
random generation defined in [Vol 2] Part H, Section 2.
If the OOB communication is resistant to MITM attacks, then this association method
is also resistant to MITM attacks. Also, in the Out of Band method, the size of
authentication parameter (TK) need not be restricted by what the user can comfortably
read or type. For that reason, the Out of Band method can be more secure than
using the Passkey Entry or Just Works methods. However, both devices need to have
matching OOB interfaces.
The initiating device calculates the 128-bit confirm value (LP_CONFIRM_I) using the
confirm value generation function c1 (see Section 2.2.3) with the input parameter k set
to TK, the input parameter r set to LP_RAND_I, the input parameter preq set to Pairing
Request command as exchanged with the peer device (i.e. without any modifications),
the input parameter pres set to the Pairing Response command as exchanged with the
peer device (i.e. without any modifications), the input parameter iat set to the initiating
device address type, ia set to the initiating device address, rat set to the responding
device address type and ra set to the responding device address:
Initiating and responding device addresses used for confirmation generation shall be
device addresses used during connection setup, see [Vol 3] Part C, Section 9.3
The responding device calculates the 128-bit confirm value (LP_CONFIRM_R) using
the confirm value generation function c1 (see Section 2.2.3) with the input parameter
k set to TK, the input parameter r set to LP_RAND_R, the input parameter preq set
to Pairing Request command, the input parameter pres set to the Pairing Response
command, the input parameter iat set to the initiating device address type, ia set to the
initiating device address, rat set to the responding device address type and ra set to the
responding device address:
The initiating device transmits LP_CONFIRM_I to the responding device. When the
responding device receives LP_CONFIRM_I it transmits LP_CONFIRM_R to the
initiating device. When the initiating device receives LP_CONFIRM_R it transmits
LP_RAND_I to the responding device.
The responding device verifies the LP_CONFIRM_I value by repeating the calculation
the initiating device performed, using the LP_RAND_I value received.
If the responding device’s calculated LP_CONFIRM_I value does not match the
received LP_CONFIRM_I value from the initiating device then the pairing process shall
be aborted and the responding device shall send the Pairing Failed command with
reason code “Confirm Value Failed”.
The initiating device verifies the received LP_CONFIRM_R value by repeating the
calculation the responding device performed, using the LP_RAND_R value received.
If the initiating devices calculated LP_CONFIRM_R value does not match the received
LP_CONFIRM_R value from the responding device then the pairing process shall be
aborted and the initiating device shall send the Pairing Failed command with the reason
code “Confirm Value Failed”.
STK is generated using the key generation function s1 defined in Section 2.2.4 with the
input parameter k set to TK, the input parameter r1 set to LP_RAND_R, and the input
parameter r2 set to LP_RAND_I:
If the encryption key size is shorter than 128 bits then the STK shall be masked to the
correct key size as described in Section 2.3.4.
The initiator shall use the generated STK to either enable encryption on the link or if
encryption has already been enabled, perform the encryption pause procedure (see
Section 2.4.4.1).
Initially, each device generates its own Elliptic Curve Diffie-Hellman (ECDH) public-
private key pair (phase 1). The public-private key pair contains a private (secret) key,
and a public key. The private keys of devices A and B are denoted as SKa and
SKb respectively. The public keys of devices A and B are denoted as PKa and PKb
respectively. See Section 2.3.6 for recommendations on how frequently this key pair
should be changed.
Pairing is initiated by the initiating device sending its public key to the receiving device
(phase 1a). The responding device replies with its own public key (phase 1b). If the two
public keys have the same X coordinate and neither is the debug key, each device shall
fail the pairing process. These public keys are not regarded as secret although they
may identify the devices.
Initiating Non-initiating
Device A Device B
1a. PKa
1b. PKb
A device shall validate that any public key received from any BD_ADDR is on the
correct curve (P-256).
A valid public key Q = (XQ, YQ) is one where XQ and YQ are both in the range 0 to p -
1 and satisfy the equation (YQ)2 = (XQ)3 + aXQ + b (mod p) in the relevant curve's finite
field. See [Vol 2] Part H, Section 7.6 for the values of a, b, and p.
A device can validate a public key by directly checking the curve equation, by
implementing elliptic curve point addition and doubling using formulas that are valid
only on the correct curve, or by other means.
A device that detects an invalid public key from the peer at any point during the LE
Secure Connections pairing process shall not use the resulting LTK, if any.
After the public keys have been exchanged, the device can then start computing the
Diffie-Hellman Key.
When the Security Manager is placed in a Debug mode it shall use the following
Diffie-Hellman private / public key pair:
Private key: 3f49f6d4 a3c55f38 74c9b3e3 d2103f50 4aff607b eb40b799 5899b8a6 cd3c1abd
Public key (X): 20b003d2 f297be2c 5e2c83a7 e9f9a5b9 eff49111 acf4fddb cc030148 0e359de6
Public key (Y): dc809c49 652aeb6d 63329abf 5a52155c 766345c2 8fed3024 741c8ed0 1589d28b
If a device receives this debug public key and it is in a mode in which it cannot accept
the debug key then it may send the Pairing Failed command with the reason set to
"Invalid Parameters".
Note: Only one side (initiator or responder) needs to set Secure Connections debug
mode in order for debug equipment to be able to determine the LTK and, therefore, be
able to monitor the encrypted connection.
The Numeric Comparison association model will be used during pairing if the MITM
bit is set to 1 in the Authentication Requirements in the Pairing Request PDU
and/or Pairing Response PDU and both devices have IO capabilities set to either
DisplayYesNo or KeyboardDisplay.
The sequence diagram of Authentication stage 1 for the Just Works or Numeric
Comparison protocol from the cryptographic point of view is shown in Figure 2.3.
Initiating Noninitiating
Device A Device B
4. Cb
5. Na
6. Nb
USER checks if Va = Vb
Proceed if each USER confirms ”OK”
Figure 2.3: "Authentication stage 1: Just Works or Numeric Comparison, LE Secure Connections
After the public keys have been exchanged, each device selects a random 128-bit
nonce (step 2). This value is used to mitigate replay attacks and shall be freshly
generated with each instantiation of the pairing protocol. This value shall be generated
using a random number generator that meets the requirements of [Vol 2] Part H,
Section 2.
Following this the responding device then computes a commitment to the two public
keys that have been exchanged and its own nonce value (step 3c). This commitment
is computed as a one-way function of these values and is transmitted to the initiating
device (step 4). The commitment prevents an attacker from changing these values at a
later time.
The initiating and responding devices then exchange their respective nonce values
(steps 5 and 6) and the initiating device confirms the commitment (step 6a). A failure at
this point indicates the presence of an attacker or other transmission error and causes
the protocol to abort. The protocol may be repeated with or without the generation
of new public-private key pairs, but new nonces shall be generated if the protocol is
repeated.
When Just Works is used, the commitment checks (steps 7a and 7b) are not performed
and the user is not shown the 6-digit values.
When Numeric Comparison is used, assuming that the commitment check succeeds,
the two devices each compute 6-digit confirmation values that are displayed to the user
on their respective devices (steps 7a, 7b, and 8). The user is expected to check that
these 6-digit values match and to confirm if there is a match. If there is no match, the
protocol aborts and, as before, new nonces shall be generated if the protocol is to be
repeated.
An active MITM must inject its own key material into this process to have any effect
other than denial-of-service. A simple MITM attack will result in the two 6-digit display
values being different with probability 0.999999. A more sophisticated attack may
attempt to engineer the display values to match, but this is thwarted by the commitment
sequence. If the attacker first exchanges nonces with the responding device, it must
commit to the nonce that it will use with the initiating device before it sees the nonce
from the initiating device. If the attacker first exchanges nonces with the initiating
device, it must send a nonce to the responding device before seeing the nonce from
the responding device. In each case, the attacker must commit to at least the second
of its nonces before knowing the second nonce from the legitimate devices. It therefore
cannot choose its own nonces in such a way as to cause the display values to match.
The Passkey Entry protocol is used when SMP IO capability exchange sequence
indicates that Passkey Entry shall be used.
The sequence diagram for Authentication stage 1 for Passkey Entry from the
cryptographic point of view is shown in Figure 2.4.
Initiating Noninitiating
Device A Device B
Execute 20 times:
ra = ra1 | ra2 | … ra20
rb = rb1 | rb2 | … rb20
New random numbers are
selected in each round
5. Cai
6. Cbi
7. Nai
7a. Check if
Cai=f4(PKa, PKb, Nai, rbi).
If check fails, abort.
8. Nbi
8a. Check if
Cbi=f4(PKb, PKa, Nbi, rai).
If check fails, abort.
The user inputs an identical Passkey into both devices. Alternately, the Passkey may be
generated and displayed on one device, and the user then inputs it into the other (step
2). This short shared key will be the basis of the mutual authentication of the devices.
The Passkey should be generated randomly during each pairing procedure and not be
reused from a previous procedure. Static Passkeys should not be used since they can
compromise the security of the link.
In Steps 3 to 8, each side commits to each bit of the Passkey, using a long nonce (128
bits), and sending the hash of the nonce, the bit of the Passkey, and both public keys to
the other party. The parties then take turns revealing their commitments until the entire
Passkey has been mutually disclosed. The first party to reveal a commitment for a given
bit of the Passkey effectively reveals that bit of the Passkey in the process, but the other
party then has to reveal the corresponding commitment to show the same bit value for
that bit of the Passkey, or else the first party will then abort the protocol, after which no
more bits of the Passkey are revealed.
This "gradual disclosure" prevents leakage of more than 1 bit of un-guessed Passkey
information in the case of a MITM attack. A MITM attacker with only partial knowledge
of the Passkey will only receive one incorrectly-guessed bit of the Passkey before the
protocol fails. Hence, a MITM attacker who engages first one side, then the other will
only gain an advantage of at most two bits over a simple brute-force guesser, making
the probability of success 0.000004 instead of 0.000001.
The long nonce is included in the commitment hash to make it difficult to brute force
even after the protocol has failed. The public Diffie-Hellman values are included to tie
the Passkey protocol to the original ECDH key exchange, to prevent a MITM from
substituting the attacker's public key on both sides of the ECDH exchange in standard
MITM fashion.
At the end of this stage, Na is set to Na20 and Nb is set to Nb20 for use in
Authentication stage 2.
The Out-of-Band protocol is used when authentication information has been received
by at least one of the devices and indicated in the OOB data flag parameter included
in the SMP Pairing Request and SMP Pairing Response PDU. The mode in which the
discovery of the peer device is first done in-band and then followed by the transmission
of authentication parameters through OOB interface is not supported. The sequence
diagram for Authentication stage 1 for Out of Band from the cryptographic point of view
is shown in Figure 2.5.
Initiating Non-initiating
Device A Device B
OOB Communication
A = Device Address used during pairing
B = Device Address used during pairing
4a. A, ra, Ca
4b. B, rb, Cb
7. Na
8. Nb
Principle of operation. If both devices can transmit and/or receive data over an
out-of-band channel, then mutual authentication will be based on the commitments
of the public keys (Ca and Cb) exchanged OOB in Authentication stage 1. If OOB
communication is possible only in one direction, then authentication of the device
receiving the OOB communication will be based on that device knowing a random
number r sent via OOB. In this case, r must be secret: r can be created afresh every
time, or access to the device sending r must be restricted. If r is not sent by a device, it
is assumed to be 0 by the device receiving the OOB information in step 4a or 4b.
Roles of A and B. The OOB Authentication stage 1 protocol is symmetric with respect
to the roles of A and B. It does not require that device A always will initiate pairing and it
automatically resolves asymmetry in the OOB communication.
Order of steps. The public key exchange must happen before the verification step 5.
In the diagram the in-band public key exchange between the devices (step 1) is done
before the OOB communication (step 4). But when the pairing is initiated by an OOB
interface, public key exchange will happen after the OOB communication (step 1 will be
between steps 4 and 5).
Values of ra and rb: Since the direction of the peer's OOB interface cannot be verified
before the OOB communication takes place, a device should always generate and if
possible transmit through its OOB interface a random number r to the peer. Each device
applies the following rules locally to set the values of its own r and the value of the
peer's r:
1. Initially, r of the device is set to a random number and r of the peer is set to 0 (step
2).
2. If a device has received OOB, it sets the peer's r value to what was sent by the
peer (Step 5).
3. If the remote device's OOB data flag sent in the SMP Pairing Request or SMP
Pairing Response is set to “OOB Authentication data not present”, it sets its own r
value to 0 (Step 5)
The second stage of authentication then confirms that both devices have successfully
completed the exchange. This stage is identical in all three protocols and is shown in
Figure 2.6.
Each device computes the MacKey and the LTK using the previously exchanged values
and the newly derived shared key (step 9). Each device then computes a new key
confirmation value that includes the previously exchanged values and the newly derived
MacKey (step 10a and 10b). The initiating device then transmits its key confirmation
value, which is checked by the responding device (step 11). If this check fails, it
indicates that the initiating device has not confirmed the pairing, and the protocol shall
be aborted. The responding device then transmits its key confirmation value, which is
checked by the initiating device (step 12). A failure indicates that the responding device
has not confirmed the pairing and the protocol shall abort.
Initiating Noninitiating
Device A Device B
9. Compute the LTK and MacKey: 9. Compute the LTK and MacKey:
MacKey || LTK = f5(DHKey,Na,Nb,A,B) MacKey || LTK = f5(DHKey,Na,Nb,A,B)
10. Ea
11. Check if Ea =
f6(MacKey,Na,Nb,rb,IOcapA,A,B)
If check fails, abort.
12. Eb
12a. Check if Eb =
f6(MacKey,Nb,Na,ra,IOcapB,B,A)
If check fails, abort.
When a pairing procedure fails a waiting interval shall pass before the verifier will
initiate a new Pairing Request command or Security Request command to the same
claimant, or before it will respond to a Pairing Request command or Security Request
command initiated by a device claiming the same identity as the failed device. For
each subsequent failure, the waiting interval shall be increased exponentially. That is,
after each failure, the waiting interval before a new attempt can be made, could be for
example, twice as long as the waiting interval prior to the previous attempt1. The waiting
interval should be limited to a maximum.
The maximum waiting interval depends on the implementation. The waiting time shall
exponentially decrease to a minimum when no new failed attempts are made during a
certain time period. This procedure restricts the rate at which an intruder can repeat the
pairing procedure with different keys.
The Peripheral in the key distribution phase gives keys to the Central so a reconnection
can be encrypted, its random addresses can be resolved, or the Central can verify
signed data from the Peripheral.
The Central may also provide keys to the Peripheral so a reconnection can be
encrypted if the roles are reversed, the Central’s random addresses can be resolved, or
the Peripheral can verify signed data from the Central.
LE security uses the following keys and values for encryption, signing, and random
addressing:
1. Identity Resolving Key (IRK) is a 128-bit key used to generate and resolve random
addresses.
2. Connection Signature Resolving Key (CSRK) is a 128-bit key used to sign data and
verify signatures on the receiving device.
3. Long Term Key (LTK) is a 128-bit key used to generate the contributory session key
for an encrypted connection. Link Layer encryption is described in [Vol 6] Part B,
Section 5.1.3.
4. Encrypted Diversifier (EDIV) is a 16-bit stored value used to identify the LTK
distributed during LE legacy pairing. A new EDIV is generated each time a unique
LTK is distributed.
5. Random Number (Rand) is a 64-bit stored valued used to identify the LTK
distributed during LE legacy pairing. A new Rand is generated each time a unique
LTK is distributed.
Any method of generation of keys that are being distributed that results in the keys
having 128 bits of entropy can be used, as the generation method is not visible outside
the Peripheral (see Appendix B). The keys shall not be generated only from information
that is distributed to the Central or only from information that is visible outside of the
Peripheral.
The Identity Resolving Key (IRK) is used for resolvable private address construction
(see [Vol 3] Part C, Section 10.8.2). A Central that has received IRK from a Peripheral
can resolve that Peripheral’s random device addresses. A Peripheral that has received
IRK from a Central can resolve that Central’s random device addresses. The privacy
concept only protects against devices that are not part of the set to which the IRK has
been given.
The encryption key size does not apply to IRK; therefore, its size does not need to be
shortened before distribution.
The Connection Signature Resolving Key (CSRK) is used to sign data in a connection.
A device that has received CSRK can verify signatures generated by the distributing
device. The signature only protects against devices that are not part of the set to which
CSRK has been given.
The encryption key size does not apply to CSRK, therefore its size does not need to be
shortened before distribution.
Devices which support encryption in the Link Layer Connection state in the Peripheral
Role shall be capable of generating LTK, EDIV, and Rand.
The EDIV and Rand are used by the Peripheral to establish a previously shared LTK in
order to start an encrypted connection with a previously paired Central.
The generated LTK size shall not be longer than the negotiated encryption key size, so
its size may need to be shortened (see Section 2.3.4).
New values of LTK, EDIV, and Rand shall be generated each time they are distributed.
The Peripheral may store the mapping between EDIV, Rand and LTK in a security
database so the correct LTK value is used when the Central requests encryption.
Depending upon the LTK generation method additional information may be stored, for
example the size of the distributed LTK.
The Central may also distribute EDIV, Rand, and LTK to the Peripheral which can be
used to encrypt a reconnection if the device roles are reversed in a future connection.
The LTK from the LE physical transport can be converted to the BR/EDR link key for the
BR/EDR transport as follows, using intermediate link key (ILK) as an intermediate value:
The string “tmp1” is mapped into a keyID using ASCII as 0x746D7031 and into a SALT
as 0x00000000_00000000_00000000_746D7031.
Note: If the LTK has an encryption key size that is shorter than 16 octets (128 bits), then
the BR/EDR link key is derived before the LTK gets masked.
The BR/EDR Link Key from the BR/EDR physical transport can be converted to the
LTK for the LE transport as follows, using intermediate long term key (ILTK) as an
intermediate value:
The string “tmp2” is mapped into a keyID using ASCII as 0x746D7032 and into a SALT
as 0x00000000_00000000_00000000_746D7032.
Key distribution for LE Legacy Pairing and LE Secure Connections is described in the
following sections.
The security properties of the distributed keys shall be set to the security properties of
the STK that was used to distribute them. For example if STK has Unauthenticated
no MITM Protection security properties then the distributed keys shall have
Unauthenticated no MITM Protection security properties.
The link shall be encrypted or re-encrypted using STK generated in Phase 2 (see
Section 2.4.4.1) before any keys are distributed.
Note: The distributed EDIV and Rand values are transmitted in clear text by the Central
to the Peripheral during encrypted session setup.
The BD_ADDR that is received in the Identity Address Information command shall only
be considered valid once a reconnection has occurred using the BD_ADDR and LTK
distributed during that pairing. Once this is successful the BD_ADDR and the distributed
keys shall be associated with that device in the security database.
A device may request encrypted session setup to use the LTK, EDIV, and Rand values
distributed by the Peripheral when the key distribution phase has completed; however,
this does not provide any additional security benefit. If an attacker has established the
distributed LTK value then performing encrypted session setup to use the distributed
values does not provide any protection against that attacker.
• IRK
• CSRK
The security properties of the distributed keys shall be set to the security properties of
the LTK that was used to distribute them. For example if LTK has Unauthenticated
no MITM Protection security properties then the distributed keys shall have
Unauthenticated no MITM Protection security properties.
The link shall be encrypted or re-encrypted using LTK generated in Phase 2 (see
Section 2.4.4.1) before any keys are distributed.
The BD_ADDR that is received in the Identity Address Information command shall only
be considered valid once a reconnection has occurred using the BD_ADDR and LTK
generated during that pairing. Once this is successful the BD_ADDR and the distributed
keys shall be associated with that device in the security database.
During the encrypted session setup the Central sends a 16-bit Encrypted Diversifier
value, EDIV, and a 64-bit Random Number, Rand, distributed by the Peripheral during
pairing, to the Peripheral. The Central’s Host provides the Link Layer with the Long
Term Key to use when setting up the encrypted session. The Peripheral’s Host receives
the EDIV and Rand values and provides a Long Term Key to the Peripheral’s Link Layer
to use when setting up the encrypted link.
When both devices support LE Secure Connections, the EDIV and Rand are set to
zero.
To distribute LTK and other keys in pairing Phase 3 an encrypted session needs to be
established (see Section 2.3.5.5).
The encrypted session is setup using STK generated in Phase 2 (see Section
Section 2.3.5.5) as the Long Term Key provided to the Link Layer, (see [Vol 6] Part
B, Section 5.1.3.1) EDIV, and Rand values shall be set to zero.
If the link is already encrypted then the encryption pause procedure is performed using
STK generated in Phase 2 as the Long Term Key provided to the Link Layer (see [Vol 6]
Part B, Section 5.1.3.2). EDIV and Rand values shall be set to zero.
The Central must have the security information (LTK, EDIV, and Rand) distributed by
the Peripheral in LE legacy pairing or the LTK generated in LE Secure Connections to
setup an encrypted session.
The Central initiates the encrypted session using the security information; see [Vol 6]
Part B, Section 5.1.3.1. If the link is already encrypted the encryption pause procedure
is performed using the security information; see [Vol 6] Part B, Section 5.1.3.2.
In LE legacy pairing, the EDIV and Rand values are used to establish LTK which is used
as the Long Term Key on the Peripheral. If LTK cannot be established from EDIV and
Rand values then the Peripheral shall reject the request to encrypt the link and may
optionally disconnect the link.
The LTK size shall not be longer than the negotiated encryption key size, so its size may
need to be shortened (see Section 2.3.4).
When the security information is stored, subsequent encryption setups may fail if the
remote device has deleted the security information. Table 2.9 defines what shall be
done depending on the type of the security properties and whether or not bonding was
performed when subsequent encryption setup fails.
Option 1 is recommended.
Unauthenticated, Yes Notify user of security failure.
no MITM protec-
tion
Authenticated No Depends on security policy of the device:
MITM protection
• Option 1: Automatically initiate pairing.
• Option 2: Notify user and ask if pairing is ok.
Option 2 is recommended.
Authenticated Yes Notify user of security failure.
MITM protection
An LE device can send signed data without having to establish an encrypted session
with a peer device. Data shall be signed using CSRK. A device performing signature
verification must have received CSRK from the signing device. The sending device will
use its CSRK to sign the transmitted data.
m is variable length
k is 128 bits
SignCounter is 32 bits
Signing shall be performed using the algorithm defined in the NIST Special Publication
800-38B [1] using AES-128 as the block cipher. NIST SP 800-38B defines the message
authentication code (MAC) generation function:
The bit length of the MAC (Tlen) shall be 64 bits. The key used for signature generation
(k) shall be set to CSRK.
The message to be signed (M) by the CMAC function is the concatenation of the
variable length message to be signed (m) and 4 octet string representing the 32-bit
counter value (SignCounter) least significant octet first.
M = m || SignCounter
The SignCounter shall be initialized to zero when CSRK is generated and incremented
for every message that is signed with a given CSRK.
Note: If a device generates 100,000 signed events a day, a 32-bit counter will wrap after
approximately 117 years.
The 64-bit result of the CMAC function is used as the result of the signing algorithm.
The device performing verification should store the last verified SignCounter in the
security database and compare it with a received SignCounter to prevent replay attacks.
If the received SignCounter is greater than the stored value then the message has not
been seen by the local device before and the security database can be updated.
The Peripheral shall not send the Security Request command if the pairing procedure is
in progress, or if the encryption procedure is in progress.
The Security Request command includes the required security properties. A security
property of MITM protection required shall only be set if the Peripheral’s IO capabilities
would allow the Passkey Entry association model to be used or out of band
authentication data is available.
The Central shall ignore the Peripheral’s Security Request if the Central has sent a
Pairing Request without receiving a Pairing Response from the Peripheral or if the
Central has initiated encryption mode setup.
If pairing or encryption mode is not supported or cannot be initiated at the time when the
Peripheral’s Security Request command is received, then the Central shall respond with
a Pairing Failed command with the reason set to “Pairing Not Supported.”
After receiving a Security Request, the Central shall first check whether it has
the required security information to enable encryption; see Section 2.4.4.2. If this
information is missing or does not meet the security properties requested by the
Peripheral, then the Central shall initiate the pairing procedure. If the pairing procedure
is successful, the Central’s security database is updated with the keys and security
properties are distributed during the pairing procedure.
If the Central has the required security information to enable encryption and it meets
the security properties request by the Peripheral, it shall perform encryption setup using
LTK, see Section 2.4.4.2.
Figure 2.7 shows a summary of the actions and decisions that a Central shall take when
receiving a Security Request.
The Peripheral shall check that any Pairing Request command received from
the Central after sending a Security Request command contains Authentication
Requirements that meet the requested security properties.
If the Peripheral requests a security property that is not Just Works and receives an
encryption procedure request after sending a Security Request command then it shall
check that any existing Security Information is of sufficient security properties.
Peripheral
Security Request
Sent Pairing
Yes
Request?
No
No Have LTK
Yes
LTK >=
No Requested
Security Level
Yes
Already Encrypted No
Yes
End
3.1 Introduction
The Security Manager Protocol (SMP) is used for pairing and transport specific key
distribution.
Parameter Value
MTU 23
Flush Timeout 0xFFFF (Infinite)
QoS Best Effort
Mode Basic Mode
Table 3.1: Security Manager Channel configuration parameters without LE Secure Connections
The configuration parameters for the Security Manager Channel when LE Secure
Connections is supported shall be as shown below in Table 3.2.
Parameter Value
MTU 65
Flush Timeout 0xFFFF (Infinite)
QoS Best Effort
Mode Basic Mode
Table 3.2: Security Manager Channel configuration parameters with LE Secure Connections
Code Data
• Code (1 octet)
The Code field is one octet long and identifies the type of command. Table 3.3 lists
the codes defined by this document. If a packet is received with a Code that is
reserved for future use it shall be ignored.
Code Description Logical Link Supported
0x01 Pairing Request LE-U, ACL-U
0x02 Pairing Response LE-U, ACL-U
0x03 Pairing Confirm LE-U
0x04 Pairing Random LE-U
0x05 Pairing Failed LE-U, ACL-U
0x06 Encryption Information LE-U
0x07 Central Identification LE-U
0x08 Identity Information LE-U, ACL-U
0x09 Identity Address Information LE-U, ACL-U
0x0A Signing Information LE-U, ACL-U
0x0B Security Request LE-U
0x0C Pairing Public Key LE-U
0x0D Pairing DHKey Check LE-U
0x0E Pairing Keypress Notification LE-U
All other values Reserved for future use
If a device does not support pairing then it shall respond with a Pairing Failed command
with the reason set to “Pairing Not Supported” (see Section 3.5.5) when any command
is received. If pairing is supported then all commands shall be supported.
The Security Manager Timer shall be reset when an L2CAP SMP command is queued
for transmission. The Security Manager Timer should be reset upon reception of a
Keypress Notification (if the timer is not reset on receipt of a Keypress Notification, the
Security Manager can time out before the peer's Security Manager because there is no
response to a Keypress Notification).
When a Pairing process completes (whether successfully or not), the Security Manager
Timer shall be stopped.
If the Security Manager Timer reaches 30 seconds, the procedure shall be considered
to have failed, and the local higher layer shall be notified. No further SMP commands
shall be sent over the L2CAP Security Manager Channel. A new Pairing process shall
only be performed when a new physical link has been established.
The SMP commands defined in this section are used to perform Pairing Feature
Exchange and key generation (see Section 2.1).
The initiator starts the Pairing Feature Exchange by sending a Pairing Request
command to the responding device. The Pairing Request command is defined in
Figure 3.2.
The rules for handing a collision between a pairing procedure on the LE transport and a
pairing procedure on the BR/EDR transport are defined in [Vol 3] Part C, Section 14.2.
IO OOB
Code=0x01 AuthReq
Capability data flag
Maximum Initiator Key Responder
Encryption Key
Key Size Distribution Distribution
• IO Capability (1 octet)
Table 3.4 defines the values which are used when exchanging IO capabilities (see
Section 2.3.2).
Value Description
0x00 DisplayOnly
0x01 DisplayYesNo
0x02 KeyboardOnly
0x03 NoInputNoOutput
0x04 KeyboardDisplay
0x05 to 0xFF Reserved for future use
Value Description
0x00 OOB Authentication data not present
0x01 OOB Authentication data from remote device present
0x02 to 0xFF Reserved for future use
• AuthReq (1 octet)
The AuthReq field is a bit field that indicates the requested security properties (see
Section 2.3.1) for the STK and LTK and GAP bonding information (see [Vol 3] Part C,
Section 9.4).
Figure 3.3 defines the authentication requirements bit field.
LSB MSB
The Bonding_Flags field is a 2-bit field that indicates the type of bonding being
requested by the initiating device as defined in Table 3.6.
The MITM field is a 1-bit flag that is set to one if the device is requesting MITM
protection, otherwise it shall be set to 0. A device sets the MITM flag to one to request
an Authenticated security property for the STK when using LE legacy pairing and the
LTK when using LE Secure Connections.
The SC field is a 1 bit flag. If LE Secure Connections pairing is supported by the device,
then the SC field shall be set to 1, otherwise it shall be set to 0. If both devices support
LE Secure Connections pairing, then LE Secure Connections pairing shall be used,
otherwise LE Legacy pairing shall be used.
The keypress field is a 1-bit flag that is used only in the Passkey Entry protocol and
shall be ignored in other protocols. When both sides set that field to one, Keypress
notifications shall be generated and sent using SMP Pairing Keypress Notification
PDUs.
The CT2 field is a 1-bit flag that shall be set to 1 upon transmission to indicate support
for the h7 function. See sections 2.4.2.4 and 2.4.2.5.
If Secure Connections pairing has been initiated over BR/EDR, the following fields of
the SM Pairing Request PDU are reserved for future use:
This command is used by the responding device to complete the Pairing Feature
Exchange after it has received a Pairing Request command from the initiating device,
if the responding device allows pairing. The Pairing Response command is defined in
Figure 3.4.
The rules for handing a collision between a pairing procedure on the LE transport and a
pairing procedure on the BR/EDR transport are defined in [Vol 3] Part C, Section 14.2.
If a Pairing Request is received over the BR/EDR transport when either cross-transport
key derivation/generation is not supported or the BR/EDR transport is not encrypted
using a Link Key generated using P256, a Pairing Failed shall be sent with the error
code Cross-Transport Key Derivation/Generation Not Allowed (0x0E).
If a Pairing Request is received and the device is not ready to perform the pairing
procedure, a Pairing Failed may be sent with the error code Busy (0x10).
IO OOB
Code=0x02 AuthReq
Capability data flag
Maximum Initiator Key Responder
Encryption Key
Key Size Distribution Distribution
• IO Capability (1 octet)
Table 3.4 defines the values which are used when exchanging IO capabilities (see
Section 2.3.2).
• OOB data flag (1 octet)
Table 3.5 defines the values which are used when indicating whether OOB
authentication data is available (see Section 2.3.3).
• AuthReq (1 octet)
The AuthReq field is a bit field that indicates the requested security properties (see
Section 2.3.1) for the STK or LTK and GAP bonding information (see [Vol 3] Part C,
Section 9.4).
Figure 3.3 defines the authentication requirements bit field.
The Bonding_Flags field is a 2-bit field that indicates the type of bonding being
requested by the responding device as defined in Table 3.6.
The MITM field is a 1-bit flag that is set to one if the device is requesting MITM
protection, otherwise it shall be set to 0. A device sets the MITM flag to one to request
an Authenticated security property for the STK when using LE legacy pairing and the
LTK when using LE Secure Connections.
The SC field is a 1 bit flag. If LE Secure Connections pairing is supported by the
device, then the SC field shall be set to 1, otherwise it shall be set to 0. If both
devices support LE Secure Connections pairing, then LE Secure Connections pairing
shall be used, otherwise LE Legacy pairing shall be used.
The keypress field is a 1-bit flag that is used only in the Passkey Entry protocol and
shall be ignored in other protocols. When both sides set that field to one, Keypress
notifications shall be generated and sent using SMP Pairing Keypress Notification
PDUs.
The CT2 field is a 1-bit flag that shall be set to 1 upon transmission to indicate
support for the h7 function. See Sections 2.4.2.4 and 2.4.2.5.
• Maximum Encryption Key Size (1 octet)
This value defines the maximum encryption key size in octets that the device can
support. The maximum key size shall be in the range 7 to 16 octets.
• Initiator Key Distribution (1 octet)
The Initiator Key Distribution field defines which keys the initiator shall distribute and
use during the Transport Specific Key Distribution phase (see Section 2.4.3). The
Initiator Key Distribution field format and usage are defined in Section 3.6.1.
• Responder Key Distribution (1 octet)
The Responder Key Distribution field defines which keys the responder shall
distribute and use during the Transport Specific Key Distribution phase (see
Section 2.4.3). The Responder Key Distribution field format and usage are defined
in Section 3.6.1.
If Secure Connections pairing has been initiated over BR/EDR, the following fields of
the SM Pairing Response PDU are reserved for future use:
This is used following a successful Pairing Feature Exchange to start STK Generation
for LE legacy pairing and LTK Generation for LE Secure Connections pairing. The
Pairing Confirm command is defined in Figure 3.5.
This command is used by both devices to send the confirm value to the peer
device, see Section 2.3.5.5 for LE legacy pairing and Section 2.3.5.6 for LE Secure
Connections pairing.
The initiating device starts key generation by sending the Pairing Confirm command to
the responding device. If the initiating device wants to abort pairing it can transmit a
Pairing Failed command instead.
The responding device sends the Pairing Confirm command after it has received a
Pairing Confirm command from the initiating device.
Confirm Value
Confirm Value
Confirm Value
Confirm
Value
This command is used by the initiating and responding device to send the random
number used to calculate the Confirm value sent in the Pairing Confirm command. The
Pairing Random command is defined in Figure 3.6.
The initiating device sends a Pairing Random command after it has received a Pairing
Confirm command from the responding device.
In LE legacy pairing, the responding device shall send a Pairing Random command
after it has received a Pairing Random command from the initiating device if the Confirm
value calculated on the responding device matches the Confirm value received from the
initiating device. If the calculated Confirm value does not match then the responding
device shall respond with the Pairing Failed command.
The initiating device shall encrypt the link using the generated key (STK in LE legacy
pairing or LTK in LE Secure Connections) if the Confirm value calculated on the
initiating device matches the Confirm value received from the responding device. The
successful encryption or re-encryption of the link is the signal to the responding device
that key generation has completed successfully. If the calculated Confirm value does not
match then the initiating device shall respond with the Pairing Failed command.
Random value
Random value
Random value
Random
value
This is used when there has been a failure during pairing and reports that the pairing
procedure has been stopped and no further communication for the current pairing
procedure is to occur. The Pairing Failed command is defined in Figure 3.7.
Any subsequent pairing procedure shall restart from the Pairing Feature Exchange
phase.
This command may be sent at any time during the pairing process by either device in
response to a message from the remote device.
During LE Secure Connections pairing, this command shall be sent if the remote
device's public key is invalid (see Section 2.3.5.6.1). The Reason field shall be set
to "DHKey Check Failed".
Code=0x05 Reason
• Reason (1 octets)
The Reason field indicates why the pairing failed. The reason codes are defined in
Table 3.7.
This message is used to transfer the device’s local public key (X and Y co-ordinates) to
the remote device. This message is used by both the initiator and responder. This PDU
is only used for Secure Connections. Its format is specified in Figure 3.8.
This message is used to transmit the 128-bit DHKey Check values (Ea and Eb)
generated using f6. These are confirmation values generated using the DHKey. This
message is used by both initiator and responder. This PDU is only used for LE Secure
Connections. Its format is specified in Figure 3.9.
This message is used during the Passkey Entry protocol by a device with KeyboardOnly
IO capabilities to inform the remote device when keys have been entered or erased. Its
format is specified in Figure 3.10.
Bluetooth Low Energy devices can distribute keys from the Peripheral to the Central
and from the Central to the Peripheral. When using LE legacy pairing, the following keys
may be distributed from the Peripheral to the Central:
When using LE Secure Connections, the following keys may be distributed from the
Peripheral to the Central:
When using LE legacy pairing, the Central may distribute to the Peripheral the following
key:
When using LE Secure Connections, the Central may distribute to the Peripheral the
following key:
The keys which are to be distributed in the Transport Specific Key Distribution phase
are indicated in the Key Distribution field of the Pairing Request and Pairing Response
commands see Section 3.5.1 and Section 3.5.2.
The format of the Initiator Key Distribution / Generation field and Responder Key
Distribution / Generation field in the Pairing Request and Pairing Response commands
for LE is defined in Figure 3.11.
LSB MSB
• In LE legacy pairing, EncKey is a 1-bit field that is set to one to indicate that the
device shall distribute LTK using the Encryption Information command followed by
EDIV and Rand using the Central Identification command.
In LE Secure Connections pairing, when SMP is running on the LE transport, then the
EncKey field shall be ignored. EDIV and Rand shall be set to zero and shall not be
distributed.
When SMP is running on the BR/EDR transport, the EncKey field is set to one to
indicate that the device would like to derive the LTK from the BR/EDR Link Key. When
EncKey is set to 1 by both devices in the initiator and responder Key Distribution /
Generation fields, the procedures for calculating the LTK from the BR/EDR Link Key
shall be used.
• IdKey is a 1-bit field that is set to one to indicate that the device shall distribute IRK
using the Identity Information command followed by its public device or static random
address using Identity Address Information.
• SignKey is a 1-bit field that is set to one to indicate that the device shall distribute
CSRK using the Signing Information command.
• LinkKey is a 1-bit field. When SMP is running on the LE transport, the LinkKey field
is set to one to indicate that the device would like to derive the Link Key from the
LTK. When LinkKey is set to 1 by both devices in the initiator and responder Key
Distribution / Generation fields, the procedures for calculating the BR/EDR link key
from the LTK shall be used. Devices not supporting LE Secure Connections shall
set this bit to zero and ignore it on reception. When SMP is running on the BR/EDR
transport, the LinkKey field is reserved for future use.
The Initiator Key Distribution / Generation field in the Pairing Request command is
used by the Central to request which keys are distributed or generated by the initiator
to the responder. The Responder Key Distribution / Generation field in the Pairing
Request command is used by the Central to request which keys are distributed or
generated by the responder to the initiator. The Initiator Key Distribution / Generation
field in the Pairing Response command from the Peripheral defines the keys that
shall be distributed or generated by the initiator to the responder. The Responder Key
Distribution / Generation field in the Pairing Response command from the Peripheral
defines the keys that shall be distributed or generated by the responder to the initiator.
The Peripheral shall not set to one any flag in the Initiator Key Distribution / Generation
or Responder Key Distribution / Generation field of the Pairing Response command that
the Central has set to zero in the Initiator Key Distribution / Generation and Responder
Key Distribution / Generation fields of the Pairing Request command.
When using LE legacy pairing, the keys shall be distributed in the following order:
When using LE Secure Connections, the keys shall be distributed in the following order:
If a key is not being distributed then the command to distribute that key shall not be
sent.
Note: If a key is not distributed, then the capabilities that use this key will not be
available. For example, if an LTK is not distributed from the Peripheral to the Central,
then the Central cannot encrypt a future link with that Peripheral, therefore pairing would
have to be performed again.
Note: The initiator should determine the keys needed based on the capabilities that
are required by higher layer specifications. For example, if the initiator determines that
encryption is required in a future link with that Peripheral, then the initiator must request
that Peripheral's LTK is distributed by setting the EncKey bit to one in the Responder
Key Distribution / Generation field of the Pairing Request command.
A device may reject a distributed key by sending the Pairing Failed command with the
reason set to "Key Rejected".
If EncKey, IdKey, and SignKey are set to zero in the Initiator Key Distribution /
Generation and Responder Key Distribution / Generation fields, then no keys shall be
distributed or generated and the link will be encrypted using the generated STK when
using LE legacy pairing and LTK when using LE Secure Connections pairing.
Key distribution is complete in the device sending the final key when it receives the
Baseband acknowledgment for that key and is complete in the receiving device when it
receives the final key being distributed.
The Encryption Information command shall only be sent when the link has been
encrypted or re-encrypted using the generated STK.
Long Term
Key
Central Identification is used in the LE legacy pairing Transport Specific Key Distribution
phase to distribute EDIV and Rand which are used when encrypting future connections.
The Central Identification command is defined in Figure 3.13.
The Central Identification command shall only be sent when the link has been encrypted
or re-encrypted using the generated STK.
Rand
Rand
• EDIV (2 octets)
The EDIV value being distributed (see Section 2.4.2.3).
• Rand (8 octets)
64-bit Rand value being distributed (see Section 2.4.2.3).
Identity Information is used in the Transport Specific Key Distribution phase to distribute
the IRK. The Identity Information command is defined in Figure 3.14.
The Identity Information command shall only be sent when the link has been encrypted
or re-encrypted using the generated key.
Identity
Resolving
Key
Note: An all zero Identity Resolving Key data field indicates that a device does not have
a valid resolvable private address.
Identity Address Information is used in the Transport Specific Key Distribution phase
to distribute its public device address or static random address. The Identity Address
Information command is defined in Figure 3.15.
The Identity Address Information command shall only be sent when the link has been
encrypted or re-encrypted using the generated key.
BD_ADDR
• AddrType (1 octet)
If BD_ADDR is a public device address, then AddrType shall be set to 0x00. If
BD_ADDR is a static random device address then AddrType shall be set to 0x01.
• BD_ADDR (6 octets)
This field is set to the distributing device’s public device address or static random
address.
Signing Information is used in the Transport Specific Key Distribution to distribute the
CSRK which a device uses to sign data. The Signing Information command is defined in
Figure 3.16.
The Signing Information command shall only be sent when the link has been encrypted
or re-encrypted using the generated key.
Signature Key
Signature Key
Signature Key
Signature
Key
The Security Request command is used by the Peripheral to request that the Central
initiates security with the requested security properties, see Section 2.4.6. The Security
Request command is defined in Figure 3.17.
Code=0x0B AuthReq
• AuthReq (1 octet)
The AuthReq field is a bit field that indicates the requested security properties (see
Section 2.3.1) for the STK or LTK and GAP bonding information (see [Vol 3] Part C,
Section 9.4).
Figure 3.3 defines the authentication requirements bit field.
The Bonding_Flags field is a 2-bit field that indicates the type of bonding being
requested by the responding device as defined in Table 3.6.
The MITM field is a 1-bit flag that is set to one if the device is requesting MITM
protection, otherwise it shall be set to 0. A device sets the MITM flag to one to request
an Authenticated security property for the STK when using LE legacy pairing and the
LTK when using LE Secure Connections.
The SC field is a 1 bit flag. If LE Secure Connections pairing is supported by the
device, then the SC field shall be set to 1, otherwise it shall be set to 0. If both
devices support LE Secure Connections pairing, then LE Secure Connections pairing
shall be used, otherwise LE Legacy pairing shall be used.
The keypress field is a 1-bit flag that is used only in the Passkey Entry protocol and
shall be ignored in other protocols. When both sides set that field to one, Keypress
notifications shall be generated and sent using SMP Pairing Keypress Notification
PDUs.
4 REFERENCES
EDIV and Rand are used by the responding device to identify an initiator and recover
LTK. This section provides an example of how the distributed EDIV value is a masked
version of the real value (DIV) which is used to recover LTK. Other methods can be
used that provide equal or higher levels of confidentially for DIV.
The masking process uses a Diversifier Hiding Key (DHK) which is a 128-bit key that is
never distributed.
DHK can be assigned, randomly generated by the device during manufacturing, part of
a key hierarchy (see Appendix B, Section B.2.3) or some other method could be used,
that results in DHK having 128 bits of entropy. If DHK is randomly generated then the
requirements for random generation defined in [Vol 2] Part H, Section 2 shall be used.
If DHK is changed then DIV values cannot be recovered from previously distributed
EDIV values.
Section A.1.1 defines a cryptographic function that is used by the responding device
when generating EDIV and recovering DIV.
DIV is masked before distribution and unmasked during the encryption session setup
using the output of the DIV mask generation function dm.
The following are inputs to the DIV mask generation function dm:
k is 128 bits
r is 64 bits
padding is 64 bits
r’ = padding || r
The least significant octet of r becomes the least significant octet of r’ and the most
significant octet of padding becomes the most significant octet of r’.
The output of the security function e is then truncated to 16 bits by taking the least
significant 16 bits of the output of e as the result of dm.
The responding device generates a 64-bit random value, Rand. The Rand value is
used to generate 16-bit Y using the DIV mask generation function dm with the input
parameter k set to DHK and the input parameter r set to Rand.
Y = dm(DHK, Rand)
The responding device then masks the DIV value to be distributed by bitwise XORing it
with Y to generate EDIV.
EDIV and Rand are distributed to an initiating device during the transport specific key
distribution phase using the Central Identification command.
The recovered DIV value can then used to recover LTK which is used to enable
encryption on the link.
The security provided by different methods can vary and care should be taken to ensure
that a chosen method is suitable for a device’s requirements.
Section B.1 uses a database for managing the keys. Section B.2 uses a key hierarchy
to manage the keys.
The requirements for random generation defined in [Vol 2] Part H, Section 2 shall be
used when generating LTK. This method provides an LTK with 128 bits of entropy.
CSRK, IRK, and other keys shall also be stored in the database. There is no
relationship between the keys stored in the database or distributed LTKs, EDIVs, or
Rands.
If the example EDIV and Rand generation method described in Section A.1 is used then
the database shall be used to store DHK. DIV should be used as the index to recover
LTK.
IR ER
Figure B.1 is an example key hierarchy where LTK and CSRK are generated from a
common ER key, and IRK is generated from a common IR key.
New LTK, EDIV, Rand, and CSRK values shall be generated each time they are
distributed. If ER is changed then any previously distributed LTK or CSRK keys will
no longer be valid.
The distributed IRK shall be the same for all devices it is distributed to. If IR is changed
then any previously distributed IRK keys will no longer be valid.
The distributing device only needs to store IR and ER. LTK, IRK, and CSRK can be
regenerated when they are required. This reduces the storage requirements on the
distributing device.
Section B.2.1 defines an example of the key diversifying function which can be used to
generate LTK, IRK, CSRK, and other keys. Other implementations of this function can
be used depending upon the exact security requirements of the device.
Diversified keys are generated with function d1. The diversifying function d1 makes use
of the security function e.
k is 128 bits
d is 16 bits
r is 16 bits
padding is 96 bits
d is concatenated with r and padding to generate d’, which is used as the 128-bit input
parameter plaintextData to security function e:
d’ = padding || r || d
The least significant octet of d becomes the least significant octet of d’ and the most
significant octet of padding becomes the most significant octet of d’.
For example, if the 16-bit value d is 0x1234 and the 16-bit value r is 0xABCD, then d’ is
0x000000000000000000000000ABCD1234.
The 128-bit output of the security function e is used as the result of diversifying function
d1.
The EDIV and Rand generation method described in Appendix A shall be used. LTK is
the result of the diversifying function d1 with the ER as the input parameter k, the DIV
as the input parameter d, and the value 0 as the input parameter r; see Section B.2.1.
LTK can be recovered from ER and DIV by repeating the calculation when LTK is
required.
CSRK is the result of the diversifying function d1 with the ER as the input parameter
k, the DIV as the input parameter d, and the value 1 as the input parameter r; see
Section B.2.1.
CSRK can be recovered from ER and DIV by repeating the calculation when CSRK is
required.
This method provides an LTK and CSRK with limited amount of entropy because LTK
and CSRK are directly related to EDIV and may be less secure than other generation
methods.
To reduce the probability of the same LTK or CSRK value being generated, the DIV
values must be unique for each CSRK, LTK, EDIV, and Rand set that is distributed.
A method for preventing a malicious device from repeatedly pairing and collecting
CSRK, LTK and DIV information, which could be used in a known plain text attack in
ER, should be implemented.
Note: The generation of LTK using ER is only applicable when doing LE Legacy Pairing.
The generation of CSRK using ER is applicable both when doing LE Legacy Pairing and
LE Secure Connections Pairing.
IR can be used to generate IRK and other required keys. IR can be assigned, randomly
generated by the device during manufacturing or some other method could be used,
that results in IR having 128 bits of entropy. If IR is randomly generated then the
requirements for random generation defined in Section A.1 shall be used.
IRK is the result of the diversifying function d1 with IR as the input parameter k and
the value 1 as the input parameter d and the value 0 as the input parameter r; see
Section B.2.1.
IRK = d1(IR, 1, 0)
If the example EDIV and Rand generation method described in EDIV and Rand
Generation, Section A.1 is used then DHK can be the result of diversifying function
d1 with IR as the input parameter k and the value 3 as the input parameter d and the
value 0 as the input parameter r.
DHK = d1(IR, 3, 0)
Other keys can be generated by using different values for k as the input to the
diversifying function d1. If the value of k is reused for a given IR then the resulting
key will be the same.
Note: The generation of DHK using IR is only applicable when doing LE Legacy Pairing.
The generation of IRK using IR is applicable both when doing LE Legacy Pairing and LE
Secure Connections Pairing.
This appendix illustrates only the most common scenarios; it does not cover all possible
alternatives. Furthermore, the message sequence charts do not consider errors over the
air interface or Host interface. If any of these charts differ with text elsewhere in this
Part, then that text overrides these charts.
A flow diagram of pairing is shown in Figure C.1. The process has 4 steps. Step 2 has a
number of different options.
Step 2a: Optional Short Step 2b: Optional Short Step 2c: Optional Short
Term Key (STK) Term Key (STK) Generation Term Key (STK)
Generation – Just Works – Passkey Entry Generation – OOB
Note: In all the MSCs, the Central is also the Initiating Device and the Peripheral is also
the Responding (non-Initiating) Device.
The Central initiates the pairing procedure using Pairing Request command as shown in
Figure C.2.
Central Peripheral
Pairing Response (IO Capability, OOB data flag, AuthReq, Max Enc Key Size, Init Key Distribution, Resp Key Distribution)
Phase 2 Pairing Method selected from parameters of Pairing Request and Pairing Response
The Peripheral may request the Central initiates security procedures. Figure C.3 shows
an example where the Peripheral requests security and the Central initiates pairing in
response.
Central Peripheral
Pairing Request (IO Capability, OOB data flag, AuthReq, Max Enc Key Size, Init Key Distribution, Resp Key Distribution)
Pairing Response (IO Capability, OOB data flag, AuthReq, Max Enc Key Size, Init Key Distribution, Resp Key Distribution)
After Pairing Feature Exchange has completed a pairing method is selected one of
the possible short term key generation sequences are used. This can be Just Works,
Passkey Entry or Out of Band pairing method.
The following subsections include message sequence charts for LE legacy pairing.
After Pairing Feature Exchange has completed a pairing method is selected. Figure C.4
shows the Just Works pairing method.
Central Peripheral
LP_CONFIRM_I = c1(TK, LP_RAND_I, Pairing Request LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device command, Pairing Response command, initiating device
address type, initiating device address, responding address type, initiating device address, responding
device address type, responding device address) device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
PairingConfirm (LP_CONFIRM_R)
PairingRandom (LP_RAND_I)
PairingRandom (LP_RAND_R)
Link is then encrypted using STK, see [Vol 6] Part D, Section 6.6
After Pairing Feature Exchange has completed, a pairing method is selected. Figure C.5
shows the Passkey Entry pairing method.
Central Peripheral
LP_CONFIRM_I = c1(TK, LP_RAND_I, Pairing Request LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device command, Pairing Response command, initiating device
address type, initiating device address, responding address type, initiating device address, responding
device address type, responding device address) device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
PairingConfirm (LP_CONFIRM_R)
PairingRandom (LP_RAND_I)
PairingRandom (LP_RAND_R)
Link is then encrypted using STK, see [Vol 6] Part D, Section 6.6
After Pairing Feature Exchange has completed, a pairing method is selected. Figure C.6
shows the Out of Band pairing method.
Central Peripheral
LP_CONFIRM_I = c1(TK, LP_RAND_I, Pairing Request LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device command, Pairing Response command, initiating device
address type, initiating device address, responding address type, initiating device address, responding
device address type, responding device address) device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
PairingConfirm (LP_CONFIRM_R)
PairingRandom (LP_RAND_I)
PairingRandom (LP_RAND_R)
Link is then encrypted using STK, see [Vol 6] Part D, Section 6.6
In Step 1a and 1b, the two devices exchange public keys. The Central sends its public
key to the Peripheral followed by Peripheral sending its public key to the Central.
Central Peripheral
The following subsections include message sequence charts for the success and failure
cases in each association model.
The numeric comparison step will be done when both devices have output capabilities,
or if one of the devices has no input or output capabilities. If both devices have output
capabilities, this step requires the displaying of a user confirmation value. This value
should be displayed until the end of step 2. If one or both devices do not have output
capabilities, the same protocol is used but the Hosts will skip the step asking for the
user confirmation.
Note: The sequence for Just Works is identical to that of Numeric Comparison with the
exception that the Host will not show the numbers to the user.
Central Peripheral
Calculate
confirmation
Pairing Confirm (Cb)
Check
Confirmation -
success
If the Confirm value calculated by the Initiator is not equal to the Commitment value
received from the Responder, the Initiator will abort Pairing process by sending Pairing
Failed with reason “Confirm Value Failed”.
Central Peripheral
Calculate
confirmation
Pairing Confirm (Cb)
Check
Confirmation
Abort if
mismatch
Pairing Failed (confirm check failure)
Figure C.9: Pairing Phase 2, authentication stage 1, Numeric Comparison – Confirm Check failure on
Initiator side
If the numeric comparison fails on the initiating side due to the user indicating that the
confirmation values do not match, Pairing is terminated.
Central Peripheral
Calculate
confirmation
Pairing Confirm (Cb)
Check
Confirmation -
success
Figure C.10: Pairing Phase 2, authentication stage 1, Numeric Comparison failure on Initiator side
If the numeric comparison fails on the responding side due to the user indicating that
the confirmation values do not match, Pairing is terminated.
Central Peripheral
Calculate
confirmation
Pairing Confirm (Cb)
Check
Confirmation -
success
Figure C.11: Pairing Phase 2, authentication stage 1, Numeric Comparison failure on Responding side
The Passkey Entry step is used in two cases: when one device has numeric input
only and the other device has either a display or numeric input capability. In this step,
one device display a number to be entered by the other device or the user enters a
number on both devices. Key press notification messages are shown during the user
input phase.
Central Peripheral
Example Notifications
Repeat 20 times
Check Confirm
(matches)
Pairing Random (Nbi)
Check Confirm
(matches)
Note: Passkey Entry may prolong pairing experience because of the time required to
execute 20 repetitions over SMP.
If during one of the 20 repetitions, the Confirm calculated by the Responder is not equal
to the one received from the Initiator, the Responder will abort the Pairing process by
sending Pairing Failed with reason “Confirm Value Failed.”
Central Peripheral
Check Confirm
(does not match)
Pairing Failed (Confirm Value Failed)
Figure C.13: Pairing Phase 2, authentication stage 1, Passkey Entry – Confirm Check failure on
Responder side
If during one of the 20 repetitions, the Confirm calculated by the Initiator is not equal
to the one received from the Responder, the Initiator will abort the Pairing process by
sending Pairing Failed with reason “Confirm Value Failed”.
Central Peripheral
Example Notifications
Repeat 20 times
Check Confirm
(matches)
Pairing Random (Nbi)
Check Confirm
(does not match)
Pairing Failed
Figure C.14: Pairing Phase 2, authentication stage 1, Passkey Entry – Confirm Check failure on Initiator
side
Central Peripheral
Figure C.15: Pairing Phase 2, authentication stage 1, Passkey Entry failure on Responding side
Central Peripheral
Figure C.16: Pairing Phase 2, authentication stage 1, Passkey Entry failure on Initiator side
The OOB authentication will only be done when at least one device has some OOB
information to use. This step requires no user interaction.
Central Peripheral
Pick Na Pick Nb
Pairing Random (Na)
If the Confirm value received from OOB is not equal to the calculated Confirm value, the
Responder will abort the Pairing process by sending Pairing Failed with reason “Confirm
Value Failed”.
Central Peripheral
Pick Na Pick Nb
Pairing Random (Na)
Figure C.18: Pairing Phase 2, authentication stage 1, Out of Band – Confirm Check failure on Responder
side
If the Confirm value received from OOB is not equal to the calculated Confirm value, the
Initiator will abort the Pairing process by sending Pairing Failed with reason "Confirm
Value Failed".
Central Peripheral
Pick Na Pick Nb
Pairing Failed (Confirm Value Failed)
Figure C.19: Pairing Phase 2: authentication stage 1, Out of Band – Confirm Check failure on Initiator
side
C.2.2.2.13 Out of Band Failure on the Initiator side (OOB information not available)
If the initiating side does not have the responder's OOB information, Pairing is
terminated.
Central Peripheral
Figure C.20: Pairing Phase 2, authentication stage 1, Out of Band failure on Initiator side
C.2.2.2.14 Out of Band Failure on the Responding side (OOB information not available)
If the responding side does not have the initiator's OOB information, Pairing is
terminated.
Central Peripheral
Figure C.21: Pairing Phase 2, authentication stage 1, Out of Band failure on Responding side
Once the DHKey generation is complete, the Long Term Key (LTK) is calculated from
the DHKey.
Central Peripheral
DHKey DHKey
calculation calculation
finished finished
Once the LTK calculation and authentication stage 1 have completed, the DHKey value
generated is checked by exchanging DHKey Check values generated using the DHKey.
If this succeeds, then both devices would have finished displaying information to the
user about the process, and therefore the Host can stop displaying this information.
Central Peripheral
Calculate Calculate
DHKey Check DHKey Check
value Ea value Eb
Check DHKey
Check value Ea
(check
successful)
Check DHKey
Check value Eb
(check
successful)
Central Peripheral
The Central initiates encryption procedures. There is no SM signaling to enable this; the
Central initiates Link Layer encryption only. See [Vol 6] Part D, Section 6.6.
The Peripheral may request the Central initiates security procedures. Figure C.25
shows an example where the Peripheral requests security and the Central initiates Link
Layer encryption.
Central Peripheral
Figure C.25: Peripheral security request, Central initiates Link Layer encryption
If the Peripheral does not support pairing or pairing cannot be performed the Peripheral
can reject the request from the Central. Figure C.26 shows the Peripheral rejecting a
Pairing Request command from the Central.
Central Peripheral
Step 1: Peripheral device does not support pairing or pairing cannot be performed
Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
During Pairing Feature Exchange the size of the Encryption Key is negotiated.
Figure C.27 shows an example where the Central terminates the pairing procedure
because the resulting key size is not acceptable.
Central Peripheral
Step 1: Peripheral device does not support pairing or pairing cannot be performed
Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Pairing Response (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
During Pairing Feature Exchange the size of the Encryption Key is negotiated.
Figure C.28 shows an example where the Peripheral terminates the pairing procedure
because the resulting key size is not acceptable.
Central Peripheral
Step 1: Peripheral rejects pairing because the Encryption Key Size is not sufficient
Alt Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Pairing Response (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Alt Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
During Passkey Entry pairing the user enters a passkey on both devices. Figure C.29
shows an example where the passkey entry fails on the Central.
Central Peripheral
Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Pairing Response (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Create LP_RAND_R
Set TK = User input passkey
Passkey is not entered
LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device
address type, initiating device address, responding
device address type, responding device address)
During Passkey Entry pairing the user enters a passkey on both devices. Figure C.30
shows an example where the passkey entry fails on the Peripheral.
Central Peripheral
Pairing Request (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Pairing Response (IO Capability, OOB data flag, AuthReq, Maximum Encryption Key Size, Key Distribution)
Create LP_RAND_R
Set TK = User input passkey
Passkey is not entered
LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device
address type, initiating device address, responding
device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
During Passkey Entry pairing the user enters a passkey on both devices. Figure C.31
shows an example where a different passkey is entered on both devices. This sequence
could also occur if any of the inputs to c1 (Passkey, LP_RAND_I, LP_RAND_R, Pairing
Central Peripheral
LP_CONFIRM_I = c1(TK, LP_RAND_I, Pairing Request LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device command, Pairing Response command, initiating device
address type, initiating device address, responding address type, initiating device address, responding
device address type, responding device address) device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
PairingConfirm (LP_CONFIRM_R)
PairingRandom (LP_RAND_I)
During all the pairing methods the Central and Peripheral send random numbers and
confirm values. Figure C.32 shows an example where the Central rejects pairing
because it cannot verify the confirm value from the Peripheral because any of the
Central Peripheral
LP_CONFIRM_I = c1(TK, LP_RAND_I, Pairing Request LP_CONFIRM_R = c1(TK, LP_RAND_R, Pairing Request
command, Pairing Response command, initiating device command, Pairing Response command, initiating device
address type, initiating device address, responding address type, initiating device address, responding
device address type, responding device address) device address type, responding device address)
PairingConfirm (LP_CONFIRM_I)
PairingConfirm (LP_CONFIRM_R)
PairingRandom (LP_RAND_I)
PairingRandom (LP_RAND_R)
In each data set in this section, the bytes are ordered from most significant on the left to
least significant on the right. ‘M’ represents the message byte array for which the AES
CMAC is calculated.
M <empty string>
AES_CMAC bb1d6929 e9593728 7fa37d12 9b756746