Documentation ¶
Index ¶
- type Device
- func (d *Device) AddService(svc *ble.Service) error
- func (d *Device) Address() ble.Addr
- func (d *Device) Advertise(ctx context.Context, adv ble.Advertisement) error
- func (d *Device) AdvertiseIBeacon(ctx context.Context, u ble.UUID, major, minor uint16, pwr int8) error
- func (d *Device) AdvertiseIBeaconData(ctx context.Context, b []byte) error
- func (d *Device) AdvertiseMfgData(ctx context.Context, id uint16, b []byte) error
- func (d *Device) AdvertiseNameAndServices(ctx context.Context, name string, uuids ...ble.UUID) error
- func (d *Device) AdvertiseServiceData16(ctx context.Context, id uint16, b []byte) error
- func (d *Device) Close() error
- func (d *Device) Closed() <-chan struct{}
- func (d *Device) DialBLE(ctx context.Context, address ble.Addr, addressType ble.AddressType) (cli ble.ClientBLE, err error)
- func (d *Device) DialRFCOMM(ctx context.Context, a ble.Addr, clockOffset uint16, ...) (cli ble.ClientRFCOMM, err error)
- func (d *Device) Initialize(ctx context.Context) error
- func (d *Device) Inquire(ctx context.Context, interval time.Duration, numResponses int, ...) error
- func (d *Device) RemoveAllServices() error
- func (d *Device) RequestRemoteName(ctx context.Context, a ble.Addr) (string, error)
- func (d *Device) Scan(ctx context.Context, allowDup bool, h ble.AdvHandler) error
- func (d *Device) Serve(name string, handler ble.NotifyHandler) (err error)
- func (d *Device) SetDisconnectedHandler(f func(ble.Conn)) error
- func (d *Device) SetServices(svcs []*ble.Service) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Device ¶
Device ...
func (*Device) AddService ¶
AddService adds a service to database.
func (*Device) AdvertiseIBeacon ¶
func (d *Device) AdvertiseIBeacon(ctx context.Context, u ble.UUID, major, minor uint16, pwr int8) error
AdvertiseIBeacon advertises iBeacon with specified parameters.
func (*Device) AdvertiseIBeaconData ¶
AdvertiseIBeaconData advertise iBeacon with given manufacturer data.
func (*Device) AdvertiseMfgData ¶
AdvertiseMfgData avertises the given manufacturer data.
func (*Device) AdvertiseNameAndServices ¶
func (d *Device) AdvertiseNameAndServices(ctx context.Context, name string, uuids ...ble.UUID) error
AdvertiseNameAndServices advertises device name, and specified service UUIDs. It tres to fit the UUIDs in the advertising packet as much as possible. If name doesn't fit in the advertising packet, it will be put in scan response.
func (*Device) AdvertiseServiceData16 ¶
AdvertiseServiceData16 advertises data associated with a 16bit service uuid
func (*Device) DialBLE ¶ added in v0.0.6
func (d *Device) DialBLE(ctx context.Context, address ble.Addr, addressType ble.AddressType) (cli ble.ClientBLE, err error)
Dial ...
func (*Device) DialRFCOMM ¶
func (d *Device) DialRFCOMM(ctx context.Context, a ble.Addr, clockOffset uint16, pageScanRepetitionMode uint8, channel uint8) (cli ble.ClientRFCOMM, err error)
DialRFCOMM ... TODO: implement SDP to determine RFCOMM channel number
func (*Device) Inquire ¶
func (d *Device) Inquire(ctx context.Context, interval time.Duration, numResponses int, h ble.InqHandler) error
Inquire starts inquiring for bluetooth devices broadcasting using br/edr
func (*Device) RemoveAllServices ¶
RemoveAllServices removes all services that are currently in the database.
func (*Device) RequestRemoteName ¶
RequestRemoteName ...
func (*Device) Scan ¶
Scan starts scanning. Duplicated advertisements will be filtered out if allowDup is set to false.
func (*Device) Serve ¶ added in v0.0.6
func (d *Device) Serve(name string, handler ble.NotifyHandler) (err error)
blocking call