felicita

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// BuzzerSettingOn denotes that the basic Buzzer (on touch) setting is on
	BuzzerSettingOn = "ON"

	// BuzzerSettingOff denotes that the basic Buzzer (on touch) setting is off
	BuzzerSettingOff = "OFF"
)

Variables

This section is empty.

Functions

func WithDevice added in v1.0.2

func WithDevice(btDevice gatt.Device) func(*Felicita)

WithDevice sets the Bluetooth device

func WithDeviceID

func WithDeviceID(deviceID string) func(*Felicita)

WithDeviceID sets the Bluetooth device ID

func WithDeviceName

func WithDeviceName(deviceName string) func(*Felicita)

WithDeviceName sets the Bluetooth device name

func WithForceBuzzerSettingOnConnect added in v1.0.4

func WithForceBuzzerSettingOnConnect(setting BuzzerSetting) func(*Felicita)

WithForceBuzzerSettingOnConnect ensures that the basic Buzzer (on touch) setting is correct upon connection

func WithLogger added in v1.0.2

func WithLogger(logger scale.Logger) func(*Felicita)

WithLogger sets a logger

Types

type BuzzerSetting added in v1.0.4

type BuzzerSetting string

BuzzerSetting denotes the basic Buzzer (on touch) setting of the scale

type Felicita

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

Felicita denotes a Felicita bluetooth scale

func New

func New(options ...func(*Felicita)) (*Felicita, error)

New instantiates a new Felicita struct, executing functional options, if any

func (*Felicita) BatteryLevel

func (f *Felicita) BatteryLevel() float64

BatteryLevel returns the current battery level

func (*Felicita) BatteryLevelRaw

func (f *Felicita) BatteryLevelRaw() int

BatteryLevelRaw returns the current battery level in its raw form

func (*Felicita) Buzz

func (f *Felicita) Buzz(n int) (err error)

Buzz requests the scale to beep / buzz n times

func (*Felicita) Close

func (f *Felicita) Close() error

Close terminates the connection to the device

func (*Felicita) ConnectionStatus

func (f *Felicita) ConnectionStatus() scale.ConnectionStatus

ConnectionStatus returns the current status of the bluetooth device

func (*Felicita) ElapsedTime

func (f *Felicita) ElapsedTime() time.Duration

ElapsedTime returns the current timer value

func (*Felicita) IsBuzzingOnTouch

func (f *Felicita) IsBuzzingOnTouch() bool

IsBuzzingOnTouch returns if the scale buzzer is turned on or not (on user interaction)

func (*Felicita) ResetTimer

func (f *Felicita) ResetTimer() error

ResetTimer resets the timer / stopwatch

func (*Felicita) SetDataChannel

func (f *Felicita) SetDataChannel(ch chan scale.DataPoint)

SetDataChannel defines a handler function that is called upon retrieval of data

func (*Felicita) SetDataHandler

func (f *Felicita) SetDataHandler(fn func(data scale.DataPoint))

SetDataHandler defines a handler function that is called upon retrieval of data

func (*Felicita) SetStateChangeChannel

func (f *Felicita) SetStateChangeChannel(ch chan scale.ConnectionStatus)

SetStateChangeChannel defines a handler function that is called upon state change

func (*Felicita) SetStateChangeHandler

func (f *Felicita) SetStateChangeHandler(fn func(status scale.ConnectionStatus))

SetStateChangeHandler defines a handler function that is called upon state change

func (*Felicita) SetUnit

func (f *Felicita) SetUnit(unit scale.Unit) error

SetUnit changes the weight unit from / to g / oz

func (*Felicita) StartTimer

func (f *Felicita) StartTimer() error

StartTimer starts the timer / stopwatch

func (*Felicita) StopTimer

func (f *Felicita) StopTimer() error

StopTimer stops the timer / stopwatch

func (*Felicita) Tare

func (f *Felicita) Tare() error

Tare tares the scale

func (*Felicita) ToggleBuzzingOnTouch

func (f *Felicita) ToggleBuzzingOnTouch() error

ToggleBuzzingOnTouch turns the buzzer (on user interaction) on / off

func (*Felicita) TogglePrecision

func (f *Felicita) TogglePrecision() error

TogglePrecision toggles the weight precision between 0.1 and 0.01

func (*Felicita) Unit

func (f *Felicita) Unit() scale.Unit

Unit returns the current weight unit

Jump to

Keyboard shortcuts

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