bluetoothLEConnectionConfig
Description
Use bluetoothLEConnectionConfig
object to set the link layer
(LL) connection configuration parameters at a Bluetooth® low energy (LE) Central or Peripheral node.
Creation
Syntax
Description
creates a default Bluetooth LE connection configuration object that shares the LL
connection configuration parameters between a Central node and a Peripheral node.cfgConnection
= bluetoothLEConnectionConfig
sets properties by
using one or more name-value arguments. For example,
cfgConnection
= bluetoothLEConnectionConfig(Name=Value
)ConnectionInterval=0.04
sets the connection interval to 0.04
seconds.
Properties
ConnectionInterval
— LL connection interval
0.02
(default) | scalar in the range [0.0075, 4]
LL connection interval, specified as a scalar in the range [0.0075, 4]. Specify this
value in seconds. This property specifies the interval between the start of two
consecutive LL connection events. Set this value as an integer multiple of 1.25
milliseconds. If the LL connection includes connected isochronous stream (CIS) events,
set this property as a multiple of (NumPeripherals
× 1.25), where
NumPeripherals
specifies the total number of Peripheral nodes
simulated in the network. For more information about the connection interval, see Volume
6, Part B, Section 4.5.1 of Bluetooth Core Specification v5.3 [2].
Data Types: double
AccessAddress
— Unique connection address
"5DA44270"
(default) | 8-element character vector | string scalar denoting a 4-octet hexadecimal value
Unique connection address, specified as an 8-element character vector or a string scalar denoting a 4-octet hexadecimal value. This property specifies a unique 32-bit access address for the LL connection between a Central node and a Peripheral node.
Data Types: char
| string
UsedChannels
— List of used (good) data channels
[0:36]
(default) | 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]. This value specifies the indices of the assigned data channels. This property indicates the set of good channels used by the connection. To ensure that at least two channels are set as used (good) channels, specify a vector length greater than 1.
Data Types: double
Algorithm
— Channel selection algorithm
1
(default) | 2
Algorithm, specified as 1
or 2
representing
"Algorithm #1" or "Algorithm #2", respectively. This property specifies the channel
selection algorithm for LL connection events.
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 specifies the number of hops between data channels. If you set the Algorithm property to 1, the object uses this value as an input.
Data Types: double
CRCInitialization
— Cyclic redundancy check (CRC) initialization
"012345"
(default) | 6-element character vector | string scalar denoting a 3-octet hexadecimal value
CRC initialization, specified as a 6-element character vector or a string scalar denoting a 3-octet hexadecimal value.
Data Types: char
| string
SupervisionTimeout
— LL connection supervision timeout
1
(default) | scalar in the range [0.1, 32]
LL connection supervision timeout, specified as a scalar in the range [0.1, 32]. Specify this value in seconds. This property specifies the timeout for a LL connection if no valid packet is received within this time. Set this value as a multiple of 10 milliseconds.
Data Types: double
PHYMode
— Generating or decoding physical layer (PHY) mode
"LE1M"
(default) | "LE2M"
| "LE125K"
| "LE500K"
PHY mode for generating or decoding, specified as "LE1M"
,
"LE2M"
, "LE125K"
, or
"LE500K"
.
Data Types: char
| string
InstantOffset
— Number of connection events after which new channel map is enforced
6
(default) | integer in the range [6, 65535]
Offset added to the connection event counter, specified as an integer in the range
[6, 65535]. Specify this value in seconds. The object updates the channel map after
InstantOffset
connection events from the current connection
event.
Data Types: double
ConnectionOffset
— Offset for starting connection event
0
(default) | scalar in the range [0, ConnectionInterval
]
Offset for starting connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. Within a connection interval, after the connection offset, communication begins between the Central and Peripheral node.
If the connection between a Central and a Peripheral node includes CIS events,
specify this property as . For the first connection, the ConnectionOffsetOld
value is 0. For the subsequent connections, the ConnectionOffsetOld
value specifies the previous connection. The NumPeripherals
value
specifies the total number of Peripheral nodes simulated in the network.
Data Types: double
ActivePeriod
— Active communication period in each connection event
0.020
(default) | integer in the range [0, ConnectionInterval
]
Active communication period in each connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. This value specifies the start of communication between the Central and Peripheral nodes within a connection interval. The value must be sufficient to accommodate at least one data or control protocol data unit (PDU) transmission from the Central to the Peripheral and a corresponding response from the Peripheral to the Central within a single connection event. Additionally, set this value to include the entire data communication time between the Central and the Peripheral within the same connection event. Otherwise, the data communication occurs in the subsequent connection event.
Data Types: double
Object Functions
Specific to This Object
configureConnection | Configure LL connection between Bluetooth LE Central and Peripheral nodes |
Examples
Create and Configure LL Connection Between Bluetooth LE Nodes
Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.
wirelessnetworkSupportPackageCheck;
Create a Bluetooth LE node, specifying the role as "central"
.
centralNode = bluetoothLENode("central");
Create two Bluetooth LE nodes, specifying the role as "peripheral"
.
peripheralNode1 = bluetoothLENode("peripheral"); peripheralNode2 = bluetoothLENode("peripheral");
Create a default Bluetooth LE configuration object to share connection between the Central and Peripheral nodes.
connectionConfig = bluetoothLEConnectionConfig
connectionConfig = bluetoothLEConnectionConfig with properties: ConnectionInterval: 0.0200 AccessAddress: "5DA44270" UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36] Algorithm: 1 HopIncrement: 5 CRCInitialization: "012345" SupervisionTimeout: 1 PHYMode: "LE1M" InstantOffset: 6 ConnectionOffset: 0 ActivePeriod: 0.0200
Specify the connection interval, connection offset, and active period for the LL connection, in seconds.
connectionConfig.ConnectionInterval = 0.04; connectionConfig.ConnectionOffset = 0; connectionConfig.ActivePeriod = 0.02;
Specify the unique connection address for the LL connection.
connectionConfig.AccessAddress = "5DA44271"
connectionConfig = bluetoothLEConnectionConfig with properties: ConnectionInterval: 0.0400 AccessAddress: "5DA44271" UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36] Algorithm: 1 HopIncrement: 5 CRCInitialization: "012345" SupervisionTimeout: 1 PHYMode: "LE1M" InstantOffset: 6 ConnectionOffset: 0 ActivePeriod: 0.0200
Configure the LL connection between the Central node and Peripheral node 1.
configureConnection(connectionConfig,centralNode,peripheralNode1);
Update the LL connection configuration object to share connection parameters between the Central node and Peripheral node 2.
connectionConfig.ConnectionOffset = 0.02; % In seconds connectionConfig.ActivePeriod = 0.02; % In seconds connectionConfig.AccessAddress = "5DA44272"
connectionConfig = bluetoothLEConnectionConfig with properties: ConnectionInterval: 0.0400 AccessAddress: "5DA44272" UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36] Algorithm: 1 HopIncrement: 5 CRCInitialization: "012345" SupervisionTimeout: 1 PHYMode: "LE1M" InstantOffset: 6 ConnectionOffset: 0.0200 ActivePeriod: 0.0200
Configure the LL connection between the Central node and Peripheral node 2.
configureConnection(connectionConfig,centralNode,peripheralNode2);
References
[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 16, 2021. https://www.bluetooth.com/.
[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.
Version History
Introduced in R2022a
See Also
Objects
bluetoothLENode
|bluetoothLEBIGConfig
|bluetoothMeshProfileConfig
|bluetoothMeshFriendshipConfig
|bleChannelSelection
Topics
- Create, Configure, and Simulate Bluetooth LE Network With Custom Channel
- Create, Configure, and Simulate Bluetooth LE Broadcast Audio Network
- Create, Configure and Simulate Bluetooth Mesh Network
- Establish Friendship Between Friend Node and LPN in Bluetooth Mesh Network
- Simulate Multistream Audio in Hearing Aid Scenario
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 (한국어)