Documentation
¶
Overview ¶
Package bleclient provides the Gobot client adaptor for Bluetooth LE.
For more information refer to the README: https://github.com/hybridgroup/gobot/blob/release/platforms/bleclient/README.md
Index ¶
- func WithDebug() debugOption
- func WithScanTimeout(timeout time.Duration) scanTimeoutOption
- type Adaptor
- func (a *Adaptor) Address() string
- func (a *Adaptor) Connect() error
- func (a *Adaptor) Disconnect() error
- func (a *Adaptor) Finalize() error
- func (a *Adaptor) Name() string
- func (a *Adaptor) RSSI() int
- func (a *Adaptor) ReadCharacteristic(cUUID string) ([]byte, error)
- func (a *Adaptor) Reconnect() error
- func (a *Adaptor) SetName(n string)
- func (a *Adaptor) Subscribe(cUUID string, f func(data []byte)) error
- func (a *Adaptor) WithoutResponses(bool)
- func (a *Adaptor) WriteCharacteristic(cUUID string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithScanTimeout ¶
WithScanTimeout substitute the default scan timeout of 10 min.
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
Adaptor represents a Client Connection to a BLE Peripheral
func NewAdaptor ¶
NewAdaptor returns a new Adaptor given an identifier. The identifier can be the address or the name.
Supported options:
"WithAdaptorDebug" "WithAdaptorScanTimeout"
func (*Adaptor) Address ¶
Address returns the Bluetooth LE address of the device if connected, otherwise the identifier
func (*Adaptor) Disconnect ¶
Disconnect terminates the connection to the BLE peripheral.
func (*Adaptor) Name ¶
Name returns the name for the adaptor and after the connection is done, the name of the device
func (*Adaptor) RSSI ¶
RSSI returns the Bluetooth LE RSSI value at the moment of connecting the adaptor
func (*Adaptor) ReadCharacteristic ¶
ReadCharacteristic returns bytes from the BLE device for the requested characteristic UUID. The UUID can be given as 16-bit or 128-bit (with or without dashes) value.
func (*Adaptor) Reconnect ¶
Reconnect attempts to reconnect to the BLE peripheral. If it has an active connection it will first close that connection and then establish a new connection.
func (*Adaptor) Subscribe ¶
Subscribe subscribes to notifications from the BLE device for the requested characteristic UUID. The UUID can be given as 16-bit or 128-bit (with or without dashes) value.
func (*Adaptor) WithoutResponses ¶
WithoutResponses sets if the adaptor should expect responses after writing characteristics for this device (has no effect at the moment).