View Source BlueHeron.GATT.Service (blue_heron v0.5.1)
Struct that represents a GATT service.
Summary
Types
@type id() :: term()
@type read_fn() :: (BlueHeron.GATT.Characteristic.id() -> binary())
@type subscribe_fn() :: (BlueHeron.GATT.Characteristic.id() -> any())
@opaque t()
@type write_fn() :: (BlueHeron.GATT.Characteristic.id(), binary() -> any())
Functions
Create a service with fields taken from the map args
.
The following fields are required:
id
: A user-defined term to identify the service. Must be unique within the device profile. Can be any Erlang term.type
: The service type UUID. Can be a 2- or 16-byte byte UUID. Integer.characteristics
: A list of characteristics.read
: a 1 arity function called when the value of a characteristic should be read.write
: a 2 arity function called when the value of a characteristic should be written.subscribe
: a 1 arity function called when the value of a characteristic's value should be indicated.unsubscribe
: a 1 arity function called when the value of a characteristic's value should stop indicating.