bluetooth

package
v2.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: GPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bluetooth owns the lifecycle of the local Bluetooth adapter for the app-facing BLE transport: when to open it, when to give up, and when to try again after a dongle is plugged in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager keeps an adapter open while the BLE transport is enabled and hands its peripheral side to whoever registered interest.

func NewManager

func NewManager(cfg *config.Instance) *Manager

NewManager builds a manager over the system's Bluetooth stack. It never powers the adapter on: the radio may be off on purpose, and switching it on would disturb the device's gamepads.

func (*Manager) OnPeripheral

func (m *Manager) OnPeripheral(fn PeripheralFunc) func()

OnPeripheral registers fn to receive the peripheral now, if one is ready, and again after every re-open. The returned function unregisters it.

func (*Manager) Roles

func (m *Manager) Roles() []ble.Role

Roles reports what the open adapter supports, or nil without one.

func (*Manager) Serving

func (m *Manager) Serving() bool

Serving reports whether a peripheral is open and handed out.

func (*Manager) SetAdvertisingPaused

func (m *Manager) SetAdvertisingPaused(paused bool)

SetAdvertisingPaused stops or resumes advertising on the current peripheral and any later one, without dropping connected clients. Core pauses it while the user scans for or pairs a controller, so the radio is free for that.

func (*Manager) Start

func (m *Manager) Start()

Start begins watching. It never fails: an absent bus, daemon or adapter is reported once and retried every interval.

func (*Manager) Stop

func (m *Manager) Stop()

Stop closes the adapter and waits for the watch loop to exit.

type PeripheralFunc

type PeripheralFunc func(ble.Peripheral)

PeripheralFunc is called with a ready peripheral each time one becomes available. It must not block: start any long-running work on a goroutine.

Directories

Path Synopsis
Package apigatt defines the GATT contract the Zaparoo app uses to reach the JSON-RPC API over Bluetooth Low Energy: the service and characteristic UUIDs, the limits, and the framing that carries one API message across many small ATT packets.
Package apigatt defines the GATT contract the Zaparoo app uses to reach the JSON-RPC API over Bluetooth Low Energy: the service and characteristic UUIDs, the limits, and the framing that carries one API message across many small ATT packets.
Zaparoo Core Copyright (c) 2026 The Zaparoo Project Contributors.
Zaparoo Core Copyright (c) 2026 The Zaparoo Project Contributors.

Jump to

Keyboard shortcuts

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