dorp

package module
v0.0.0-...-435f704 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2015 License: MIT Imports: 4 Imported by: 0

README

dorp

The K2CC Door Program

Dorp allows remote monitoring of K2CC station occupancy status by giving access to two pieces of information: whether the door is open or shut, and whether the lights are on or off.

Dorp consists of two programs:

  • A server, which displays current state on a web site and listens for status changes.
  • A client (called dorc), which pushes updates from the station to the server.

The client is intended to run on a Raspberry Pi, connected to a switch that monitors the door and a photosensor to monitor the lights.

The server is intended to run on a computer with a static IP address.

Further documentation on how each of the programs work is in each of their respective directories. Documenentation on the update protocol can be found in protocol.md.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongNumberOfStates = errors.New("incorrect state count")

ErrWrongNumberOfStates may be returned if a function takes a slice of states and got the wrong number. This probably will only occur deserializing network data.

Functions

func GenerateNonce

func GenerateNonce(rand io.Reader) ([24]byte, error)

GenerateNonce creats a 24 byte nonce from the source of randomness rand

func KeyToByteArray

func KeyToByteArray(key string) ([32]byte, error)

KeyToByteArray converts a key to the [32]bytes required by nacl.secretbox

func ProcessNonceMessage

func ProcessNonceMessage(message *[64]byte, key *[32]byte) (*[24]byte, error)

ProcessNonceMessage takes the message from the server and the shared key and returns the next nonce the server expects

Types

type SetMessage

type SetMessage struct {
	DoorState  string
	LightState string
}

A SetMessage is the Go representation of the JSON message sent to set states

type State

type State byte

A State is a binary condition of the door or lights.

const (
	Negative State = iota
	Positive
)

Positive and Negative are the two possible states

func (State) String

func (i State) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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