fix: renamed packages

This commit is contained in:
2018-11-21 20:48:10 +01:00
parent 6d9368e86c
commit 1672663944
15 changed files with 206 additions and 121 deletions

View File

@ -3,12 +3,26 @@ package sensor
import (
"os"
"path/filepath"
"git.cryptic.systems/fh-trier/go-flucky/pkg/types"
)
func sensorExists(wirePath, sensorID string) bool {
// Exists returns a boolean if the sensor exists
func Exists(wirePath, sensorID string) bool {
sensorPath := filepath.Join(wirePath, sensorID)
if _, err := os.Stat(sensorPath); os.IsNotExist(err) {
return false
}
return true
}
// IsRedundant returns a boolean if the sensorID is in the array
func IsRedundant(sensorID string, sensors []*types.WireSensor) bool {
for _, sensor := range sensors {
if sensor.ID == sensorID {
return true
}
}
return false
}