ble_adv

Presentation

This module sends advertisements. It allows to configure the data to transmit (ADVERTISING_DATA for normal advertisements and SCANNING_DATA for scan responses), the advertising address (ADVERTISING_ADDRESS) or the time interval of transmission (INTERVAL_MIN and INTERVAL_MAX). It provides three modes, according to the value of the TIME input parameter :

  • if no value is specified (“”) : the module never stops and runs an infinite loop (it allows to implement the role Advertiser)

  • if the value 0 is specified (“0”) : the module enables the emission of advertisements and stops immediatly (it allows to implement the role Peripheral if this module is combined with ble_slave)

  • if a positive value is specified (e.g. “10”) : the module enables the emission of advertisements and runs during the specified duration

If the module execution is successful, the INTERFACE parameter is propagated as an output parameter.

Compatible devices

Input parameters

Name

Default value

Possible values

Description

INTERFACE

hci0

hciX

Interface to use

AVERTISING_TYPE

ADV_IND

<string>

Advertisment type

ADVERTISING_DATA

<hexadecimal>

Advertised data

ADVERTISING_ADDRESS

<BD address>

Advertiser’s address

DESTINATION_ADDRESS

<BD address>

Optional destination address

ADVERTISING_ADDRESS_TYPE

public

public|random

Type of the advertiser’s address

DESTINATION_ADDRESS_TYPE

public

public|random

Type of the destination’s address

INTERVAL_MIN

200

<integer>

Minimal time interval between emissions

INTERVAL_MAX

210

<integer>

Maximal time interval between emissions

ENABLE

yes

yes|no

Activate advertising mode (for use in piped operations to advertise at specific times)

TIME

0

<integer>

Execution duration (in seconds)

SCANNING_DATA

<hexadecimal>

Additional data to send in SCAN_RESP advertisements

Output parameters

Name

Possible values

Description

INTERFACE

hciX

Selected interface

Usage

If you want to send a specific advertisement, use the following syntax :

$ sudo mirage ble_adv TIME="" ADVERTISING_DATA=0201060eff0d000500e18002390700000664
[INFO] Module ble_adv loaded !
[SUCCESS] HCI Device (hci0) successfully instanciated !
^C[INFO] Mirage process terminated !

If you want to send it during a specific amount of time :

$ sudo mirage ble_adv TIME="3" ADVERTISING_DATA=0201060eff0d000500e18002390700000664
[INFO] Module ble_adv loaded !
[SUCCESS] HCI Device (hci0) successfully instanciated !
[INFO] Mirage process terminated !

If you want to scan the advertisements emitted by a specific device and clone them, use the following sequential execution :

$ sudo mirage "ble_scan|ble_adv" ble_scan1.TARGET=FF:FF:60:A5:17:44 ble_scan1.TIME=3 ble_adv2.TIME=""
[INFO] Module ble_scan loaded !
[INFO] Module ble_adv loaded !
[SUCCESS] HCI Device (hci0) successfully instanciated !
┌Devices found──────┬──────────────────┬─────────┬───────────────────────────────────────────────────┬─────────────────────────────────────────────────┐
│ BD Address        │ Name             │ Company │ Flags                                             │ Advertising data                                │
├───────────────────┼──────────────────┼─────────┼───────────────────────────────────────────────────┼─────────────────────────────────────────────────┤
│ FF:FF:60:A5:17:44 │ iTAG             │         │ LE Limited Discoverable Mode,BR/EDR not supported │ 020105020a000319c1030302e0ff (ADV_IND)          │
│                   │                  │         │                                                   │ 110969544147202020202020202020202020 (SCAN_RSP) │
└───────────────────┴──────────────────┴─────────┴───────────────────────────────────────────────────┴─────────────────────────────────────────────────┘
^C[INFO] Mirage process terminated !

If you want to simulate a full Peripheral, please refer to the documentation of ble_slave.