thingsif

package
v0.0.0-...-e7c921c Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintGatways

func PrintGatways(gw []*GwMetadata)

*

Types

type DbList

type DbList struct {
	List []*DbMessage
}

type DbMessage

type DbMessage struct {
	Time  string  `json:"time"`
	DevID string  `json:"device_id"`
	Raw   string  `json:"raw"`
	Bat   float64 `json:"bat"`
	Humid float64 `json:"humd"`
	Temp  float64 `json:"temp"`
	Rain  float64 `json:"rain,omitempty"`
	Pres  float64 `json:"pres,omitempty"`
	Valid bool    `json:"valid"`
}

func (*DbMessage) NodeEntry

func (d *DbMessage) NodeEntry() *NodeEntry

type GwMetadata

type GwMetadata struct {
	Timestamp  int64   `json:"timestamp"`
	GtwID      string  `json:"gtw_id"`
	GtwTrusted bool    `json:"gtw_trusted"`
	Channel    int     `json:"channel"`
	RSSI       float64 `json:"rssi"`
	SNR        float64 `json:"snr"`
	RFChain    int     `json:"rf_chain"`
	Latitude   float64 `json:"latitude"`
	Longitude  float64 `json:"longitude"`
	Altitude   float64 `json:"altitude"`
}

type HandMessage

type HandMessage struct {
	Services []HandServ `json:"services"`
}

type HandMeta

type HandMeta struct {
	AppID string `json:"app_id"`
}

type HandServ

type HandServ struct {
	MQTTAddr string     `json:"mqtt_address"`
	Metadata []HandMeta `json:"metadata"`
}

type MQTTCli

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

func NewClient

func NewClient(conf MQTTConfig) (*MQTTCli, error)

func (*MQTTCli) Close

func (mq *MQTTCli) Close()

func (*MQTTCli) GetLast7days

func (mq *MQTTCli) GetLast7days() ([]DbMessage, error)

func (*MQTTCli) WaitForData

func (mq *MQTTCli) WaitForData() (*Message, error)

* Blocks on incoming message.

type MQTTConfig

type MQTTConfig struct {
	Username string
	Password string
}

type Message

type Message struct {
	PayloadFields *NodeEntry    `json:"payload_fields"`
	DevID         string        `json:"dev_id"`
	AppID         string        `json:"app_id"`
	HWSerial      string        `json:"hardware_serial"`
	Port          int           `json:"port"`
	Counter       int           `json:"counter"`
	PayloadRaw    string        `json:"payload_raw"`
	Metadata      *NodeMetadata `json:"metadata"`
}

type NodeEntry

type NodeEntry struct {
	Bat   float64 `json:"bat"`
	Humid float64 `json:"humd"`
	Temp  float64 `json:"temp"`
	Rain  float64 `json:"rain,omitempty"`
	Pres  float64 `json:"pres,omitempty"`
	Valid bool    `json:"valid"`
}

type NodeMetadata

type NodeMetadata struct {
	Time       string        `json:"time"`
	Frequency  float64       `json:"frequency"`
	Modulation string        `json:"modulation"`
	DataRate   string        `json:"data_rate"`
	CodingRate string        `json:"coding_rate"`
	Gateways   []*GwMetadata `json:"gateways"`
}

Jump to

Keyboard shortcuts

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