45 lines
1.9 KiB
Go
45 lines
1.9 KiB
Go
|
package bluetooth
|
||
|
|
||
|
// DiscoverServices starts a service discovery procedure. Pass a list of service
|
||
|
// UUIDs you are interested in to this function. Either a slice of all services
|
||
|
// is returned (of the same length as the requested UUIDs and in the same
|
||
|
// order), or if some services could not be discovered an error is returned.
|
||
|
func (d *Device) DiscoverServices(uuids []UUID) ([]DeviceService, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
// DeviceService is a BLE service on a connected peripheral device.
|
||
|
type DeviceService struct {
|
||
|
}
|
||
|
|
||
|
// 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. If there is no error, the characteristics
|
||
|
// slice has the same length as the UUID slice with characteristics in the same
|
||
|
// order in the slice as in the requested UUID list.
|
||
|
func (s *DeviceService) DiscoverCharacteristics(uuids []UUID) ([]DeviceCharacteristic, error) {
|
||
|
return nil, nil
|
||
|
}
|
||
|
|
||
|
// DeviceCharacteristic is a BLE characteristic on a connected peripheral
|
||
|
// device.
|
||
|
type DeviceCharacteristic struct {
|
||
|
}
|
||
|
|
||
|
// WriteWithoutResponse replaces the characteristic value with a new value. The
|
||
|
// call will return before all data has been written. A limited number of such
|
||
|
// writes can be in flight at any given time. This call is also known as a
|
||
|
// "write command" (as opposed to a write request).
|
||
|
func (c DeviceCharacteristic) WriteWithoutResponse(p []byte) (n int, err error) {
|
||
|
return 0, nil
|
||
|
}
|
||
|
|
||
|
// EnableNotifications enables notifications in the Client Characteristic
|
||
|
// Configuration Descriptor (CCCD). This means that most peripherals will send a
|
||
|
// notification with a new value every time the value of the characteristic
|
||
|
// changes.
|
||
|
func (c DeviceCharacteristic) EnableNotifications(callback func(buf []byte)) error {
|
||
|
return nil
|
||
|
}
|