server

package
v0.0.0-...-bfada3a Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const INFLUX_PORT = "8086"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

type APIHandler func(*http.Request, ...string) (interface{}, error)

type APIStat

type APIStat struct {
	ID          string    `json:"id"`
	Family      string    `json:"family"`
	SensorName  string    `json:"sensor_name"`
	Time        time.Time `json:"time"`
	Temperature float64   `json:"temperature"`
}

type APIStatus

type APIStatus struct {
	Name          string            `json:"name"`
	HidrawDevice  hidraw.DeviceInfo `json:"hidraw"`
	AvrtempDevice avrtemp.Status    `json:"avrtemp"`
	Stats         map[string]string `json:"stats"`
}

type Config

type Config struct {
	Sensors map[string]*SensorConfig
}

type Device

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

func (Device) String

func (d Device) String() string

type InfluxOptions

type InfluxOptions struct {
	Server   string
	Database string
}

func (InfluxOptions) Empty

func (opts InfluxOptions) Empty() bool

type SensorConfig

type SensorConfig struct {
	ID string
	// contains filtered or unexported fields
}

func (*SensorConfig) String

func (self *SensorConfig) String() string

type Server

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

func New

func New() (*Server, error)

func (*Server) AddHidrawDevice

func (s *Server) AddHidrawDevice(deviceInfo hidraw.DeviceInfo)

func (*Server) GetConfig

func (s *Server) GetConfig(_ *http.Request, path ...string) (interface{}, error)

func (*Server) GetStats

func (s *Server) GetStats(_ *http.Request, path ...string) (interface{}, error)

func (*Server) GetStatus

func (s *Server) GetStatus(_ *http.Request, path ...string) (interface{}, error)

func (*Server) InfluxWriter

func (self *Server) InfluxWriter(options InfluxOptions) error

func (*Server) LoadConfig

func (s *Server) LoadConfig(filePath string) error

func (*Server) MonitorHidraw

func (s *Server) MonitorHidraw(monitorChan chan hidraw.MonitorEvent)

func (*Server) RemoveHidrawDevice

func (s *Server) RemoveHidrawDevice(deviceInfo hidraw.DeviceInfo)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Stat

type Stat struct {
	// set by Device.reader()
	Device      *Device
	ID          avrtemp.ID
	Time        time.Time
	Temperature avrtemp.Temperature

	// set by Server.run()
	SensorConfig *SensorConfig
}

func (Stat) String

func (stat Stat) String() string

Jump to

Keyboard shortcuts

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