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

	for _, v := range ol {
		o, err := c.GetObservedProperty(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got Observed Property Entity ", o.GetId())
		}
	}
}
示例#2
0
func DeleteObservedProperties(c gossamer.Client) {
	ol, e := c.FindObservedProperties()
	if e != nil {
		log.Fatal(e)
	}

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