api

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// commands used by the protocol
	CmdDump = "dump"
	CmdGet  = "get"

	// station event actions
	ActionConnect    = "connect"
	ActionDisconnect = "disconnect"

	// message types
	TypeError           = "error"
	TypeStationEvent    = "station-event"
	TypeCmdGetResponse  = CmdGet + "-response"
	TypeCmdDumpResponse = CmdDump + "-response"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Message string `json:"message"`
	Error   string `json:"error"`
}

type Event

type Event struct {
	Action  string  `json:"action"`
	Station Station `json:"station"`
}

Event represents when a station connects or disconnects

type Message

type Message struct {
	Type string          `json:"type"`
	Data json.RawMessage `json:"data"`
}

Message is the generic wrapper for messages

func NewMessage

func NewMessage(msgType string, data interface{}) (Message, error)

type Station

type Station struct {
	Wifi wifi.StationInfo `json:"wifi"`
	IP   net.IP           `json:"ip"`
}

Station is a wifi station info and IP address

func NewStation

func NewStation(station *wifi.StationInfo) Station

NewStation returns a station given the station info

func NewStations

func NewStations(stations []*wifi.StationInfo) []Station

NewStations returns stations given the station infos

Jump to

Keyboard shortcuts

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