BlueHeron.Peripheral (blue_heron v0.4.1) View Source
Handles management of advertising and GATT server
Advertisement Data and Scan Response Data
both set_advertising_data
and set_scan_response_data
take the same binary
data as an argument. The format is called AdvertisingData
or AD
for short in
the official BLE spec. The format is
<<length, param, data::binary-size(byte_size(data))>>
Where param
can be one of many values defined in the official BLE spec suplement, and each param
has it's own data. Both params have a hard limit of 31 bytes total.
Link to this section Summary
Functions
Send a HandleValueNotification packet
Sets Advertising Data for a peripheral.
Must be called before start_advertising
or after stop_advertising
.
Sets Scan Response Data for a peripheral.
Must be called before start_advertising
or after stop_advertising
.
Start a non-secured peripheral
Start a SMP enabled peripheral. smp_handler
should be a module that implements the SMP.IOHandler
behavior
Link to this section Functions
Specs
exchange_mtu(GenServer.server(), non_neg_integer()) :: :ok
Specs
nofify( GenServer.server(), BlueHeron.GATT.Service.id(), BlueHeron.GATT.Characteristic.id(), binary() ) :: :ok | {:error, term()}
Send a HandleValueNotification packet
pid
- the peripheral pidservice_id
- the id used in the peripheral profilechararistic_id
- the id of the characistic on the servicedata
- binary data for the notification
Specs
set_advertising_data(GenServer.server(), binary()) :: :ok | {:error, atom()}
Sets Advertising Data for a peripheral.
Must be called before start_advertising
or after stop_advertising
.
see [Vol 3] Part C, Section 11 of the BLE core specification. Additionally see: Core Specification Supplement, Part A, Data Types Specification
Specs
set_scan_response_data(GenServer.server(), binary()) :: :ok | {:error, atom()}
Sets Scan Response Data for a peripheral.
Must be called before start_advertising
or after stop_advertising
.
see [Vol 3] Part C, Section 11 of the BLE core specification. Additionally see: Core Specification Supplement, Part A, Data Types Specification
Start a non-secured peripheral
Start a SMP enabled peripheral. smp_handler
should be a module that implements the SMP.IOHandler
behavior