linux

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0, BSD-3-Clause Imports: 8 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
}

Device ...

func NewDevice

func NewDevice(opts ...ble.Option) (*Device, error)

NewDevice returns the default HCI device.

func NewDeviceWithName

func NewDeviceWithName(name string, opts ...ble.Option) (*Device, error)

NewDeviceWithName returns the default HCI device.

func NewDeviceWithNameAndHandler

func NewDeviceWithNameAndHandler(name string, handler ble.NotifyHandler, opts ...ble.Option) (*Device, error)

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

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

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

Dial ...

func (*Device) RemoveAllServices

func (d *Device) RemoveAllServices() error

RemoveAllServices removes all services that are currently in the database.

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