linux

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

Device ...

func NewDevice

func NewDevice() (*Device, error)

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) 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) Dial

func (d *Device) Dial(ctx context.Context, a ble.Addr) (ble.Client, error)

Dial ...

func (*Device) DialRFCOMM

func (d *Device) DialRFCOMM(ctx context.Context, a ble.Addr, clockOffset uint16, pageScanRepetitionMode uint8, channel uint8) (ble.RFCOMMClient, error)

DialRFCOMM ... TODO: implement SDP to determine RFCOMM channel number

func (*Device) Inquire

func (d *Device) Inquire(ctx context.Context, 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(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) 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.

func (*Device) SocketError added in v0.0.3

func (d *Device) SocketError() <-chan error

SocketError ...

func (*Device) Stop

func (d *Device) Stop() error

Stop stops gatt server.

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