Rtos API example

Embed: (wiki syntax)

« Back to documentation index

GapAdvertisingParams Class Reference

Parameters defining the advertising process. More...

#include <GapAdvertisingParams.h>

Public Types

enum  AdvertisingType_t { ADV_CONNECTABLE_UNDIRECTED, ADV_CONNECTABLE_DIRECTED, ADV_SCANNABLE_UNDIRECTED, ADV_NON_CONNECTABLE_UNDIRECTED }
 

Encapsulates the peripheral advertising modes.

More...
typedef enum AdvertisingType_t AdvertisingType
 Alias for GapAdvertisingParams::AdvertisingType_t.

Public Member Functions

 GapAdvertisingParams (AdvertisingType_t advType=ADV_CONNECTABLE_UNDIRECTED, uint16_t interval=GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, uint16_t timeout=0)
 Construct an instance of GapAdvertisingParams.
AdvertisingType_t getAdvertisingType (void) const
 Get the advertising type.
uint16_t getInterval (void) const
 Get the advertising interval in milliseconds.
uint16_t getIntervalInADVUnits (void) const
 Get the advertisement interval in units of 0.625ms.
uint16_t getTimeout (void) const
 Get the advertising timeout.
void setAdvertisingType (AdvertisingType_t newAdvType)
 Update the advertising type.
void setInterval (uint16_t newInterval)
 Update the advertising interval in milliseconds.
void setTimeout (uint16_t newTimeout)
 Update the advertising timeout.

Static Public Member Functions

static uint16_t MSEC_TO_ADVERTISEMENT_DURATION_UNITS (uint32_t durationInMillis)
 Convert milliseconds to units of 0.625ms.
static uint16_t ADVERTISEMENT_DURATION_UNITS_TO_MS (uint16_t gapUnits)
 Convert units of 0.625ms to milliseconds.

Static Public Attributes

static const unsigned GAP_ADV_PARAMS_INTERVAL_MIN = 0x0020
 Minimum Advertising interval for connectable undirected and connectable directed events in 625us units.
static const unsigned GAP_ADV_PARAMS_INTERVAL_MIN_NONCON = 0x00A0
 Minimum Advertising interval for scannable and nonconnectable undirected events in 625us units.
static const unsigned GAP_ADV_PARAMS_INTERVAL_MAX = 0x4000
 Maximum Advertising interval in 625us units.
static const unsigned GAP_ADV_PARAMS_TIMEOUT_MAX = 0x3FFF
 Maximum advertising timeout allowed; in seconds.
static const uint16_t UNIT_0_625_MS = 625
 Number of microseconds in 0.625 milliseconds.

Detailed Description

Parameters defining the advertising process.

Advertising parameters are a triplet of three value:

  • The Advertising mode modeled after AdvertisingType_t. It defines if the device is connectable and scannable. This value can be set at construction time, updated with setAdvertisingType() and queried by getAdvertisingType().
  • Time interval between advertisement. It can be set at construction time, updated by setInterval() and obtained from getInterval().
  • Duration of the advertising process. As others, it can be set at construction time, modified by setTimeout() and retrieved by getTimeout().

Definition at line 40 of file GapAdvertisingParams.h.


Member Typedef Documentation


Member Enumeration Documentation

Encapsulates the peripheral advertising modes.

It determine how the device appears to other scanner and peripheral devices in the scanning range.

Enumerator:
ADV_CONNECTABLE_UNDIRECTED 

Device is connectable, scannable and doesn't expect connection from a specific peer.

See also:
Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1.
ADV_CONNECTABLE_DIRECTED 

Device is connectable and expects connection from a specific peer.

See also:
Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2.
ADV_SCANNABLE_UNDIRECTED 

Device is scannable but not connectable.

See also:
Vol 6, Part B, Section 2.3.1.4.
ADV_NON_CONNECTABLE_UNDIRECTED 

Device is not connectable and not scannable.

See also:
Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3.

Definition at line 77 of file GapAdvertisingParams.h.


Constructor & Destructor Documentation

