Documentation
¶
Index ¶
- Constants
- func WithDevice(btDevice gatt.Device) func(*Felicita)
- func WithDeviceID(deviceID string) func(*Felicita)
- func WithDeviceName(deviceName string) func(*Felicita)
- func WithForceBuzzerSettingOnConnect(setting BuzzerSetting) func(*Felicita)
- func WithLogger(logger scale.Logger) func(*Felicita)
- type BuzzerSetting
- type Felicita
- func (f *Felicita) BatteryLevel() float64
- func (f *Felicita) BatteryLevelRaw() int
- func (f *Felicita) Buzz(n int) (err error)
- func (f *Felicita) Close() error
- func (f *Felicita) ConnectionStatus() scale.ConnectionStatus
- func (f *Felicita) ElapsedTime() time.Duration
- func (f *Felicita) IsBuzzingOnTouch() bool
- func (f *Felicita) ResetTimer() error
- func (f *Felicita) SetDataChannel(ch chan scale.DataPoint)
- func (f *Felicita) SetDataHandler(fn func(data scale.DataPoint))
- func (f *Felicita) SetStateChangeChannel(ch chan scale.ConnectionStatus)
- func (f *Felicita) SetStateChangeHandler(fn func(status scale.ConnectionStatus))
- func (f *Felicita) SetUnit(unit scale.Unit) error
- func (f *Felicita) StartTimer() error
- func (f *Felicita) StopTimer() error
- func (f *Felicita) Tare() error
- func (f *Felicita) ToggleBuzzingOnTouch() error
- func (f *Felicita) TogglePrecision() error
- func (f *Felicita) Unit() scale.Unit
Constants ¶
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
WithDevice sets the Bluetooth device
func WithDeviceID ¶
WithDeviceID sets the Bluetooth device ID
func WithDeviceName ¶
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
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 (*Felicita) BatteryLevel ¶
BatteryLevel returns the current battery level
func (*Felicita) BatteryLevelRaw ¶
BatteryLevelRaw returns the current battery level in its raw form
func (*Felicita) ConnectionStatus ¶
func (f *Felicita) ConnectionStatus() scale.ConnectionStatus
ConnectionStatus returns the current status of the bluetooth device
func (*Felicita) ElapsedTime ¶
ElapsedTime returns the current timer value
func (*Felicita) IsBuzzingOnTouch ¶
IsBuzzingOnTouch returns if the scale buzzer is turned on or not (on user interaction)
func (*Felicita) ResetTimer ¶
ResetTimer resets the timer / stopwatch
func (*Felicita) SetDataChannel ¶
SetDataChannel defines a handler function that is called upon retrieval of data
func (*Felicita) SetDataHandler ¶
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) StartTimer ¶
StartTimer starts the timer / stopwatch
func (*Felicita) ToggleBuzzingOnTouch ¶
ToggleBuzzingOnTouch turns the buzzer (on user interaction) on / off
func (*Felicita) TogglePrecision ¶
TogglePrecision toggles the weight precision between 0.1 and 0.01