prototooth/gap.go
Ayke van Laethem e453c4d3f9
Add Linux support
Very much experimental, no BLE service support yet and BLE LocalName in
advertisement packet doesn't seem to work. So rather useless at the
moment.
2019-11-09 17:55:19 +01:00

35 lines
952 B
Go

package bluetooth
// AdvertiseOptions configures everything related to BLE advertisements.
type AdvertiseOptions struct {
Interval AdvertiseInterval
}
// AdvertiseInterval is the advertisement interval in 0.625µs units.
type AdvertiseInterval uint32
// NewAdvertiseInterval returns a new advertisement interval, based on an
// interval in milliseconds.
func NewAdvertiseInterval(intervalMillis uint32) AdvertiseInterval {
// Convert an interval to units of
return AdvertiseInterval(intervalMillis * 8 / 5)
}
// Connection is a numeric identifier that indicates a connection handle.
type Connection uint16
// GAPEvent is a base (embeddable) event for all GAP events.
type GAPEvent struct {
Connection Connection
}
// ConnectEvent occurs when a remote device connects to this device.
type ConnectEvent struct {
GAPEvent
}
// DisconnectEvent occurs when a remote device disconnects from this device.
type DisconnectEvent struct {
GAPEvent
}