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