Documentation
¶
Overview ¶
Package ble provides a channel.Notifier that sends short status messages to a JCODE-* BLE IoT device using the Nordic UART Service (NUS).
The notifier auto-discovers nearby JCODE-* devices on first use and reconnects on failure. All sends are best-effort and non-blocking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier implements channel.Notifier for BLE IoT devices.
func New ¶
func New() *Notifier
New creates a BLE notifier. It does NOT block — device discovery happens lazily on the first Notify call (in a background goroutine).
func (*Notifier) Notify ¶
func (n *Notifier) Notify(event channel.NotifyEvent)
Notify sends a command to the BLE device based on the event type. If the device is not connected yet, a background connection is triggered.
func (*Notifier) Receive ¶ added in v0.3.4
func (n *Notifier) Receive() <-chan ReceivedCommand
Receive returns a channel that delivers commands received from the BLE device.
type ReceivedCommand ¶ added in v0.3.4
type ReceivedCommand struct {
Cmd string // "input", "submit", "cancel"
Val string // payload for "input" command
}
ReceivedCommand is a parsed command received from the BLE device.