## Non-Connected Procedures

This section describes the support provided to an application that uses non-connected procedures.

Management of these non-connected procedures is based on creation of activities representing the different available procedures. Four kind of activities can be created:

- Advertising activity
- Scanning activity
- Initiating activity
- Periodic Synchronization activity

### Activity Overview

GAP API provides a set of command messages allowing to:

- Create an activity (GAPM_ACTIVITY_CREATE_CMD)
- Start a created activity (GAPM_ACTIVITY_START_CMD)
- Stop a started activity (GAPM_ACTIVITY_STOP_CMD)
- Delete a created activity (GAPM_ACTIVITY_DELETE_CMD)

A descriptions of these commands can be found in the CEVA Gap Interface Specification.

Figure: Activity Life Cycle

Activity Life Cycle (figure) shows an overview of the life cycle of an activity.

- Before being usable, an activity must first be created.
- The activity must then be started.
- The activity can be considered finished after one of several events has occurred:
  - Request is received from application
  - Timeout
  - End of requested operation (after connection, synchronization,…)
- An activity can either be started again, if the application needs to perform the same procedure, or it can be deleted so that the allocated structure can be reused by another activity.

NOTE: It is not possible to directly update an activity’s parameters. Instead, the application must create another activity with different parameters.

The number of activities that can be created in parallel depends on how many activities are supported by the upper layers. However, a few rules exist about the activities that can be started in parallel:

- It is possible to create and start several advertising activities in parallel.
- It is not possible to start two scanning or two initiating activities in parallel, due to HCI commands not allowing management of such operations, because management of such operations is not supported by HCI commands. However, it is possible to create two such activities in parallel.
- It is possible to start one scanning and one initiating activity in parallel with each other.

### Advertising Activity

An advertising activity can be run on a device that is configured as a broadcaster device.

An advertising activity is defined by its discoverable and connectable modes, as described in Advertising Activity Modes (table).

Table: Advertising Activity Modes
Discoverable Mode | Connectable Mode
--- | ---
Non-discoverable mode: Procedure that can be limited in time. A device in this mode cannot be found by a general or limited discovery procedure. Filtering policy or targeted address can be used in this procedure. In AD_TYPE flag of advertising data, LE general and LE limited discoverable flag are set to zero. | Non-connectable mode: A device in this mode cannot be connected by a central device.
General discoverable mode: Procedure without duration limit. A device in this mode can be found by a general discovery procedure. Whitelist shall not be involved in this mode. In AD_TYPE flag of advertising data, LE general is set to 1 and LE limited discoverable flag is set to zero. | Undirected-connectable mode: A device in this mode can accept connection from any device or from device present in the whitelist.
Limited discoverable mode: Procedure with a limited duration. A device in this mode can be found either by a general or limited discovery procedure. Whitelist is not involved in this mode. In AD_TYPE flag of advertising data, LE general is set to zero and LE limited discoverable flag is set to 1. | Directed-connectable mode: A device in this mode can accept connection only by the targeted address.

In this table, the Periodic Advertising Synchronizability mode and Broadcast mode are missing.

- Periodic Advertising Synchronizability mode is neither a connectable mode nor a discoverable mode. A device in this mode sends synchronization information about periodic advertising.
- Broadcast mode is a non-connectable and non-discoverable mode.

Creation of advertising activity is possible using the GAPM_ACTIVITY_CREATE_CMD message, which allows creation of three different types of advertising:

- Legacy advertising activity
- Extended advertising activity
- Periodic advertising activity

NOTE: The discoverability modes such as non-discoverable mode, general discoverable mode and limited discoverable mode are considered as a property of the advertising mode.

#### Advertising Properties

The advertising properties are used to describe the content of advertising packets or behavior of the advertising activity. This section provides a small description for each of the configurable properties.

Directed

This property means that a specific device is targeted by the advertiser; the targeted device address is present in the advertising packet. For legacy advertising this applies only in connectable mode, but this is not the case for extended advertising.

High Duty Cycle

This property applies only in legacy direct advertising. The controller advertises the direct connectable packet for 1.28 s, with an advertising interval ≤ 3.75 ms.

Scannable

Advertising activity opens an RX window to receive a scan request packet, and sends in reply a scan response packet.

Connectable

Advertising activity opens an RX window to receive a connect request packet. This property is mandatory to start a connection as slave.

Anonymous

This applies only in extended advertising that is neither connectable nor scannable. The device address is not present at all in the advertised packet, but the packet can contain a targeted address.

TX Power

This applies only in extended advertising, and means that transmit power is present in an advertising packet.

Scan Request Notification

When a scan request packet is received over the air, a scan report is triggered to inform the application about observer device present over the air.

Filter Policy

This indicates if the whitelist is involved, or not to accept scan requests or connect requests. This property applies only for non-discoverable mode advertising.

#### Legacy Advertising Activity

The create legacy advertising activity operation allows an application to start legacy advertising on primary advertising channels (37, 38, and 39) at 1 Mb/s. Advertising Properties for Legacy Advertising (Primary Channel Only) (table) shows properties available for each kind of advertising mode supported for legacy advertising.

Table: Advertising Properties for Legacy Advertising (Primary Channel Only)
Modes/Properties 0: Must be Disabled 1: Must be Active X: Can be Either Active or Disabled | Disc Mode | High Duty Cycle | Directed | Scannable | Connectable | TX Packet Type
--- | --- | --- | --- | --- | --- | ---
Non-connectable | Non-disc (Broadcaster mode) | 0 | 0 | X | 0 |
| Limited | 0 | 0 | X | 0 |
| General | 0 | 0 | X | 0 |
Undirected connectable | Non-disc | 0 | 0 | 1 | 1 | ADV_IND
| Limited | 0 | 0 | 1 | 1 |
| General | 0 | 0 | 1 | 1 |
Directed connectable | Non-disc | X | 1 | 0 | 1 | ADV_DIRECT_IND

