Documentation ¶
Overview ¶
Package pimonitor watches your pi and serves piface controls to localhost.
Package pimonitor watches your pi and serves piface controls to localhost.
Index ¶
- Variables
- func CrawlLeds(pi *pimon.PiFace)
- func HandleInputPortValue(w http.ResponseWriter, r *http.Request)
- func HandleInputValue(w http.ResponseWriter, r *http.Request)
- func HandleOutputOff(w http.ResponseWriter, r *http.Request)
- func HandleOutputOn(w http.ResponseWriter, r *http.Request)
- func HandleOutputPortSetValue(w http.ResponseWriter, r *http.Request)
- func HandlePingmon(w http.ResponseWriter, r *http.Request)
- func HandleRelayClick(w http.ResponseWriter, r *http.Request)
- func HandleRelayOff(w http.ResponseWriter, r *http.Request)
- func HandleRelayOn(w http.ResponseWriter, r *http.Request)
- func HandleRelayToggle(w http.ResponseWriter, r *http.Request)
- func Pingmon(target string)
- func SwitchMonitor(pi *pimon.PiFace)
- func WriteJSON(w http.ResponseWriter, d interface{}) error
- type BoolValueResponse
- type BootTrace
- type ByteValueResponse
- type PiServer
- type StringValueResponse
Constants ¶
This section is empty.
Variables ¶
var ListenAddress = "[::1]:5050"
ListenAddress says where we listen
var PingmonFails = 5
PingmonFails tunable if you enable the piserver
var PingmonFound = 0
PingmonFound counts stats
var PingmonFrequency = 5 * time.Second
PingmonFrequency tunable if you enable the piserver
var PingmonReboot = false
PingmonReboot tunable if you enable the piserver
var PingmonTargets = []struct { network string address string }{ {"tcp", "192.168.10.1:80"}, {"tcp", "192.168.10.1:443"}, {"tcp", "192.168.10.1:53"}, {"tcp6", "[2606:a000:4c84:82f0::1]:80"}, {"tcp6", "[2606:a000:4c84:82f0::1]:443"}, {"tcp6", "[2606:a000:4c84:82f0::1]:53"}, }
Functions ¶
func CrawlLeds ¶
CrawlLeds gives a visual running light indicator using the last 4 LEDS note: the first 4 outputs may affect the relays on the piface and so are not used
func HandleInputPortValue ¶
func HandleInputPortValue(w http.ResponseWriter, r *http.Request)
HandleInputPortValue returns a byte of the 8 input pin states
func HandleInputValue ¶
func HandleInputValue(w http.ResponseWriter, r *http.Request)
HandleInputValue returns the value of the specified input
func HandleOutputOff ¶
func HandleOutputOff(w http.ResponseWriter, r *http.Request)
HandleOutputOff does what it says on the tin
func HandleOutputOn ¶
func HandleOutputOn(w http.ResponseWriter, r *http.Request)
HandleOutputOn does what it says on the tin
func HandleOutputPortSetValue ¶
func HandleOutputPortSetValue(w http.ResponseWriter, r *http.Request)
HandleOutputPortSetValue does what it says on the tin
func HandlePingmon ¶
func HandlePingmon(w http.ResponseWriter, r *http.Request)
HandlePingmon enables disables or reports on the rebooter
func HandleRelayClick ¶
func HandleRelayClick(w http.ResponseWriter, r *http.Request)
HandleRelayClick does what it says on the tin
func HandleRelayOff ¶
func HandleRelayOff(w http.ResponseWriter, r *http.Request)
HandleRelayOff does what it says on the tin
func HandleRelayOn ¶
func HandleRelayOn(w http.ResponseWriter, r *http.Request)
HandleRelayOn does what it says on the tin
func HandleRelayToggle ¶
func HandleRelayToggle(w http.ResponseWriter, r *http.Request)
HandleRelayToggle does what it says on the tin
func Pingmon ¶
func Pingmon(target string)
Pingmon watches for the network gateway (or whatevr target gets put there) and restarts the pi if it's not found several times in a row. Should try for almost a minute before it reboots, and should not reboot if one try gets thru.
func SwitchMonitor ¶
SwitchMonitor watches the piface switches and does functions Switch 0 - click relay 0 Switch 1 - click relay 1 Switch 2 - flash the lights Switch 3 - reboot Switch 2+3 - shutdown
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, d interface{}) error
WriteJSON puts a JSON structure to the writer and sets application/json
Types ¶
type BoolValueResponse ¶
BoolValueResponse returns a boolean value and error indicator
type ByteValueResponse ¶
ByteValueResponse returns a boolean value and error indicator
type PiServer ¶
PiServer is our server struct for hanging methods
func (*PiServer) ListenAndServe ¶
ListenAndServe makes PiServer a http.Handler
type StringValueResponse ¶
type StringValueResponse struct { Value string `json:"value"` Error string `json:"error,omitempty"` }
StringValueResponse is for string answers
Directories ¶
Path | Synopsis |
---|---|
Package main collects the program CLI components including the main entrypoint
|
Package main collects the program CLI components including the main entrypoint |
piface
Package piface is for interfacing with a PiFace Digital IO board.
|
Package piface is for interfacing with a PiFace Digital IO board. |