Exemple #1
0
func FindSensors(c gossamer.Client) {
	ol, e := c.FindSensors()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetSensor(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got Sensor Entity ", o.GetId())
		}
	}
}
Exemple #2
0
func DeleteSensors(c gossamer.Client) {
	ol, e := c.FindSensors()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetSensor(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			// Delete Observation
			e := c.DeleteSensor(o.GetId())
			if e != nil {
				log.Fatal(err)
			} else {
				log.Println("Deleted Sensor ", o.GetId())
			}
		}
	}
}