bleLLAdvertisingChannelPDUConfig
Bluetooth LE LL advertising channel PDU configuration parameters
Description
The bleLLAdvertisingChannelPDUConfig
object parameterizes the
bleLLAdvertisingChannelPDU
function to generate a Bluetooth® low energy (LE) link layer (LL) advertising channel protocol data unit
(PDU).
Creation
Syntax
Description
creates a default Bluetooth LE LL advertising channel PDU configuration object,
cfgLLAdv
= bleLLAdvertisingChannelPDUConfigcfgLLAdv
.
sets properties
using one or more name-value pairs. Enclose each property name in quotation marks. For
example, cfgLLAdv
= bleLLAdvertisingChannelPDUConfig(Name,Value
)('PDUType','Scan response')
sets the type of Bluetooth LE LL
advertising channel PDU to 'Scan response'
.
Properties
Note
For more information about Bluetooth LE LL advertising channel PDU properties and their respective values, see Volume 6, Part B, Section 2.3 of the Bluetooth Core Specification [2].
PDUType
— Bluetooth LE LL advertising channel PDU type
'Advertising indication'
(default) | 'Advertising direct indication'
| 'Advertising non connectable indication'
| ...
Bluetooth LE LL advertising channel PDU type, specified as a character vector or a string scalar. Specify this property as one of these values:
'Advertising indication'
'Advertising direct indication'
'Advertising non connectable indication'
'Scan request'
'Scan response'
'Connection indication'
'Advertising scannable indication'
Data Types: char
| string
ChannelSelection
— Channel selection algorithm
'Algorithm1'
(default) | 'Algorithm2'
Channel selection algorithm, specified as 'Algorithm1'
or
'Algorithm2'
. This value indicates the type of algorithm that the
object uses to hop between channels.
Data Types: char
| string
AdvertiserAddressType
— Advertiser device address type
'Random'
(default) | 'Public'
Advertiser device address type, specified as 'Random'
or
'Public'
.
Data Types: char
| string
AdvertiserAddress
— Advertiser device address
'0123456789AB'
(default) | 12-element character vector or string scalar denoting a 6-octet hexadecimal
value
Advertiser device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value.
Data Types: char
| string
TargetAddressType
— Target device address type
'Random'
(default) | 'Public'
Target device address type, specified as 'Random'
or
'Public'
. This value indicates the type of target device address
when a directed advertisement packet is transmitted.
Data Types: char
| string
TargetAddress
— Target device address
'0123456789CD'
(default) | 12-element character vector or string scalar denoting a 6-octet hexadecimal
value
Target device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the target device address when a directed advertisement packet is transmitted.
Data Types: char
| string
ScannerAddressType
— Scanner device address type
'Random'
(default) | 'Public'
Scanner device address type, specified as 'Random'
or
'Public'
. This value indicates the type of scanner device address
when a scan request packet is transmitted.
Data Types: char
| string
ScannerAddress
— Scanner device address
'0123456789CD'
(default) | 12-element character vector or string scalar denoting a 6-octet hexadecimal
value
Scanner device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the scanner device address when a scan request packet is transmitted.
Data Types: char
| string
InitiatorAddressType
— Initiator device address type
'Random'
(default) | 'Public'
Initiator device address type, specified as 'Random'
or
'Public'
. This value indicates the type of initiator device address
when a connection indication packet is transmitted.
Data Types: char
| string
InitiatorAddress
— Initiator device address
'0123456789CD'
(default) | 12-element character vector or string scalar denoting a 6-octet hexadecimal
value
Initiator device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the initiator device address when a connection indication packet is transmitted.
Data Types: char
| string
AdvertisingData
— Advertising data
'020106'
(default) | character vector | string scalar | numeric vector of elements in the range [0,31] | n-by-2 character array
Advertising data, specified as one of these values:
Character vector — This vector represent octets in hexadecimal format.
String scalar — This scalar represent octets in hexadecimal format.
Numeric vector of elements in the range [0,31] — This vector represent octets in decimal format.
n-by-2 character array — Each row represent an octet in hexadecimal format.
This value indicates the advertising data that the device sends out in an advertisement packet.
Data Types: char
| string
| double
ScanResponseData
— Scan response data
'020106'
(default) | character vector | string scalar | numeric vector of elements in the range [0,31] | n-by-2 character array
Scan response data, specified as one of these values:
Character vector — This vector represent octets in hexadecimal format.
String scalar — This scalar represent octets in hexadecimal format.
Numeric vector of elements in the range [0,31] — This vector represent octets in decimal format.
n-by-2 character array — Each row represent an octet in hexadecimal format.
This value indicates the scan response data that the device sends out in a scan response packet (when scan request is received).
Data Types: char
| string
| double
AccessAddress
— Unique connection address
'01234567'
(default) | 8-element character vector or a string scalar
Unique connection address, specified as an 8-element character vector or a string scalar. This property indicates a unique 32-bit address that the LL generates for a new connection or periodic advertisement between two devices.
Data Types: char
| string
CRCInitialization
— Cyclic redundancy check (CRC) initialization value
'012345'
(default) | 6-element character vector | string scalar denoting 3-octet hexadecimal value
CRC initialization value, specified as a 6-element character vector or a string scalar denoting a 3-octet hexadecimal value. The object uses this property to initialize the CRC calculation.
Data Types: char
| string
WindowSize
— Transmit window size
1
(default) | nonnegative integer
Transmit window size, specified as a nonnegative integer in the range [1,
Mws], where Mws is the lesser of 8 and ConnectionInterval-1. This property indicates the window size within which
the Central transmits the data packet and Peripheral listens for the data packet after
connection establishment. Each unit is taken as 1.25 ms so that the (WindowSize×1.25) is in the range [1.25, min(10,
((ConnectionInterval
×1.25) - 1.25) ms)] ms.
Data Types: double
WindowOffset
— Transmit window offset
0
(default) | nonnegative integer
Transmit window offset, specified as a nonnegative integer in the range [0,
Mwo], where Mwo is the lesser of 3200 and
ConnectionInterval
. This value indicates the window offset after
which the transmit window starts. Each unit is taken as 1.25 ms so that the resultant
window offset (WindowOffset×1.25) is in the range of [0,
(ConnectionInterval
×1.25)] ms.
Data Types: double
ConnectionInterval
— Connection interval
6 (7.5 ms)
(default) | integer in the range [6, 3200]
Connection interval, specified as an integer in the range [6, 3200]. This value
indicates the interval between the start of two consecutive connection events. Each unit
is taken as 1.25 ms so that the resultant connection interval
(ConnectionInterval
×1.25) is in the range [7.5 ms, 4.0
s].
Data Types: double
PeripheralLatency
— Peripheral latency
0
(default) | nonnegative integer in the range [0, Msl]
Peripheral latency, specified as a nonnegative integer in the range [0,
Msl], where Msl is the lesser of 499 and
((ConnectionInterval
×10)/((ConnectionInterval
×1.25)×2))-1.
This value indicates the number of connection events that a Peripheral can skip
listening for packets from the Central.
Data Types: double
ConnectionTimeout
— Connection supervision timeout
10
(default) | positive integer in the range [Mct, 3200]
Connection supervision timeout, specified as a positive integer in the range
[Mct, 3200], where Mct is the greater of 10 and
((1+PeripheralLatency
)×(ConnectionInterval
×1.25)×2)/10.
This value 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 of [100 ms, 32.0
s].
Data Types: double
UsedChannels
— List of used data channels
row vector containing the channel indices between [0:36] (default) | integer vector with element values in the range [0, 36]
List of used data channels, specified as an integer vector with element values in the range [0, 36]. The vector length must be greater than 1. At least two channels must be set as used (good) channels. This value indicates the set of good channels that the Central classifies.
Data Types: double
HopIncrement
— Hop increment count
5
(default) | integer in the range [5, 16]
Hop increment count, specified as an integer in the range [5, 16]. This property indicates the hop increment count that the object uses to hop between data channels.
Data Types: double
SleepClockAccuracy
— Central sleep clock accuracy
'251 to 500 ppm'
(default) | '151 to 250 ppm'
| '101 to 150 ppm'
| ...
Central sleep clock accuracy, specified as a character vector or a string scalar indicating the worst case Central sleep clock accuracy. Specify this property as one of these values:
'251 to 500 ppm'
'151 to 250 ppm'
'101 to 150 ppm'
'76 to 100 ppm'
'51 to 75 ppm'
'31 to 50 ppm'
'21 to 30 ppm'
'0 to 20 ppm'
Data Types: char
| string
Examples
Create Bluetooth LE LL Advertising Channel PDU Configuration Object
Create a default Bluetooth LE LL advertising channel configuration object.
cfgLLAdv = bleLLAdvertisingChannelPDUConfig
cfgLLAdv = bleLLAdvertisingChannelPDUConfig with properties: PDUType: 'Advertising indication' ChannelSelection: 'Algorithm1' AdvertiserAddressType: 'Random' AdvertiserAddress: '0123456789AB' AdvertisingData: [3x2 char]
Create Bluetooth LE LL Advertising Channel PDU Configuration Object Using Name-Value Arguments
Create two unique Bluetooth LE LL advertising channel configuration objects of type 'Scan response'
and 'Connection indication'
using name-value arguments.
Create a Bluetooth LE LL advertising channel PDU configuration object by setting the values of PDU type to 'Scan response'
, advertiser address to '1234567890AB'
, and scan response data to '020106020AD3'
.
cfgLLAdv = bleLLAdvertisingChannelPDUConfig('PDUType','Scan response', ... 'AdvertiserAddress','1234567890AB', ... 'ScanResponseData','020106020AD3')
cfgLLAdv = bleLLAdvertisingChannelPDUConfig with properties: PDUType: 'Scan response' AdvertiserAddressType: 'Random' AdvertiserAddress: '1234567890AB' ScanResponseData: [6x2 char]
Create another Bluetooth LE LL advertising channel PDU configuration object and specify the type of PDU as 'Connection indication'
. Set the values of the connection interval as 64
and the set of data channels as [0 4 12 16 18 24 25]
.
cfgLLAdv = bleLLAdvertisingChannelPDUConfig('PDUType','Connection indication'); cfgLLAdv.ConnectionInterval = 64; cfgLLAdv.UsedChannels = [0 4 12 16 18 24 25]
cfgLLAdv = bleLLAdvertisingChannelPDUConfig with properties: PDUType: 'Connection indication' ChannelSelection: 'Algorithm1' AdvertiserAddressType: 'Random' AdvertiserAddress: '0123456789AB' InitiatorAddressType: 'Random' InitiatorAddress: '0123456789CD' AccessAddress: '01234567' CRCInitialization: '012345' WindowSize: 1 WindowOffset: 0 ConnectionInterval: 64 PeripheralLatency: 0 ConnectionTimeout: 10 UsedChannels: [0 4 12 16 18 24 25] HopIncrement: 5 SleepClockAccuracy: '251 to 500 ppm'
End-to-End Workflow of Bluetooth LE LL Advertising Channel PDU
Create a Bluetooth LE LL advertising channel PDU configuration object, specifying the values of PDU type as 'Connection indication'
, the connection interval as 8
, and the set of data channels as [0 4 12 16 18 24 25]
.
cfgLLAdvTx = bleLLAdvertisingChannelPDUConfig('PDUType','Connection indication'); cfgLLAdvTx.ConnectionInterval = 8; cfgLLAdvTx.UsedChannels = [0 4 12 16 18 24 25]
cfgLLAdvTx = bleLLAdvertisingChannelPDUConfig with properties: PDUType: 'Connection indication' ChannelSelection: 'Algorithm1' AdvertiserAddressType: 'Random' AdvertiserAddress: '0123456789AB' InitiatorAddressType: 'Random' InitiatorAddress: '0123456789CD' AccessAddress: '01234567' CRCInitialization: '012345' WindowSize: 1 WindowOffset: 0 ConnectionInterval: 8 PeripheralLatency: 0 ConnectionTimeout: 10 UsedChannels: [0 4 12 16 18 24 25] HopIncrement: 5 SleepClockAccuracy: '251 to 500 ppm'
Generate a Bluetooth LE LL advertising channel PDU by using the corresponding configuration object.
pdu = bleLLAdvertisingChannelPDU(cfgLLAdvTx);
Decode the generated Bluetooth LE LL advertising channel PDU. The returned status indicates decoding is successful.
[status,cfgLLAdvRx] = bleLLAdvertisingChannelPDUDecode(pdu)
status = blePacketDecodeStatus enumeration Success
cfgLLAdvRx = bleLLAdvertisingChannelPDUConfig with properties: PDUType: 'Connection indication' ChannelSelection: 'Algorithm1' AdvertiserAddressType: 'Random' AdvertiserAddress: '0123456789AB' InitiatorAddressType: 'Random' InitiatorAddress: '0123456789CD' AccessAddress: '01234567' CRCInitialization: '012345' WindowSize: 1 WindowOffset: 0 ConnectionInterval: 8 PeripheralLatency: 0 ConnectionTimeout: 10 UsedChannels: [0 4 12 16 18 24 25] HopIncrement: 5 SleepClockAccuracy: '251 to 500 ppm'
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 Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)