host

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: BSD-2-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 CommandExecutionError

type CommandExecutionError struct {
	// contains filtered or unexported fields
}

CommandExecutionError is returned when HCI command could not be executed.

func (*CommandExecutionError) Error

func (e *CommandExecutionError) Error() string

func (*CommandExecutionError) ErrorCode

func (e *CommandExecutionError) ErrorCode() hci.ErrorCode

ErrorCode returns the error code indicating reason for command execution failure

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host implements the host side of Bluetooth Host - Controller interface

func New

func New(tr hci.Transport) *Host

New returns new host which uses given transport for communicating with controller

func (*Host) Deinit

func (h *Host) Deinit()

Deinit will deinitialize Host

func (*Host) Init

func (h *Host) Init() error

Init initializes the host

func (*Host) SetAdvertisingData

func (h *Host) SetAdvertisingData(data []*hci.AdStructure) error

SetAdvertisingData sets the advertising data that will be sent when advertising is enabled

func (*Host) SetAdvertisingParams

func (h *Host) SetAdvertisingParams(advParams hci.AdvertisingParameters) error

SetAdvertisingParams set advertising params to the controller. hci.DefaultAdvParameters() can be used to get default set of parameters.

func (*Host) SetRandomAddress

func (h *Host) SetRandomAddress(addr hci.BtAddress) error

SetRandomAddress sets LE Random Device Address to the Controller

func (*Host) SetScanResponse

func (h *Host) SetScanResponse(data []*hci.AdStructure) error

SetScanResponse sets the scan response data which will be sent when advertising and the mode allows it.

func (*Host) StartAdvertising

func (h *Host) StartAdvertising() error

StartAdvertising directs the controller to start sending advertisments

func (*Host) StartScanning

func (h *Host) StartScanning(active bool, filters []filter.AdFilter) (chan *ScanReport, error)

StartScanning will start scanning for Bluetooth LE Advertisements Active defines if active or passive scanning should be done The returned channel can be used to receive all scan reports matching _any_ of the filters on list. The returned cannel should _not_ be closed.

func (*Host) StopAdvertising

func (h *Host) StopAdvertising() error

StopAdvertising directs the controller to stop sending advertisments

func (*Host) StopScanning

func (h *Host) StopScanning() error

StopScanning stops scanning for advertising LE devices

type ScanReport

type ScanReport struct {
	Type    hci.AdvType
	Address hci.BtAddress
	Rssi    int8
	Data    []*hci.AdStructure
}

ScanReport contains information about a device found on scanning See Bluetooth 5.0, vol 2, part E, ch 7.7.65.2

Jump to

Keyboard shortcuts

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