コード例 #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 NewDefaultDatastream() *gossamer.DatastreamEntity {
	e := gossamer.NewDatastreamEntity()

	e.UnitOfMeasurement = "UOM"
	e.ObservationType = gossamer.DATASTREAM_OBSTYPE_OBSERVATION
	e.Description = "Description for Datastream"

	return e
	//		"unitOfMeasurement": {
	//			"symbol": "%",
	//			"name": "Percentage",
	//			"definition": "http://www.qudt.org/qudt/owl/1.0.0/unit/Instances.html"
	//		},
	//		"Thing": {"@iot.id": 5394817},
	//		"ObservedProperty": {"@iot.id": 5394816},
	//		"Sensor": {"@iot.id": 5394815}
}