GapAdvertisingParams ( AdvertisingType_t  advType = ADV_CONNECTABLE_UNDIRECTED,
uint16_t  interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON,
uint16_t  timeout = 0 
)

Construct an instance of GapAdvertisingParams.

Parameters:
[in]advTypeType of advertising.
[in]intervalTime interval between two advertisement in units of 0.625ms.
[in]timeoutDuration in seconds of the advertising process. A value of 0 indicate that there is no timeout of the advertising process.
Note:
If value in input are out of range, they will be normalized.

Definition at line 127 of file GapAdvertisingParams.h.


Member Function Documentation

static uint16_t ADVERTISEMENT_DURATION_UNITS_TO_MS ( uint16_t  gapUnits ) [static]

Convert units of 0.625ms to milliseconds.

Parameters:
[in]gapUnitsThe number of units of 0.625ms to convert.
Returns:
The value of gapUnits in milliseconds.

Definition at line 191 of file GapAdvertisingParams.h.

AdvertisingType_t getAdvertisingType ( void   ) const

Get the advertising type.

Returns:
The advertising type.

Definition at line 201 of file GapAdvertisingParams.h.

uint16_t getInterval ( void   ) const

Get the advertising interval in milliseconds.

Returns:
The advertisement interval (in milliseconds).

Definition at line 211 of file GapAdvertisingParams.h.

uint16_t getIntervalInADVUnits ( void   ) const

Get the advertisement interval in units of 0.625ms.

Returns:
The advertisement interval in advertisement duration units (0.625ms units).

Definition at line 222 of file GapAdvertisingParams.h.

uint16_t getTimeout ( void   ) const

Get the advertising timeout.

Returns:
The advertising timeout (in seconds).

Definition at line 232 of file GapAdvertisingParams.h.

static uint16_t MSEC_TO_ADVERTISEMENT_DURATION_UNITS ( uint32_t  durationInMillis ) [static]

Convert milliseconds to units of 0.625ms.

Parameters:
[in]durationInMillisNumber of milliseconds to convert.
Returns:
The value of durationInMillis in units of 0.625ms.

Definition at line 179 of file GapAdvertisingParams.h.

void setAdvertisingType ( AdvertisingType_t  newAdvType )

Update the advertising type.

Parameters:
[in]newAdvTypeThe new advertising type.

Definition at line 242 of file GapAdvertisingParams.h.

void setInterval ( uint16_t  newInterval )

Update the advertising interval in milliseconds.

Parameters:
[in]newIntervalThe new advertising interval in milliseconds.

Definition at line 252 of file GapAdvertisingParams.h.

void setTimeout ( uint16_t  newTimeout )

Update the advertising timeout.

Parameters:
[in]newTimeoutThe new advertising timeout (in seconds).
Note:
0 is a special value meaning the advertising process never ends.

Definition at line 264 of file GapAdvertisingParams.h.


Field Documentation

const unsigned GAP_ADV_PARAMS_INTERVAL_MAX = 0x4000 [static]

Maximum Advertising interval in 625us units.

Note:
Equal to 10.24s.

Definition at line 64 of file GapAdvertisingParams.h.

const unsigned GAP_ADV_PARAMS_INTERVAL_MIN = 0x0020 [static]

Minimum Advertising interval for connectable undirected and connectable directed events in 625us units.

Note:
Equal to 20 ms.

Definition at line 49 of file GapAdvertisingParams.h.

const unsigned GAP_ADV_PARAMS_INTERVAL_MIN_NONCON = 0x00A0 [static]

Minimum Advertising interval for scannable and nonconnectable undirected events in 625us units.

Note:
Equal to 100ms.

Definition at line 57 of file GapAdvertisingParams.h.

const unsigned GAP_ADV_PARAMS_TIMEOUT_MAX = 0x3FFF [static]

Maximum advertising timeout allowed; in seconds.

Definition at line 69 of file GapAdvertisingParams.h.

const uint16_t UNIT_0_625_MS = 625 [static]

Number of microseconds in 0.625 milliseconds.

Definition at line 170 of file GapAdvertisingParams.h.