linux

package
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2022 License: BSD-3-Clause Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	sync.WaitGroup
	HCI    *hci.HCI
	Server *gatt.Server
	// contains filtered or unexported fields
}

Device ...

func NewDevice

func NewDevice() *Device

NewDevice returns the default HCI device.

func (*Device) AddService

func (d *Device) AddService(svc *ble.Service) error

AddService adds a service to database.

func (*Device) Address

func (d *Device) Address() ble.Addr

Address returns the listener's device address.

func (*Device) Advertise added in v0.0.6

func (d *Device) Advertise(ctx context.Context, adv ble.Advertisement) error

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

func (d *Device) AdvertiseIBeaconData(ctx context.Context, b []byte) error

AdvertiseIBeaconData advertise iBeacon with given manufacturer data.

func (*Device) AdvertiseMfgData

func (d *Device) AdvertiseMfgData(ctx context.Context, id uint16, b []byte) error

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

func (d *Device) AdvertiseServiceData16(ctx context.Context, id uint16, b []byte) error

AdvertiseServiceData16 advertises data associated with a 16bit service uuid

func (*Device) Close added in v0.0.6

func (d *Device) Close() error

Closes the gatt server.

func (*Device) Closed added in v0.0.4

func (d *Device) Closed() <-chan struct{}

Closed ...

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) Initialize added in v0.0.6

func (d *Device) Initialize(ctx context.Context) error

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

func (d *Device) RemoveAllServices() error

RemoveAllServices removes all services that are currently in the database.

func (*Device) RequestRemoteName

func (d *Device) RequestRemoteName(ctx context.Context, a ble.Addr) (string, error)

RequestRemoteName ...

func (*Device) Scan

func (d *Device) Scan(ctx context.Context, allowDup bool, h ble.AdvHandler) error

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

func (*Device) SetServices

func (d *Device) SetServices(svcs []*ble.Service) error

SetServices set the specified service to the database. It removes all currently added services, if any.

Directories

Path Synopsis
hci
cmd
evt
tools

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL