-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathgattc.go
More file actions
41 lines (32 loc) · 1.51 KB
/
gattc.go
File metadata and controls
41 lines (32 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//go:build !baremetal || !(s110v8 || s113v7)
package bluetooth
// GATTCService is the common interface that all platform-specific
// DeviceService types must implement.
type GATTCService interface {
// UUID returns the UUID for this DeviceService.
UUID() UUID
// DiscoverCharacteristics discovers characteristics in this service.
// Pass a list of characteristic UUIDs you are interested in to this
// function. Either a list of all requested services is returned, or if
// some services could not be discovered an error is returned.
DiscoverCharacteristics(uuids []UUID) ([]DeviceCharacteristic, error)
}
// GATTCCharacteristic is the common interface that all platform-specific
// DeviceCharacteristic types must implement.
type GATTCCharacteristic interface {
// UUID returns the UUID for this DeviceCharacteristic.
UUID() UUID
// Read reads the current characteristic value.
Read(data []byte) (int, error)
// Write replaces the characteristic value with a new value.
Write(p []byte) (n int, err error)
// WriteWithoutResponse replaces the characteristic value with a new
// value. The call will return before all data has been written.
WriteWithoutResponse(p []byte) (n int, err error)
// EnableNotifications enables notifications for this characteristic,
// calling the provided callback with the new value when the
// characteristic value is changed by the remote peripheral.
EnableNotifications(callback func(buf []byte)) error
// GetMTU returns the MTU for this characteristic.
GetMTU() (uint16, error)
}