コード例 #1
0
ファイル: run_client.go プロジェクト: zubairhamed/gossamer
func InsertDatastream(c gossamer.Client) {
	e := gossamer.NewDatastreamEntity()
	e.PhenomenonTime = gossamer.NewTimePeriod(time.Now(), time.Now())
	e.ResultTime = gossamer.NewTimePeriod(time.Now(), time.Now())
	e.Description = "XXX"
	e.ObservationType = gossamer.DATASTREAM_OBSTYPE_OBSERVATION
	e.UnitOfMeasurement = "XXX"

	thing := gossamer.NewThingEntity()
	thing.Id = "ABC123"
	e.Thing = thing

	sensor := gossamer.NewSensorEntity()
	sensor.Id = "DEF312"
	e.Sensor = sensor

	obsProp := gossamer.NewObservedPropertyEntity()
	obsProp.Id = "GHI987"
	e.ObservedProperty = obsProp

	err := c.InsertDatastream(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Datastream")
}
コード例 #2
0
func NewDefaultObservedProperty() *gossamer.ObservedPropertyEntity {
	e := gossamer.NewObservedPropertyEntity()
	e.Name = "Name Observed Property"
	e.Description = "Description for ObservedProperty"
	e.Definition = "Calibration date:  Jan 1, 2014"
	return e
}
コード例 #3
0
ファイル: run_client.go プロジェクト: zubairhamed/gossamer
func InsertObservedProperty(c gossamer.Client) {
	e := gossamer.NewObservedPropertyEntity()
	e.Name = "XXXX"
	e.Description = "XXXXXX"
	e.Definition = "XXXXX"

	err := c.InsertObservedProperty(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New ObservedProperty")
}