Documentation ¶
Index ¶
- type Device
- func (d *Device) AddService(svc *ble.Service) error
- func (d *Device) Address() ble.Addr
- 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) Dial(ctx context.Context, a ble.Addr) (ble.Client, error)
- func (d *Device) RemoveAllServices() error
- func (d *Device) Scan(ctx context.Context, allowDup bool, h ble.AdvHandler) error
- func (d *Device) SetServices(svcs []*ble.Service) error
- func (d *Device) Stop() 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) RemoveAllServices ¶
RemoveAllServices removes all services that are currently in the database.
func (*Device) Scan ¶
Scan starts scanning. Duplicated advertisements will be filtered out if allowDup is set to false.
func (*Device) SetServices ¶
SetServices set the specified service to the database. It removes all currently added services, if any.