Documentation ¶
Index ¶
Constants ¶
View Source
const GramsInOunce = 28.3495231
View Source
const VendorID usb.ID = 0x0922 // Dymo, all devices
Variables ¶
View Source
var ( ErrInvalidRead = fmt.Errorf("scale gave invalid reading") ErrNeedsTare = fmt.Errorf("scale reads negative, please tare") )
Functions ¶
This section is empty.
Types ¶
type Measurement ¶
type Measurement struct { AlwaysThree int8 // Don't know what this is but it's always 3 Stability Stability // How accurate the measurement was Mode Mode // Grams or Ounces ScaleFactor int8 // Total weight * 10^n WeightMinor uint8 // WeightMajor uint8 // Overflow for WeightMinor, n*256 }
Measurement represents a parsed reading from the scale.
func (*Measurement) Grams ¶
func (m *Measurement) Grams() (int, error)
Grams returns the measurement in grams.
type Measurementer ¶
func ReadMeasurement ¶
func ReadMeasurement(reader io.Reader) (Measurementer, error)
ReadMeasurement obtains a Measurement from an io.Reader.
type Scale ¶
type Scale struct {
// contains filtered or unexported fields
}
func (*Scale) Close ¶
Close closes the USB device and context. If there are any errors then the inner-most is returned, but both will still attempt to be closed.
func (*Scale) ReadMeasurement ¶
func (s *Scale) ReadMeasurement() (Measurementer, error)
ReadMeasurement returns a parsed Measurement from the scale.
Click to show internal directories.
Click to hide internal directories.