File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -130,6 +130,13 @@ func NewDuration(interval time.Duration) Duration {
130130// Connection is a numeric identifier that indicates a connection handle.
131131type Connection uint16
132132
133+ // GAPDevice is the shared interface that all platform-specific Device types must implement.
134+ type GAPDevice interface {
135+ DiscoverServices (uuids []UUID ) ([]DeviceService , error )
136+ RequestConnectionParams (params ConnectionParams ) error
137+ Disconnect () error
138+ }
139+
133140// ScanResult contains information from when an advertisement packet was
134141// received. It is passed as a parameter to the callback of the Scan method.
135142type ScanResult struct {
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ func (a *Adapter) StopScan() error {
8383 return nil
8484}
8585
86+ var _ GAPDevice = Device {}
87+
8688// Device is a connection to a remote peripheral.
8789type Device struct {
8890 Address Address
Original file line number Diff line number Diff line change @@ -267,6 +267,8 @@ type notificationRegistration struct {
267267 callback func ([]byte )
268268}
269269
270+ var _ GAPDevice = Device {}
271+
270272// Device is a connection to a remote peripheral.
271273type Device struct {
272274 Address Address
Original file line number Diff line number Diff line change @@ -430,6 +430,8 @@ func makeScanResult(props map[string]dbus.Variant) ScanResult {
430430 }
431431}
432432
433+ var _ GAPDevice = Device {}
434+
433435// Device is a connection to a remote bluetooth device.
434436type Device struct {
435437 Address Address // the MAC address of the device
Original file line number Diff line number Diff line change @@ -108,3 +108,21 @@ func (a *Adapter) SetRandomAddress(mac MAC) error {
108108 }
109109 return nil
110110}
111+
112+ // Disconnect from the BLE device.
113+ func (d Device ) Disconnect () error {
114+ return errNotYetImplmented
115+ }
116+
117+ // DiscoverServices starts a service discovery procedure.
118+ func (d Device ) DiscoverServices (uuids []UUID ) ([]DeviceService , error ) {
119+ return nil , errNotYetImplmented
120+ }
121+
122+ // RequestConnectionParams requests a different connection latency and timeout
123+ // of the given device connection.
124+ func (d Device ) RequestConnectionParams (params ConnectionParams ) error {
125+ return errNotYetImplmented
126+ }
127+
128+ type DeviceService struct {}
Original file line number Diff line number Diff line change 1+ //go:build softdevice && s113v7
2+
3+ package bluetooth
4+
5+ /*
6+ // Add the correct SoftDevice include path to CFLAGS, so #include will work as
7+ // expected.
8+ #cgo CFLAGS: -Is113_nrf52_7.0.1/s113_nrf52_7.0.1_API/include
9+ */
10+ import "C"
11+
12+ // Disconnect from the BLE device.
13+ func (d Device ) Disconnect () error {
14+ return errNotYetImplmented
15+ }
16+
17+ // DiscoverServices starts a service discovery procedure.
18+ func (d Device ) DiscoverServices (uuids []UUID ) ([]DeviceService , error ) {
19+ return nil , errNotYetImplmented
20+ }
21+
22+ // RequestConnectionParams requests a different connection latency and timeout
23+ // of the given device connection.
24+ func (d Device ) RequestConnectionParams (params ConnectionParams ) error {
25+ return errNotYetImplmented
26+ }
27+
28+ type DeviceService struct {}
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ package bluetooth
77*/
88import "C"
99
10+ var _ GAPDevice = Device {}
11+
1012// Device is a connection to a remote peripheral or central.
1113type Device struct {
1214 Address Address
Original file line number Diff line number Diff line change @@ -282,6 +282,8 @@ func (a *Adapter) StopScan() error {
282282 return a .watcher .Stop ()
283283}
284284
285+ var _ GAPDevice = Device {}
286+
285287// Device is a connection to a remote peripheral.
286288type Device struct {
287289 ctx context.Context
You can’t perform that action at this time.
0 commit comments