Documentation ¶
Index ¶
- Constants
- func ServeResponse(w http.ResponseWriter, r *http.Request, message string, status int)
- type Conditions
- type LuxResults
- type SLMeter
- func (m *SLMeter) Clear() http.HandlerFunc
- func (m *SLMeter) CurrentConditions() http.HandlerFunc
- func (m *SLMeter) MonitorAndRecordResults()
- func (m *SLMeter) ServeDashboard() http.HandlerFunc
- func (m *SLMeter) ServeResultsDB() http.HandlerFunc
- func (m *SLMeter) ServeResultsGraph() http.HandlerFunc
- func (m *SLMeter) ServeResultsTab() http.HandlerFunc
- func (m *SLMeter) ServeSensorStatus() http.HandlerFunc
- func (m *SLMeter) ServeSunlightControls() http.HandlerFunc
- func (m *SLMeter) SignalStrength() http.HandlerFunc
- func (m *SLMeter) Start() http.HandlerFunc
- func (m *SLMeter) Stop() http.HandlerFunc
Constants ¶
View Source
const ( MAX_JOB_DURATION = 8 * time.Hour RECORD_INTERVAL = 30 * time.Second DB_PATH = "sunlightmeter.db" )
Variables ¶
This section is empty.
Functions ¶
func ServeResponse ¶
Populate the response div with a message, or reply with a JSON message
Types ¶
type Conditions ¶
type Conditions struct { JobID string `json:"jobID"` Lux float64 `json:"lux"` FullSpectrum float64 `json:"fullSpectrum"` Visible float64 `json:"visible"` Infrared float64 `json:"infrared"` DateRange string `json:"dateRange"` RecordedHoursInRange float64 `json:"recordedHoursInRange"` FullSunlightInRange float64 `json:"fullSunlightInRange"` LightConditionInRange string `json:"lightConditionInRange"` AverageLuxInRange float64 `json:"averageLuxInRange"` }
type LuxResults ¶
type SLMeter ¶
type SLMeter struct { *tsl2591.TSL2591 LuxResultsChan chan LuxResults ResultsDB *sql.DB Pid int // contains filtered or unexported fields }
func (*SLMeter) CurrentConditions ¶
func (m *SLMeter) CurrentConditions() http.HandlerFunc
Serve data about the most recent entry saved to the db
func (*SLMeter) MonitorAndRecordResults ¶
func (m *SLMeter) MonitorAndRecordResults()
Read from LuxResultsChan, write the results to sqlite
func (*SLMeter) ServeDashboard ¶
func (m *SLMeter) ServeDashboard() http.HandlerFunc
Serve the homepage
func (*SLMeter) ServeResultsDB ¶
func (m *SLMeter) ServeResultsDB() http.HandlerFunc
Serve the sqlite db for download
func (*SLMeter) ServeResultsGraph ¶
func (m *SLMeter) ServeResultsGraph() http.HandlerFunc
Serve the results graph
func (*SLMeter) ServeResultsTab ¶
func (m *SLMeter) ServeResultsTab() http.HandlerFunc
Update the info in the results tab
func (*SLMeter) ServeSensorStatus ¶
func (m *SLMeter) ServeSensorStatus() http.HandlerFunc
Status of the sensor
func (*SLMeter) ServeSunlightControls ¶
func (m *SLMeter) ServeSunlightControls() http.HandlerFunc
Serve the controls for the sensor, start/stop/export/current-conditions/signal-strength
func (*SLMeter) SignalStrength ¶
func (m *SLMeter) SignalStrength() http.HandlerFunc
Check the signal strength of the wifi connection
func (*SLMeter) Start ¶
func (m *SLMeter) Start() http.HandlerFunc
Start the sensor, and collect data in a loop
func (*SLMeter) Stop ¶
func (m *SLMeter) Stop() http.HandlerFunc
Stop the sensor, and cancel the job context
Click to show internal directories.
Click to hide internal directories.