#### Extended Advertising Activity

The create extended advertising activity operation allows an application to start extended advertising on secondary advertising channels (0 to 36) using 1 Mb/s, 2 Mb/s, or LE Coded PHY. Advertising Properties for Extended Advertising (Secondary Channel Usage) (table) shows properties available for each kind of advertising mode supported for extended advertising.

NOTE: Advertising extension does not support to have both connectable and scannable modes (scannable means that advertiser replies to AUX_SCAN_REQ). So it is possible to set the scan response data only for non-connected modes if the scan property is set.

Table: Advertising Properties for Extended Advertising (Secondary Channel Usage)
Modes/Properties 0: Must be Disabled 1: Must be Active X: Can be Either Active or Disabled | Disc Mode | Anonymous | Directed | Scannable | Connectable
--- | --- | --- | --- | --- | ---
Non-connectable | General | 0 | 0 | X | 0
| Limited | 0 | 0 | X | 0
| Non-disc (Broadcaster Mode) | 0 | X | X | 0
| Non-disc (Broadcaster Mode) | 1 | X | 0 | 0
Undirected connectable | Non-disc | 0 | 0 | 0 | 1
| General | 0 | 0 | 0 | 1
| Limited | 0 | 0 | 0 | 1
Directed connectable | Non-disc | 0 | 1 | 0 | 1

#### Periodic Advertising Activity

The create periodic advertising activity operation allows an application to start a periodic advertising on secondary advertising channels (0 to 36) using 1 Mb/s, 2 Mb/s or LE Coded PHY. In order for a scanner to get information about position of the periodic advertising, a non-connectable and non-scannable extended advertising activity is started.

With this activity it is possible to set advertising data (limited to one fragment) and periodic advertising data.

Advertising Properties for Periodic Advertising (Secondary Channel Usage) (table) shows properties available for periodic advertising.

Table: Advertising Properties for Periodic Advertising (Secondary Channel Usage)
Modes/Properties 0: Must be Disabled 1: Must be Active X: Can be Either Active or Disabled | Disc Mode | Anonymous | Directed | Scannable | Connectable
--- | --- | --- | --- | --- | ---
Periodic Advertising Synchronizability | General | 0 | 0 | 0 | 0
| Limited | 0 | 0 | 0 | 0
| Non-disc | 0 | X | 0 | 0

### Scanning Activity

The purpose of the scanning activity is the reception of advertising packets. The Observer or Central role is mandatory for the creation of a scanning activity. Scanning activities are managed by the GAPM SCAN module.

Six scanning modes are available:

Observer Mode

A passive or an active scan procedure with non-limited duration. In this mode, the application is notified about any received advertising data, whatever its type.

Selective Observer Mode

A passive or active scan procedure with non-liminted duration using whitelist filtering.

General Discovery

A passive or an active scan procedure with a limited duration. In this mode, a device is able to discover advertiser devices broadcasting data in limited or general discoverable mode. Do not use the whitelist.

Limited Discovery

Passive or an active scan procedure with a limited duration. In this mode, a device is able to discover advertiser devices broadcasting data in limited discoverable mode. Do not use the whitelist.

General Connectable Discovery

Discover all connectable devices.

Selective Connectable Discovery

Discover connectable devices using whitelist filtering.

NOTE: Due to the content of HCI LE Extended Set Scan Param/Enable commands, a scanning activity cannot be started in parallel with another scanning activity.

Scan can be performed on LE 1M PHY or LE Coded PHY, or on both PHYs in parallel.

### Initiating Activity

The purpose of initiating activity is the establishment of a Bluetooth Low Energy connection as master. This implies that support of the Central role is mandatory for creation of an initiating activity. Initiating activities are managed by GAPM INIT module.

Three connection modes are available:

Direct Connection Establishment

This procedure initiates a connection with a specific device.

Automatic Connection Establishment

This procedure makes use of the whitelist to establish a connection with known devices. The application needs to set the whitelist before starting this activity. As soon as connection with one of the whitelisted devices is established, the activity autonomously restarts the connection establishment procedure for the next device, until all desired connections have been established.

Name Discovery

As soon as connection is established, this procedure performs a read of the device name characteristic (GATT UUID 0x2A00) and then disconnects. The device name is sent to the application by using the GAPM_PEER_NAME_IND message.

NOTE: Based on the content of the HCI LE Extended Creation Connection command, only one initiating activity can be started at a given time.

### Periodic Synchronization Activity

The periodic synchronization activity is used to perform a periodic advertising synchronization establishment procedure. Periodic synchronization activity is managed by the GAPM PER SYNC module. Observer mode needs to be supported for creation of a periodic synchronization activity.

To establish a synchronization, there are two possible options: waiting information from an existing link using a periodic advertising sync transfer from a peer device, or establishing synchronization without a connection. When not using a connection, it is mandatory to start a scan activity in parallel. This scan activity can be started before or after the periodic synchronization activity.

In the case of a periodic sync transfer, activity must be started with the connection index before expecting sync information from a peer device.

Once the activity has been created, it can be started using the GAPM_ACTIVITY_START_CMD message to synchronize with either one specific device (general type) or any of the devices present in the periodic advertising list (selective type).

NOTE: It is not allowed for two periodic synchronization activities to be waiting for synchronization at a same time.