Documentation
¶
Overview ¶
Package bluetooth talks to Bluetooth LE devices: scales, printers, beacons and the like. Characteristics are read and written as bytes.
nimbus native plugin add bluetooth
ok, err := bluetooth.Request(ctx)
go bluetooth.Scan(scanCtx, func(d bluetooth.Device) { add(d) })
err = bluetooth.Connect(ctx, d.ID)
b, err := bluetooth.Read(ctx, d.ID, service, characteristic)
Written against the platform APIs, but not yet run on phones: simulators and emulators have no Bluetooth. In a browser (Chrome and Edge), Scan opens the browser's chooser and finds the one device picked, and only the services named in Scan can be read or written.
Index ¶
- func Connect(ctx context.Context, id string) error
- func Disconnect(ctx context.Context, id string) error
- func Read(ctx context.Context, id, service, characteristic string) ([]byte, error)
- func Request(ctx context.Context) (bool, error)
- func Scan(ctx context.Context, f func(Device), services ...string) error
- func Write(ctx context.Context, id, service, characteristic string, value []byte) error
- type Device
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Disconnect ¶
Disconnect ends the connection.
Types ¶
Click to show internal directories.
Click to hide internal directories.