2019-06-13 19:25:32 +00:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/volker-raschek/flucky/pkg/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Start the daemon
|
2019-06-14 19:35:13 +00:00
|
|
|
func Start(cnf *config.Configuration) error {
|
2019-06-13 19:25:32 +00:00
|
|
|
|
2019-06-14 19:35:13 +00:00
|
|
|
// interrupt := make(chan os.Signal, 1)
|
|
|
|
// signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)
|
2019-06-13 19:25:32 +00:00
|
|
|
|
2019-06-14 19:35:13 +00:00
|
|
|
// humidityChannel := make(chan *types.Humidity)
|
|
|
|
// temperatureChannel := make(chan *types.Temperature)
|
2019-06-13 19:25:32 +00:00
|
|
|
|
2019-06-14 19:35:13 +00:00
|
|
|
// go sensor.ReadHumiditiesContinuously(humiditySensors, humidityChannel)
|
|
|
|
// go sensor.ReadTemperaturesContinuously(temperatureSensors, temperatureChannel)
|
2019-06-13 19:25:32 +00:00
|
|
|
|
2019-06-14 19:35:13 +00:00
|
|
|
// for {
|
|
|
|
// select {
|
|
|
|
// case killSignal := <-interrupt:
|
|
|
|
// return fmt.Errorf("Daemon was interruped by system signal %v", killSignal)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return nil
|
2019-06-13 19:25:32 +00:00
|
|
|
}
|