30 lines
743 B
Go
30 lines
743 B
Go
package sensors
|
|
|
|
import "time"
|
|
|
|
type SType string
|
|
|
|
const (
|
|
Temperature SType = "temperature"
|
|
Humidity SType = "humidity"
|
|
CarbonDioxide SType = "carbon_dioxide"
|
|
Pressure SType = "pressure"
|
|
Proximity SType = "proximity"
|
|
Light SType = "light"
|
|
// and more...
|
|
)
|
|
|
|
type Sensor struct {
|
|
SensorID string `json:"sensor_id"`
|
|
SensorType SType `json:"sensor_type"`
|
|
SamplingInterval time.Duration `json:"sampling"`
|
|
ThresholdAbove float64 `json:"thresoldabove"`
|
|
ThresholdBelow float64 `json:"thresoldbelow"`
|
|
SensorData *[]SensorData `json:"sensor_data,omitempty"`
|
|
}
|
|
|
|
type SensorData struct {
|
|
Value float64 `json:"value"`
|
|
Timestamp time.Time `json:"timestamp"`
|
|
}
|