gears

package
v0.0.0-...-4bd5384 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2015 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeOK = iota
	CodeClientError
	CodeServerError
	CodeAckTimeout
)
View Source
const FormatAt = "2006-01-02 15:04:05.999"

Variables

View Source
var AckTimeoutError = fmt.Errorf("ACK timeout")

Functions

This section is empty.

Types

type EchoReply

type EchoReply string

type EchoRequest

type EchoRequest string // string to echo

Echo request - simple ping-pong test request

type GearConn

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

func Dial

func Dial(addr string) (*GearConn, error)

func (*GearConn) Close

func (gc *GearConn) Close()

func (*GearConn) RFSend

func (gc *GearConn) RFSend(msg RFMessage) error

func (*GearConn) RFSubscribe

func (gc *GearConn) RFSubscribe(start int64) (<-chan RFMessage, error)

func (*GearConn) SensorRead

func (gc *GearConn) SensorRead(name string, startAt, endAt, step int64) (
	<-chan SensorDataValue, error)

func (*GearConn) SensorSendData

func (gc *GearConn) SensorSendData(name string, si SensorInfo) (chan<- SensorDataValue, error)

func (*GearConn) SensorSubscribe

func (gc *GearConn) SensorSubscribe(name string, startAt int64) (<-chan SensorDataValue, error)

type ParamGetRequest

type ParamGetRequest struct {
	Name string
}

type ParamPutRequest

type ParamPutRequest struct {
	Name  string
	Value string
}

Put an arbitrary parameter - used to store random stuff

type ParamReply

type ParamReply struct {
	Value string
}

type RFMessage

type RFMessage struct {
	At    int64  // milliseconds since unix epoch
	Group byte   // RF network group
	Node  byte   // RF node ID (Node=0 -> bcast)
	DoAck bool   // Send with ack requested
	Kind  byte   // Message payload type ("module" numbers)
	Data  []byte // Message payload
}

RF Message

func (RFMessage) RfTag

func (m RFMessage) RfTag() string

type RFSendRequest

type RFSendRequest RFMessage

type RFSubRequest

type RFSubRequest struct {
	StartAt  int64          // timestamp of first message, 0=start with real-time stream
	Match    RFMessage      // matcher for messages (not yet implemented)
	Messages libchan.Sender // channel of RFMessage
}

RFMessage Subscription request - subscribes to all RF Messages received by hub. The subscription can start in the past, in which case messages are replayed from the database and then seamlessly switched-over into the real-time stream.

type Reply

type Reply struct {
	Code  int
	Error string
	ER    *EchoReply
	PG    *ParamReply
	SI    *SensorInfo
}

type Request

type Request struct {
	ER    *EchoRequest       // simple ping-pong test request
	RFS   *RFSubRequest      // subscribe to raw RF messages
	RF    *RFSendRequest     // send a raw RF message
	SI    *SensorInfoRequest // get sensor info
	SD    *SensorDataRequest // send sensor data
	SR    *SensorReadRequest // read averaged sensor data
	SS    *SensorSubRequest  // subscribe to real-time sensor data
	PP    *ParamPutRequest   // put an arbitrary parameter
	PG    *ParamGetRequest   // get an arbitrary parameter
	Reply libchan.Sender
}

"Union" of requests made over the main channel

type SensorDataRequest

type SensorDataRequest struct {
	Name   string // hierarchical sensor name & location
	Info   SensorInfo
	Values libchan.Receiver // channel of SensorDataValue
}

Sensor Data request

type SensorDataValue

type SensorDataValue struct {
	At    int64 // milliseconds since unix epoch
	Value float64
}

type SensorInfo

type SensorInfo struct {
	Unit string
	Rate bool
}

type SensorInfoRequest

type SensorInfoRequest struct {
	Name string
}

type SensorReadRequest

type SensorReadRequest struct {
	Name    string
	StartAt int64          // first data point, milliseconds since unix epoch
	EndAt   int64          // last data point (inclusive), milliseconds since unix epoch
	Step    int64          // step in millisecsond, (EndAt-StartAt)%Step must be 0
	Values  libchan.Sender // channel of SensorDataValue
}

Sensor Read request

type SensorSubRequest

type SensorSubRequest struct {
	Name    string
	StartAt int64          // first data point, milliseconds since unix epoch
	Values  libchan.Sender // channel of SensorDataValue
}

Sensor Subscription Request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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