Documentation ¶
Index ¶
- func Filter(peripherals map[string]string) func(ble.Advertisement) bool
- func LogInvalidData(ctx context.Context, logger *slog.Logger, data []byte, err error)
- func NewMockBLEScanner(advertisements ...ble.Advertisement) *mockBLEScanner
- func Read(a ble.Advertisement) (sd commonsensor.Data, err error)
- func Validate(cfg Config) error
- type BLEScanner
- type Config
- type DeviceCreator
- type Discover
- type GoBLEDeviceCreator
- type GoBLEScanner
- type Measurements
- type Scanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogInvalidData ¶
LogInvalidData logs invalid BLE advertisement data
func NewMockBLEScanner ¶ added in v1.2.0
func NewMockBLEScanner(advertisements ...ble.Advertisement) *mockBLEScanner
func Read ¶
func Read(a ble.Advertisement) (sd commonsensor.Data, err error)
Read reads sensor data from advertisement
Types ¶
type BLEScanner ¶
type Config ¶ added in v1.2.0
type Config struct { Exporters []exporter.Exporter DeviceName string BLEScanner BLEScanner Peripherals map[string]string DeviceCreator DeviceCreator Logger *slog.Logger }
func DefaultConfig ¶ added in v1.2.0
func DefaultConfig() Config
type Discover ¶ added in v1.4.0
type Discover struct {
// contains filtered or unexported fields
}
func NewDiscover ¶ added in v1.4.0
func NewDiscover(device string, ble BLEScanner, dev DeviceCreator, logger *slog.Logger) (*Discover, error)
type GoBLEDeviceCreator ¶ added in v1.2.0
type GoBLEDeviceCreator struct { }
type GoBLEScanner ¶ added in v1.2.0
type GoBLEScanner struct { }
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.
Click to show internal directories.
Click to hide internal directories.