File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -26,15 +26,21 @@ type Adapter struct {
26
26
connectHandler func (device Device , connected bool )
27
27
}
28
28
29
+ // NewAdapter creates a new Adapter with the given ID.
30
+ //
31
+ // Make sure to call Enable() before using it to initialize the adapter.
32
+ func NewAdapter (id string ) * Adapter {
33
+ return & Adapter {
34
+ id : id ,
35
+ connectHandler : func (device Device , connected bool ) {},
36
+ }
37
+ }
38
+
29
39
// DefaultAdapter is the default adapter on the system. On Linux, it is the
30
40
// first adapter available.
31
41
//
32
42
// Make sure to call Enable() before using it to initialize the adapter.
33
- var DefaultAdapter = & Adapter {
34
- id : defaultAdapter ,
35
- connectHandler : func (device Device , connected bool ) {
36
- },
37
- }
43
+ var DefaultAdapter = NewAdapter (defaultAdapter )
38
44
39
45
// Enable configures the BLE stack. It must be called before any
40
46
// Bluetooth-related calls (unless otherwise indicated).
You can’t perform that action at this time.
0 commit comments