Main Content

bleChannelSelection

BLE channel index for connection events

Download Required: To use bleChannelSelection, first download Communications Toolbox™ Library for the Bluetooth® Protocol. For more information, see Get and Manage Add-Ons. Alternatively, see Communications Toolbox Library for the Bluetooth Protocol File Exchange.

Description

The bleChannelSelection System object™ selects a Bluetooth low energy (BLE) channel index based on the selected algorithm. For more information, see Algorithm in property.

To select a BLE 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 blechannelselection System object, csa, to select a BLE channel index for connection events or periodic advertising events.

csa = bleChannelSelection(Name,Value)sets properties using one or more name-value pairs. For example, bleChannelSelection('Algorithm','2') configures the System object, csa, to select a BLE channel index based on 'Algorithm #2'. Enclose each property name in quotes.

Properties

expand all

Note

For more information about BLE channel selection properties and their respective values, 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 BLE channel selection algorithm, specified as 1 or 2 representing 'Algorithm #1' or 'Algorithm #2' respectively. The property uses this algorithm to select the channel index.

Data Types: double

Hop increment count, specified as an integer in the range [5,16]. This property indicates the hop increment count to be used for hopping between data channels. 'Algorithm #1' uses this value as an input.

Data Types: double

Unique connection address, specified as an eight-element character vector or a string scalar denoting a four-octet hexadecimal value. This value indicates a unique 32-bit address for the link layer connection between two devices. 'Algorithm #2' uses this value as an input.

Data Types: char | string

List of used (good) 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 classified by the master.

Data Types: double

Usage

Description

example

channelIndex = csa() selects a channel index based on the algorithm specified by the Algorithm property, the list of used data channels specified by the UsedChannels property, and other applicable properties dependent on the selected algorithm. The returned channel index, channelIndex, is of data type double.

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 blechannelselection System object, 'csa', to select a BLE channel index based on the channel selection algorithm, 'Algorithm #1'. View the corresponding applicable properties.

csa = bleChannelSelection
csa = 
  bleChannelSelection with properties:

       Algorithm: 1
    HopIncrement: 5
    UsedChannels: [1x37 double]
    ChannelIndex: 0
    EventCounter: 0

Set the values of 'HopIncrement' to 7 and 'UsedChannels' to [0,2,24,6,10,14,26,30,34,36]. View the corresponding properties.

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 BLE channel index from the corresponding system object using 'Algorithm #1'.

channelIndex = csa()
channelIndex = 30

Create another blechannelselection System object, 'csa', this time to select a BLE channel index by specifying the type of channel selection algorithm as 'Algorithm #2'. View the corresponding applicable properties.

csa2 = bleChannelSelection("Algorithm",2);

Change the values of 'AccessAddress' to '8E89BED6' and 'UsedChannels' to [9,10,21,22,23,33,34,35,36]. View the corresponding properties.

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

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

Select a BLE channel index from the corresponding system object using 'Algorithm #2'.

channelIndex2 = csa2()
channelIndex2 = 9

References

[1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 22, 2019. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.1. https://www.bluetooth.com/.

Extended Capabilities

Introduced in R2019b