forked from tinygo-org/bluetooth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadapter.go
More file actions
18 lines (16 loc) · 717 Bytes
/
adapter.go
File metadata and controls
18 lines (16 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package bluetooth
// BLEAdapter is the shared interface that all platform-specific Adapter types must implement.
type BLEAdapter interface {
Connect(address Address, params ConnectionParams) (Device, error)
Enable() error
Reset() error
Scan(callback func(*Adapter, ScanResult)) (err error)
SetConnectHandler(c func(device Device, connected bool))
StopScan() error
}
// SetConnectHandler sets a handler function to be called whenever the adapter connects
// or disconnects. You must call this before you call adapter.Connect() for centrals
// or advertisement.Start() for peripherals in order for it to work.
func (a *Adapter) SetConnectHandler(c func(device Device, connected bool)) {
a.connectHandler = c
}