2019-06-02 20:12:36 +03:00
|
|
|
package bluetooth
|
|
|
|
|
|
|
|
// Service is a GATT service to be used in AddService.
|
|
|
|
type Service struct {
|
|
|
|
handle uint16
|
|
|
|
UUID
|
2019-11-09 14:21:57 +03:00
|
|
|
Characteristics []CharacteristicConfig
|
2019-06-02 20:12:36 +03:00
|
|
|
}
|
|
|
|
|
2019-11-09 14:21:57 +03:00
|
|
|
// Characteristic is a single characteristic in a service. It has an UUID and a
|
|
|
|
// value.
|
2019-06-02 20:12:36 +03:00
|
|
|
type Characteristic struct {
|
|
|
|
handle uint16
|
2019-11-09 14:21:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// CharacteristicConfig contains some parameters for the configuration of a
|
|
|
|
// single characteristic.
|
|
|
|
//
|
|
|
|
// The Handle field may be nil. If it is set, it points to a characteristic
|
|
|
|
// handle that can be used to access the characteristic at a later time.
|
|
|
|
type CharacteristicConfig struct {
|
|
|
|
Handle *Characteristic
|
2019-06-02 20:12:36 +03:00
|
|
|
UUID
|
|
|
|
Value []byte
|
|
|
|
}
|
2019-11-09 14:21:57 +03:00
|
|
|
|
|
|
|
// Handle returns the numeric handle for this characteristic. This is used
|
|
|
|
// internally in the Bluetooth stack to identify this characteristic.
|
|
|
|
func (c *Characteristic) Handle() uint16 {
|
|
|
|
return c.handle
|
|
|
|
}
|