Main Content

bleChannelSelection

Bluetooth LE channel index selection

Since R2019b

Description

The bleChannelSelection System object™ selects a Bluetooth® low energy (LE) channel index based on the algorithm specified by the Algorithm property. This System object enables you to select the Bluetooth LE channel index for connection, periodic advertising, and isochronous events.

To select a Bluetooth LE channel index:

  1. Create the bleChannelSelection object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

example

csa = bleChannelSelection creates a default Bluetooth LE channel selection System object, csa.

csa = bleChannelSelection(Name,Value)sets Properties using one or more name-value pairs. Enclose each property name in quotes. For example, ('Algorithm',2) specifies a Bluetooth LE channel index based on Algorithm 2.

Properties

expand all

Note

For more information about Bluetooth LE channel selection properties, see Volume 6, Part B, Section 4.5.8 of the Bluetooth Core Specification [2].

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Type of Bluetooth LE channel selection algorithm, specified as 1 or 2 representing Algorithm 1 or Algorithm 2, respectively. Algorithm 1 selects the channel index for connection events. Algorithm 2 selects the channel index for connection events, periodic advertising events, and LE isochronous events.

Data Types: double

Hop increment count, specified as an integer in the range [5, 16]. This property specifies the hop increment count to hop between data channels. If you set the Algorithm property to 1, the System object uses this property as an input argument.

Data Types: double

Unique connection address, specified as an 8-element character vector or a string scalar denoting a 4-octet hexadecimal value. This value specifies a unique 32-bit address for the link layer (LL) connection between two devices. If you set the Algorithm property to 2, the System object uses this property as an input argument.

Data Types: char | string

List of used (good) data channels, specified as a vector of integers 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 property specifies the set of good channels classified by the Central.

Data Types: double

Flag to enable or disable isochronous event channel selection, specified as 0 (false) or 1 (true). A value of 1 (true) value selects a channel for isochronous events by specifying the Algorithm property as 2.

Data Types: logical

Isochronous event counter, specified as an integer in the range [0, 65535]. This property specifies the counter for each isochronous event.

Dependencies

To enable this property, set the SubeventChannelSelection property to 1 (true).

Data Types: double

Subevent counter, specified as an integer in the range [1, 31]. This property specifies the counter for each subevent.

Dependencies

To enable this property, set the SubeventChannelSelection property to 1 (true).

Data Types: double

This property is read-only.

Channel index for current event, specified as an integer in the range [0, 39]. This property specifies the channel index for connection event, periodic advertising event, and isochronous event.

Data Types: double

This property is read-only.

Counter for current event, specified as 0. This property specifies the event counter for connection event and periodic advertising event.

Data Types: double

Usage

Description

example

channelIndex = csa selects a channel index based on the applicable Properties. During each call of this function, update the values of IsochronousEventCounter and SubeventNumber properties. During each call of this function, the System object must update the SubeventNumber property sequentially.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

cloneCreate duplicate System object
isLockedDetermine if System object is in use
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Create a default Bluetooth LE channel selection System object.

csa = bleChannelSelection
csa = 
  bleChannelSelection with properties:

       Algorithm: 1
    HopIncrement: 5
    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]
    ChannelIndex: 0
    EventCounter: 0

Set the hop increment count of 7. Then, specify a set of used (good) channels classified by the Central.

csa.HopIncrement = 7;
csa.UsedChannels = [0 2 24 6 10 14 26 30 34 36]
csa = 
  bleChannelSelection with properties:

       Algorithm: 1
    HopIncrement: 7
    UsedChannels: [0 2 6 10 14 24 26 30 34 36]
    ChannelIndex: 0
    EventCounter: 0

Select a Bluetooth LE channel index by using the csa System object.

channelIndex = csa()
channelIndex = 30

Create another Bluetooth LE channel selection System object, specifying the type of channel selection algorithm as 2.

csa2 = bleChannelSelection('Algorithm',2);

Set a unique connection address. Then, specify a set of used (good) channels classified by the Central.

csa2.AccessAddress = '8E89BED6';
csa2.UsedChannels = [9 10 21 22 23 33 34 35 36]
csa2 = 
  bleChannelSelection with properties:

                   Algorithm: 2
               AccessAddress: '8E89BED6'
    SubeventChannelSelection: false
                UsedChannels: [9 10 21 22 23 33 34 35 36]
                ChannelIndex: 0
                EventCounter: 0

Select a Bluetooth LE channel index by using the csa2 System object.

channelIndex2 = csa2()
channelIndex2 = 35

Create a default Bluetooth LE channel selection System object.

csa = bleChannelSelection
csa = 
  bleChannelSelection with properties:

       Algorithm: 1
    HopIncrement: 5
    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]
    ChannelIndex: 0
    EventCounter: 0

Set the Bluetooth LE channel selection algorithm to 2. This algorithm supports channel selection for connection events, periodic advertising events, and LE isochronous events. Enable subevent channel selection.

csa.Algorithm = 2;
csa.SubeventChannelSelection = true;

Specify a unique connection address and a set of used (good) channels classified by the Central.

csa.AccessAddress = '8E89BED6';
csa.UsedChannels  = [9 10 21 22 23 33 34 35 36];

In the first isochronous event, select a channel index for the first subevent.

csa.IsochronousEventCounter = 0;
csa.SubeventNumber = 1;
channelIndex = csa()
channelIndex = 35

In the first isochronous event, select a channel index for the second subevent.

csa.SubeventNumber = 2;
channelIndex = csa()
channelIndex = 10

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

Version History

Introduced in R2019b