Documentation
¶
Overview ¶
Package weatherlink implements the Davis Instruments serial, USB, and TCP/IP communication protocol.
Index ¶
- Constants
- Variables
- func StdIdle(c *Conn, ec chan<- interface{}) (err error)
- type Conn
- func (c Conn) Close() error
- func (c Conn) GetConsTime() (time.Time, error)
- func (c Conn) GetDmps(ec chan<- interface{}, lastRec time.Time) (newLastRec time.Time, err error)
- func (c Conn) GetEEPROM(ec chan<- interface{}) error
- func (c Conn) GetFirmBuildTime() (time.Time, error)
- func (c Conn) GetFirmVer() (string, error)
- func (c Conn) GetHiLows(ec chan<- interface{}) error
- func (c *Conn) GetLoops(ec chan<- interface{}) (err error)
- func (c Conn) SetLamps(on bool) (err error)
- func (c *Conn) Start(idle Idler) <-chan interface{}
- func (c Conn) Stop()
- func (c Conn) SyncConsTime() error
- type Idler
Constants ¶
const ( GetDmps cmd = iota GetEEPROM GetHiLows GetLoops LampsOff LampsOn Stop SyncConsTime )
Commands.
Variables ¶
var ( Trace = log.New(io.Discard, "[TRCE]", log.LstdFlags|log.Lmicroseconds|log.Lshortfile) Debug = log.New(io.Discard, "[DBUG]", log.LstdFlags|log.Lshortfile) Info = log.New(io.Discard, "[INFO]", log.LstdFlags) Warn = log.New(io.Discard, "[WARN]", log.LstdFlags|log.Lshortfile) Error = log.New(io.Discard, "[ERRO]", log.LstdFlags|log.Lshortfile) )
Loggers.
var (
ConsTimeSyncFreq = 24 * time.Hour
)
Tunables.
var (
ErrCmdFailed = errors.New("command failed")
)
Errors.
var Sdump = func(i ...interface{}) (s string) { return fmt.Sprintf(strings.Repeat("%+v\n", len(i)), i...) }
Sdump returns a variable as a string. It includes field names and pointers, if applicable.
Functions ¶
Types ¶
type Conn ¶
type Conn struct { LastDmp time.Time // Time of the last downloaded archive record NewArcRec bool // Indicates a new archive record is available Q chan cmd // Command queue // contains filtered or unexported fields }
Conn holds the weatherlink connnection context.
func (Conn) GetConsTime ¶
GetConsTime gets the console time.
func (Conn) GetDmps ¶
GetDmps downloads all archive records *after* lastRec and sends them to the event channel ordered from oldest to newest. It returns the time of the last record it read.
If lastRec does not match an existing archive timestamp (which is the case if left uninitialized) then all records in memory are returned.
func (Conn) GetFirmBuildTime ¶ added in v1.0.7
GetFirmBuildTime gets the firmware build time.
func (Conn) GetFirmVer ¶ added in v1.0.5
GetFirmVer gets the firmware version number.
func (*Conn) GetLoops ¶
GetLoops starts a stream of loop packets and sends them to the event channel. It exits when numLoops is hit, an archive record was written, or a command is pending.
func (Conn) SyncConsTime ¶
SyncConsTime synchronizes the console time with the local system time if the offset exceeds 10 seconds.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package calc implements weather calculations.
|
Package calc implements weather calculations. |
Package data implements encoding and decoding of Davis Instruments binary data types.
|
Package data implements encoding and decoding of Davis Instruments binary data types. |
internal
|
|
Package packet implements getters and setters for Davis Instruments packets.
|
Package packet implements getters and setters for Davis Instruments packets. |
Package units implements simple unit conversion functions.
|
Package units implements simple unit conversion functions. |