bleL2CAPFrameConfig
Bluetooth LE L2CAP frame configuration parameters
Description
The bleL2CAPFrameConfig
parameterizes the bleL2CAPFrame
function to generate a
Bluetooth® low energy (LE) logical link control and adaptation protocol (L2CAP) signaling
frame or data frame.
Creation
Description
creates a
default configuration object, cfgL2CAP
= bleL2CAPFrameConfigcfgL2CAP
, for a Bluetooth LE L2CAP
signaling command frame or data frame.
specifies properties
using one or more name-value pairs. Enclose each property name in quotes. For example,
cfgL2CAP
= bleL2CAPFrameConfig(Name,Value
)('CommandType','Command reject')
sets the type of signaling command
frame to 'Command reject'
.
Properties
Note
For more information about the Bluetooth LE L2CAP frame properties and their respective values, see Volume 3, Part A, Section 3 of the Bluetooth Core Specification [2].
ChannelIdentifier
— Identifier for logical channel endpoint
'0005'
(default) | 4-element character vector or string scalar denoting a 2-octet hexadecimal
value
Identifier for a logical channel endpoint, specified as a 4-element character vector
or a string scalar denoting a 2-octet hexadecimal value. This property specifies the
local name representing a logical channel endpoint. Use this value to identify the
command and data frames. The command frames use '0005'
as the
'ChannelIdentifier'
. The L2CAP B-frames use fixed
'ChannelIdentifier'
, '0004'
, for attribute
protocol (ATT) and '0006'
for security manager protocol (SMP).
Data Types: char
| string
CommandType
— Signaling command type
'Credit Based Connection request'
(default) | 'Command reject'
| 'Disconnection request'
| ...
Signaling command type, specified as a character vector or a string scalar. Specify this property as one of these values:
'Command reject'
'Disconnection request'
'Disconnection response'
'Connection parameter update request'
'Connection parameter update response'
'Credit based connection request'
'Credit based connection response'
'Flow control credit'
Dependencies
To enable this property, set the
ChannelIdentifier property to '0005'
.
Data Types: char
| string
SignalIdentifier
— Identifier for request-response frame exchange
'01'
(default) | 2-element character vector or string scalar denoting 1-octet hexadecimal
value
Identifier for a request-response frame exchange, specified as a 2-element character
vector or string scalar denoting a 1-octet hexadecimal value. The requesting device sets
the value of this property and the responding device uses the same value in its
response. The value of this property cannot be set to '00'
.
Data Types: char
| string
CommandRejectReason
— Reason for rejecting received signaling command frame
'Command not understood'
(default) | 'Signaling MTU exceeded'
| 'Invalid CID in request'
Reason for rejecting the received signaling command frame, specified as a character vector or a string scalar. Specify this property as one of these values:
'Command not understood'
'Signaling MTU exceeded'
'Invalid CID in request'
This property specifies the reason for rejecting a signaling command frame.
Data Types: char
| string
SourceChannelIdentifier
— Source logical channel endpoint
'0040'
(default) | 4-element character vector or string scalar denoting 2-octet hexadecimal
value
Source logical channel endpoint, specified as a 4-element character vector or string scalar denoting a 2-octet hexadecimal value. This property specifies the source channel endpoint from which the object send or receives request. When the channel is created using the credit-based connection procedure, the object sends the data packets flowing to the sender of the request to this value.
Data Types: char
| string
DestinationChannelIdentifier
— Destination logical channel endpoint
'0040'
(default) | 4-element character vector or string scalar denoting 2-octet hexadecimal
value
Destination logical channel endpoint, specified as a 4-element character vector or string scalar denoting a 2-octet hexadecimal value. This property specifies the destination channel endpoint from which the object send or receives request. When the channel is created using the credit-based connection procedure, the object sends the data packets flowing to the destination of the request to this value.
Data Types: char
| string
ConnectionIntervalRange
— Connection interval range
[6,3200]
(default) | 2-element numeric vector specified as [MIN,
MAX]
Connection interval range, specified as a 2-element numeric vector in the form of [MIN, MAX]. MIN and MAX specify the minimum and the maximum value of this property, respectively. Specify MIN and MAX values in the range [6, 3200]. MIN must be less than or equal to MAX. Each unit for MIN or MAX is taken as 1.25 ms so the resultant value is in the range [7.5 ms, 4.0 s].
Data Types: double
ConnectionTimeout
— Connection supervision timeout
10 (100 ms)
(default) | integer in the range [Mct, 3200]
Connection supervision timeout, specified as an integer in the range
[Mct, 3200], where Mct is the larger of 10 and
((1+PeripheralLatency
)×(ConnectionInterval
×1.25)×2)/10.
This property indicates the timeout for a connection if no valid packet is received
within this time. Each unit is taken as 10 ms so that the resultant connection timeout,
(ConnectionInterval
×10), is in the range [100 ms, 32.0s].
Data Types: double
PeripheralLatency
— Number of link layer connection events a Peripheral can ignore
0
(default) | integer in the range [0, Msl]
Number of link layer connection events a Peripheral can ignore, specified as an
integer in the range [0, Msl], where Msl is the
lesser of 499 and
((ConnectionTimeout
×10)/((ConnectionInterval
×1.25)×2))-1.
Data Types: double
ParameterUpdateResult
— Result of connection parameters update
'Accepted'
(default) | 'Rejected'
Result of the connection parameters update, specified as
'Accepted'
or 'Rejected'
. This property
indicates the response to the 'Connection Parameter Update Request'
value of the CommandType
property and specifies the result after
updating the connection parameters.
Data Types: char
| string
LEPSM
— LE protocol or service multiplexer
'001F'
(default) | 4-element character vector or string scalar denoting 2-octet hexadecimal
value
LE protocol or service multiplexer, specified as a 4-element character vector or a string scalar denoting a 2-octet hexadecimal value. The value of this property is a unique number specified by the Special Interest Group (SIG) for each protocol. The SIG assigns the value of this property within the range [0x0001, 0x007F] for a set of existing protocols. The SIG dynamically assigns the value of this property in the range [0x0080, 0x00FF] to the implemented protocols.
Data Types: char
| string
MaxTransmissionUnit
— Maximum service data unit (SDU) size
23
(default) | integer in the range of [23, 65,535]
Maximum service data unit (SDU) size, specified as an integer in the range of [23, 65,535] octets. This property specifies the maximum acceptable SDU size for the upper-layer entity.
Data Types: double
MaxPDUPayloadSize
— Maximum protocol data unit (PDU) payload size
23
(default) | integer in the range of [23, 65,535]
Maximum protocol data unit (PDU) payload size, specified as an integer in the range of [23, 65,535] octets. This property specifies the maximum acceptable payload data for the L2CAP layer entity.
Data Types: double
Credits
— Number of LE frames peer device can send or receive
1
(default) | integer in the range of [0, 65,535]
Number of LE-frames peer device can send or receive, specified as an integer in the
range of [0, 65,535] octets. This property indicates the number of LE-frames that the
peer device can send or receive. If the value of the CommandType property is set to 'Flow control credit'
,
then this property cannot be set to 0
.
Data Types: double
ConnectionResult
— Result of credit-based connection procedure
'Successful'
(default) | 'LEPSM not supported'
| 'No resources available'
| ...
Result of the credit-based connection procedure, specified as a character vector or a string scalar. Specify this property as one of these values:
'Successful'
'LEPSM not supported'
'No resources available'
'Insufficient authentication'
'Insufficient authorization'
'Insufficient encryption key size'
'Insufficient encryption'
'Invalid Source CID'
'Source CID already allocated'
'Unacceptable parameters'
This property indicates the outcome of the connection request.
Data Types: char
| string
Examples
Create Bluetooth LE L2CAP Frame Configuration Object Using Default Settings
Create a default Bluetooth LE L2CAP frame configuration object.
cfgL2CAP = bleL2CAPFrameConfig
cfgL2CAP = bleL2CAPFrameConfig with properties: ChannelIdentifier: '0005' CommandType: 'Credit based connection request' SignalIdentifier: '01' SourceChannelIdentifier: '0040' LEPSM: '001F' MaxTransmissionUnit: 23 MaxPDUPayloadSize: 23 Credits: 1
Set the value of credits to 10
.
cfgL2CAP.Credits = 10
cfgL2CAP = bleL2CAPFrameConfig with properties: ChannelIdentifier: '0005' CommandType: 'Credit based connection request' SignalIdentifier: '01' SourceChannelIdentifier: '0040' LEPSM: '001F' MaxTransmissionUnit: 23 MaxPDUPayloadSize: 23 Credits: 10
Create Bluetooth LE L2CAP Configuration Object Using Name-Value Arguments
Create a Bluetooth LE L2CAP frame configuration object, 'cfgL2CAP'
, by setting the value of channel identifier as '0004'
using name-value pairs. This configuration object sets properties to generate a Bluetooth LE L2CAP data frame (B-frame).
cfgL2CAP = bleL2CAPFrameConfig('ChannelIdentifier','0004')
cfgL2CAP = bleL2CAPFrameConfig with properties: ChannelIdentifier: '0004'
End-to-End Workflow of Bluetooth LE L2CAP Frames
Create a Bluetooth LE L2CAP configuration object to generate a L2CAP data frame (B-frame). Set the value of channel identifier as'0004'
.
cfgL2CAPTx = bleL2CAPFrameConfig('ChannelIdentifier','0004')
cfgL2CAPTx = bleL2CAPFrameConfig with properties: ChannelIdentifier: '0004'
Generate a Bluetooth LE L2CAP data frame (B-frame), specifying the service data unit (SDU) from ATT as '0A0100'
.
l2capFrame = bleL2CAPFrame(cfgL2CAPTx,"0A0100")
l2capFrame = 7x2 char array
'03'
'00'
'04'
'00'
'0A'
'01'
'00'
Decode the generated Bluetooth LE L2CAP data frame (B-frame). The returned status indicates decoding was successful.
[status,cfgL2CAPRx,SDU] = bleL2CAPFrameDecode(l2capFrame)
status = blePacketDecodeStatus enumeration Success
cfgL2CAPRx = bleL2CAPFrameConfig with properties: ChannelIdentifier: '0004'
SDU = 3x2 char array
'0A'
'01'
'00'
References
[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 22, 2021. https://www.bluetooth.com/.
[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2019b
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)