Documentation ¶
Index ¶
- Constants
- func ContainsKeys(a map[string]string, b map[string]bool) bool
- func Filter(peripherals map[string]string) func(ble.Advertisement) bool
- func LogInvalidData(ctx context.Context, logger *slog.Logger, data []byte, err error)
- func Read(a ble.Advertisement) (sd commonsensor.Data, err error)
- type BLEScanner
- type ContinuousScanner
- type DeviceCreator
- type Measurements
- type OnceScanner
- type Scanner
Constants ¶
View Source
const BufferSize = 128
Variables ¶
This section is empty.
Functions ¶
func LogInvalidData ¶
LogInvalidData logs invalid BLE advertisement data
func Read ¶
func Read(a ble.Advertisement) (sd commonsensor.Data, err error)
Read reads sensor data from advertisement
Types ¶
type BLEScanner ¶
type ContinuousScanner ¶
type ContinuousScanner struct { Exporters []exporter.Exporter Quit chan int // contains filtered or unexported fields }
func NewContinuous ¶
func NewContinuous(logger *slog.Logger, peripherals map[string]string) *ContinuousScanner
func (*ContinuousScanner) Close ¶
func (s *ContinuousScanner) Close()
Close closes the scanner and frees allocated resources
func (*ContinuousScanner) Init ¶
func (s *ContinuousScanner) Init(device string) error
Init initializes scanner using the given device
func (*ContinuousScanner) Scan ¶
func (s *ContinuousScanner) Scan(ctx context.Context)
Scan scans and reports measurements immediately as they are received
type Measurements ¶
type Measurements struct { BLE BLEScanner Peripherals map[string]string Logger *slog.Logger }
func (*Measurements) Channel ¶
func (s *Measurements) Channel(ctx context.Context) chan sensor.Data
Channel creates a channel that will receive measurements read from all registered peripherals. The cancel function should be called after the client is done with receiving measurements or wishes to abort the scan.
type OnceScanner ¶
func (*OnceScanner) Close ¶
func (s *OnceScanner) Close()
func (*OnceScanner) Init ¶
func (s *OnceScanner) Init(device string) error
type Scanner ¶
type Scanner struct { Exporters []exporter.Exporter Quit chan int // contains filtered or unexported fields }
func (*Scanner) Close ¶
func (s *Scanner) Close()
Close closes the scanner and frees allocated resources
Click to show internal directories.
Click to hide internal directories.