mock

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

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

Mock denotes a Mock bluetooth scale

func New

func New() (*Mock, error)

New instantiates a new Mock struct

func (*Mock) BatteryLevel

func (f *Mock) BatteryLevel() float64

BatteryLevel returns the current battery level

func (*Mock) BatteryLevelRaw

func (f *Mock) BatteryLevelRaw() int

BatteryLevelRaw returns the current battery level in its raw form

func (*Mock) Buzz

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

Buzz requests the scale to beep / buzz n times

func (*Mock) Close

func (f *Mock) Close() error

Close terminates the connection to the device

func (*Mock) ConnectionStatus

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

ConnectionStatus returns the current status of the bluetooth device

func (*Mock) ElapsedTime

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

ElapsedTime returns the current timer value

func (*Mock) IsBuzzingOnTouch

func (f *Mock) IsBuzzingOnTouch() bool

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

func (*Mock) ResetTimer

func (f *Mock) ResetTimer() error

ResetTimer resets the timer / stopwatch

func (*Mock) SetDataChannel

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

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

func (*Mock) SetDataHandler

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

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

func (*Mock) SetStateChangeChannel

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

SetStateChangeChannel defines a handler function that is called upon state change

func (*Mock) SetStateChangeHandler

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

SetStateChangeHandler defines a handler function that is called upon state change

func (*Mock) SetUnit

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

SetUnit changes the weight unit from / to g / oz

func (*Mock) StartTimer

func (f *Mock) StartTimer() error

StartTimer starts the timer / stopwatch

func (*Mock) StopTimer

func (f *Mock) StopTimer() error

StopTimer stops the timer / stopwatch

func (*Mock) Tare

func (f *Mock) Tare() error

Tare tares the scale

func (*Mock) ToggleBuzzingOnTouch

func (f *Mock) ToggleBuzzingOnTouch() error

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

func (*Mock) TogglePrecision

func (f *Mock) TogglePrecision() error

TogglePrecision toggles the weight precision between 0.1 and 0.01

func (*Mock) Unit

func (f *Mock) 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