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

Link to this function

advertising(arg1, arg2, data)

View Source
Link to this function

connected(arg1, pkg, data)

View Source
Link to this function

exchange_mtu(pid, server_mtu)

View Source

Specs

exchange_mtu(GenServer.server(), non_neg_integer()) :: :ok
Link to this function

nofify(pid, service_id, chararistic_id, data)

View Source

Specs

Send a HandleValueNotification packet

  • pid - the peripheral pid
  • service_id - the id used in the peripheral profile
  • chararistic_id - the id of the characistic on the service
  • data - binary data for the notification
Link to this function

set_advertising_data(pid, data)

View Source

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

Link to this function

set_advertising_parameters(pid, params)

View Source
Link to this function

set_scan_response_data(pid, data)

View Source

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

Link to this function

start_link(context, gatt_server)

View Source

Start a non-secured peripheral

Link to this function

start_link(context, gatt_server, smp_handler)

View Source

Start a SMP enabled peripheral. smp_handler should be a module that implements the SMP.IOHandler behavior

Link to this function

wait_working(arg1, arg2, data)

View Source