bleGAPDataBlockConfig
Bluetooth LE GAP data block configuration parameters
Description
The bleGAPDataBlockConfig
parameterizes the bleGAPDataBlock
function to
generate a Bluetooth® low energy (LE) generic access profile (GAP) data block of the type advertising
data (AD) or scan response data (SRD).
Creation
Description
creates a
default configuration object, cfgGAP
= bleGAPDataBlockConfigcfgGAP
, for a Bluetooth LE GAP data
block of the type AD or SRD.
sets properties using one or more
name-value pairs. Enclose each property name in quotes. For example,
cfgGAP
= bleGAPDataBlockConfig(Name,Value
)('AdvertisingDataTypes','Tx power level')
sets the block data
advertising data type to 'Tx power level'
.
Properties
Note
For more information about Bluetooth LE GAP data block properties and their respective values, see Volume 3, Part C, Section 4 of the Bluetooth Core Specification [2].
AdvertisingDataTypes
— Block data advertising data types
'Flags'
(default) | 'UUIDs'
| 'Local name'
| 'Tx power level'
| 'Connection interval range'
| 'Advertising interval'
Block data advertising data types, specified as a character vector, a string scalar or a cell array, containing the list of advertising data types for Bluetooth LE GAP data block. Specify this property as one of these values:
'Flags'
'UUIDs'
'Local name'
'Tx power level'
'Connection interval range'
'Advertising interval'
Data Types: char
| string
| cell
LEDiscoverability
— LE discoverable mode
'General'
(default) | 'None'
| 'Limited'
| 'Limited and general'
LE discoverable mode, specified as a character vector or a string scalar, describing the LE discoverable mode of the device. Specify this property as one of these values:
'None'
'General'
'Limited'
'Limited and general'
Data Types: char
| string
BREDR
— Flag to enable basic rate (BR) or enhanced data rate (EDR ) support
0
or false
| 1
or true
Flag to enable basic rate (BR) or enhanced data rate (EDR ) support, specified as
1
(true
) or 0
(false
). A 1
(true
) value
indicates that the object supports BR or EDR mode.
Dependencies
To enable this property, set the
AdvertisingDataTypes
property to
'Flags'
.
Data Types: logical
LE
— Simultaneous LE and BR or EDR support
'None'
(default) | 'Host'
| 'Controller'
| 'Host and controller'
Simultaneous LE and BR/EDR support, specified as a character vector or a string scalar. Specify this property as one of these values:
'None'
— Simultaneous LE and BR or EDR support is disabled'Host'
— Simultaneous LE and BR or EDR support is enabled at the Host'Controller'
— Simultaneous LE and BR or EDR support is enabled at the Controller'Host and controller'
— Simultaneous LE and BR or EDR support is enabled at the Host and Controller
Dependencies
To enable this property, set the
BREDR
property to true
.
Data Types: char
| string
LocalNameShortening
— Flag to enable shortening of local name
0
or false
| 1
or true
Flag to enable shortening of local name, specified as 1
(true
) or 0
(false
).
Data Types: logical
LocalName
— UTF-8 encoded user-friendly descriptive name
'Bluetooth'
(default) | character vector or a string scalar consisting of UTF-8 characters
UTF-8 encoded user-friendly descriptive name, specified as a character vector or a string scalar consisting of UTF-8 characters. This property specifies the local name that the object assigns to the device.
Data Types: char
| string
IdentifierType
— Type of 16-bit service or service class identifiers
'Incomplete'
(default) | 'Complete'
Type of 16-bit service or service class identifiers, specified as
'Incomplete'
or 'Complete'
. If you set this
value to 'Incomplete'
, the Identifiers property is
incomplete.
Data Types: char
| string
Identifiers
— List of 16-bit service or service class identifiers
'' (empty)
(default) | n-by-4 character array
List of 16-bit service or service class identifiers, specified as an n-by-4 character array. The value of n must be in the range [0, 127]. Each row in the n-by-4 character array is represented as a 4-element character vector or a string scalar denoting a 2-octet (16-bit) hexadecimal value of a service or service class universally unique identifier (UUID). These UUIDs are assigned by the Bluetooth Special Interest Group (SIG).
Data Types: char
AdvertisingInterval
— Advertising interval
32
(default) | integer in the range [32, 65,535]
Advertising interval, specified as an integer in the range [32, 65,535]. This property denotes the interval between the start of two consecutive advertising events. Incremental units are in 0.625 ms steps, so the resultant range for [32, 65,535] is [20, 40.959375].
Data Types: double
TxPowerLevel
— Packet transmit power level
0 (dBm)
(default) | integer in the range [–127, 127]
Packet transmit power level, specified as an integer in the range [–127, 127]. This property calculates the pathloss as pathloss = Tx Power Level – RSSI, where RSSI is the received signal strength indicator.
Data Types: double
ConnectionIntervalRange
— Connection interval range
[6,3200]
(default) | 2-element numeric vector [MIN, MAX]
Connection interval range, specified as a 2-element numeric vector [MIN, MAX], where MIN and MAX values must be in the range [6, 3200]. MIN and MAX specify the minimum and maximum value for the connection interval, respectively. MIN must be less than or equal to MAX. Incremental units are 1.25 ms steps, so that the resultant range for [6, 3200] is [7.5, 4.0].
Data Types: double
Examples
Create Bluetooth LE GAP AD Block Configuration Objects
Create two unique Bluetooth LE GAP AD configuration objects: one with AD types 'Flags'
and 'Tx power level'
and the other with AD type 'Flags'
and simultaneous LE and BR or EDR support at the host.
Create a default Bluetooth LE GAP AD block configuration object. Set the values of AD types to 'Flags'
and 'Tx power level'
, LE discoverability to 'Limited'
and Tx power level to 45
.
cfgGAP = bleGAPDataBlockConfig; cfgGAP.AdvertisingDataTypes = {'Flags';'Tx power level'}; cfgGAP.LEDiscoverability = 'Limited'; cfgGAP.TxPowerLevel = 45
cfgGAP = bleGAPDataBlockConfig with properties: AdvertisingDataTypes: {2x1 cell} LEDiscoverability: 'Limited' BREDR: 0 TxPowerLevel: 45
Create another default Bluetooth LE GAP AD block configuration object, this time with AD type 'Flags'
and having simultaneous support for LE and BR/EDR at the Host. Set the values of LE discoverability to 'Limited'
. Enable BR or EDR support,
cfgGAP = bleGAPDataBlockConfig; cfgGAP.AdvertisingDataTypes = {'Flags'}; cfgGAP.LEDiscoverability = 'Limited and general'; cfgGAP.BREDR = true; cfgGAP.LE = 'Host'
cfgGAP = bleGAPDataBlockConfig with properties: AdvertisingDataTypes: {'Flags'} LEDiscoverability: 'Limited and general' BREDR: 1 LE: 'Host'
Create Bluetooth LE GAP AD Block Configuration Object Using Name-Value Arguments
Create a configuration object for a Bluetooth LE GAP AD block by using name-value pairs. Set the values of AD types to 'Advertising interval'
and 'Local name'
, advertising interval to 48
, local name to 'MathWorks'
and local name shortening to true
.
cfgGAP = bleGAPDataBlockConfig('AdvertisingDataTypes', ... {'Advertising interval', ... 'Local name'}); cfgGAP.AdvertisingInterval = 48; cfgGAP.LocalName = 'MathWorks'; cfgGAP.LocalNameShortening = true
cfgGAP = bleGAPDataBlockConfig with properties: AdvertisingDataTypes: {2x1 cell} LocalName: 'MathWorks' LocalNameShortening: 1 AdvertisingInterval: 48
End-to-End Workflow of Bluetooth LE GAP AD Blocks
Create a Bluetooth LE GAP AD block configuration object by using name-value pairs. Set the values of AD types to 'Advertising interval'
and 'Local name'
, advertising interval to 48
, local name as 'MathWorks'
, and local name shortening to true
.
cfgGAPTx = bleGAPDataBlockConfig('AdvertisingDataTypes',{'Advertising interval','Local name'}); cfgGAPTx.AdvertisingInterval = 48; cfgGAPTx.LocalName = 'MathWorks'; cfgGAPTx.LocalNameShortening = true
cfgGAPTx = bleGAPDataBlockConfig with properties: AdvertisingDataTypes: {2x1 cell} LocalName: 'MathWorks' LocalNameShortening: 1 AdvertisingInterval: 48
Generate a Bluetooth LE GAP AD block.
dataBlock = bleGAPDataBlock(cfgGAPTx);
Decode the generated Bluetooth LE GAP AD block. The returned status indicates decoding was successful.
[status,cfgGAPRx] = bleGAPDataBlockDecode(dataBlock)
status = blePacketDecodeStatus enumeration Success
cfgGAPRx = bleGAPDataBlockConfig with properties: AdvertisingDataTypes: {2x1 cell} LocalName: 'MathWorks' LocalNameShortening: 1 AdvertisingInterval: 48
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/.
[3] Bluetooth Special Interest Group (SIG). "Supplement to the Bluetooth Core Specification." CSS Version 7 (2016).
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 (한국어)