ruuvi

package
v0.0.0-...-b556cff Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(adapter DatabaseAdapter) http.HandlerFunc

Handler parses measurement from HTTP body and saves it to database

Types

type DatabaseAdapter

type DatabaseAdapter interface {
	Save(*Measurement) error
}

type Measurement

type Measurement struct {
	Tags []struct {
		AccelX                    float32 `json:"accelX"`
		AccelY                    float32 `json:"accelY"`
		AccelZ                    float32 `json:"accelZ"`
		DataFormat                int     `json:"dataFormat"`
		DefaultBackground         int     `json:"defaultBackground"`
		Favorite                  bool    `json:"favorite"`
		Humidity                  float32 `json:"humidity"`
		ID                        string  `json:"id"`
		MeasurementSequenceNumber int     `json:"measurementSequenceNumber"`
		MovementCounter           int     `json:"movementCounter"`
		Name                      string  `json:"name,omitempty"`
		Pressure                  float32 `json:"pressure"`
		RSSI                      int     `json:"rssi"`
		Temperature               float32 `json:"temperature"`
		TXPower                   float32 `json:"txPower"`
		UpdateAt                  string  `json:"updateAt"`
		Voltage                   float32 `json:"voltage"`
		RawDataBlob               struct {
			// contains filtered or unexported fields
		} `json:"rawDataBlob"`
	} `json:"tags"`
	BatteryLevel int    `json:"batteryLevel"`
	DeviceID     string `json:"deviceId"`
	EventID      string `json:"eventId"`
	Location     struct {
		Accuracy  float32 `json:"accuracy"`
		Latitude  float32 `json:"latitude"`
		Longitude float32 `json:"longitude"`
	} `json:"location"`
	Time string `json:"time"`
}

func Parse

func Parse(b []byte) (*Measurement, error)

Jump to

Keyboard shortcuts

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