sensorproxy

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2019 License: MIT Imports: 1 Imported by: 1

README

iio-sensor-proxy - Go bindings

iio-sensor-proxy bindings for Go, based on godbus

Note

This is my first Go project. It might not follow best practices, etc. If so, please do let me know ;)

Usage

$ go get github.com/Depau/go-iio-sensor-proxy

Get a connection to the system bus:

conn, err := dbus.SystemBus()
if err != nil {
    log.Fatal(err)
}

Get an instance of the sensor proxy:

sensorProxy, err := sensorproxy.NewSensorProxyFromBus(conn)
if err != nil {
    log.Fatal(err)
}

Then use it:

err := sensorProxy.ClaimAccelerometer()
// [handle error]
orientation, err := sensorProxy.GetAccelerometerOrientation()
// ...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SensorProxy

type SensorProxy interface {
	HasAccelerometer() (bool, error)
	HasAmbientLight() (bool, error)

	ClaimAccelerometer() error
	ReleaseAccelerometer() error
	ClaimAmbientLight() error
	ReleaseAmbientLight() error

	GetAccelerometerOrientation() (string, error)
	GetLightLevel() (float64, error)
	GetLightLevelUnit() (string, error)
}

func NewSensorProxyFromBus

func NewSensorProxyFromBus(systemBus *dbus.Conn) (SensorProxy, error)

Jump to

Keyboard shortcuts

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