zway

package
v0.0.0-...-318d700 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCookieNotFound = errors.New("Cookie not found")

Functions

This section is empty.

Types

type Config

type Config struct {
	Hostname    string
	Port        string
	Username    string
	Password    string
	PollTimeout time.Duration
}

type Device

type Device struct {
	sync.RWMutex
	DeviceType        DeviceType `json:"deviceType"`
	Tags              []string   `json:"tags"`
	CreatorID         int        `json:"creatorId"`
	HasHistory        bool       `json:"hasHistory"`
	ID                string     `json:"id"`
	Location          int        `json:"location"`
	Metrics           Metrics    `json:"metrics"`
	PermanentlyHidden bool       `json:"permanently_hidden"`
	ProbeType         ProbeType  `json:"probeType"`
	Visibility        bool       `json:"visibility"`
	UpdateTime        float64    `json:"updateTime"`
}

func (*Device) Update

func (d *Device) Update(level Level, updateTime float64)

type DeviceType

type DeviceType struct {
	Name string
}

func (*DeviceType) MarshalJSON

func (dt *DeviceType) MarshalJSON() ([]byte, error)

func (*DeviceType) UnmarshalJSON

func (dt *DeviceType) UnmarshalJSON(data []byte) error

type Devices

type Devices struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Devices) AddDevice

func (devices *Devices) AddDevice(device *Device)

func (*Devices) AddNewDeviceListener

func (devices *Devices) AddNewDeviceListener(fn func(*Device)) int64

func (*Devices) GetDevice

func (devices *Devices) GetDevice(id string) (device *Device, found bool)

func (*Devices) RemoveNewDeviceListener

func (devices *Devices) RemoveNewDeviceListener(id int64)

type DevicesResponse

type DevicesResponse struct {
	Data struct {
		Devices          []*Device `json:"devices"`
		StructureChanged bool      `json:"structureChanged"`
		UpdateTime       float64   `json:"updateTime"`
	} `json:"data"`
}

type Level

type Level struct {
	sync.RWMutex
	Value interface{}
	// contains filtered or unexported fields
}

func (*Level) AddValueChangeListener

func (l *Level) AddValueChangeListener(fn func(*Level)) int64

func (*Level) MarshalJSON

func (l *Level) MarshalJSON() ([]byte, error)

func (*Level) RemoveValueChangeListener

func (l *Level) RemoveValueChangeListener(id int64)

func (*Level) SetValue

func (l *Level) SetValue(val interface{})

func (*Level) String

func (l *Level) String() string

func (*Level) ToBoolean

func (l *Level) ToBoolean() (bool, error)

func (*Level) ToFloat

func (l *Level) ToFloat() (float64, error)

func (*Level) UnmarshalJSON

func (l *Level) UnmarshalJSON(data []byte) error

type Metrics

type Metrics struct {
	ProbeTitle string `json:"probeTitle"`
	ScaleTitle string `json:"scaleTitle"`
	Title      string `json:"title"`
	Level      Level  `json:"level"`
}

type ProbeType

type ProbeType struct {
	Name string
}

func (*ProbeType) MarshalJSON

func (bt *ProbeType) MarshalJSON() ([]byte, error)

func (*ProbeType) UnmarshalJSON

func (bt *ProbeType) UnmarshalJSON(data []byte) error

type ZWay

type ZWay struct {
	sync.RWMutex
	Config  Config
	Cookie  *http.Cookie
	Devices Devices
	// contains filtered or unexported fields
}

func New

func New(config Config) (zWay *ZWay, err error)

func (*ZWay) Auth

func (zWay *ZWay) Auth() (err error)

func (*ZWay) NewRequest

func (zWay *ZWay) NewRequest(method, path string, body io.Reader) (*http.Request, error)

func (*ZWay) Poll

func (zWay *ZWay) Poll(interval time.Duration)

func (*ZWay) Stop

func (zWay *ZWay) Stop()

Jump to

Keyboard shortcuts

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