当前位置: 首页>>代码示例>>Golang>>正文


Golang gossamer.Client类代码示例

本文整理汇总了Golang中github.com/zubairhamed/gossamer.Client的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: QueryObservations

func QueryObservations(c gossamer.Client) {
	o, err := c.QueryObservations().All()
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Query all Observations returned records # ", len(o))
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:7,代码来源:run_client.go

示例2: InsertDatastream

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")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:26,代码来源:run_client.go

示例3: InsertThing

func InsertThing(c gossamer.Client) {
	e := gossamer.NewThingEntity()
	e.Description = "XXXXX"

	err := c.InsertThing(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Thing")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:10,代码来源:run_client.go

示例4: InsertSensor

func InsertSensor(c gossamer.Client) {
	e := gossamer.NewSensorEntity()
	e.Description = "XXXXXX"
	e.EncodingType = gossamer.SENSOR_ENCTYPE_SENSORML
	e.Metadata = "XXXXX"

	err := c.InsertSensor(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Sensor")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:12,代码来源:run_client.go

示例5: InsertObservedProperty

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")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:12,代码来源:run_client.go

示例6: InsertFeaturesOfInterest

func InsertFeaturesOfInterest(c gossamer.Client) {
	e := gossamer.NewFeatureOfInterestEntity()
	e.Description = "XXXX"
	e.EncodingType = gossamer.LOCATION_ENCTYPE_GEOJSON
	e.Feature = "Feature ABC 1 2 3"

	err := c.InsertFeaturesOfInterest(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Feature of Interest")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:12,代码来源:run_client.go

示例7: InsertLocation

func InsertLocation(c gossamer.Client) {
	e := gossamer.NewLocationEntity()
	e.Description = "XXXXX"
	e.EncodingType = gossamer.LOCATION_ENCTYPE_GEOJSON
	e.Location = "XOXOXO"

	err := c.InsertLocation(e)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Location")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:12,代码来源:run_client.go

示例8: FindSensors

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())
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例9: InsertObservation

func InsertObservation(c gossamer.Client) {
	obs := &gossamer.ObservationEntity{}
	obs.PhenomenonTime = gossamer.NewTimePeriod(time.Now(), time.Now())
	obs.Result = "123"
	obs.ResultTime = gossamer.NewTimeInstant(time.Now())
	ds := &gossamer.DatastreamEntity{}
	ds.Id = "Datastream-1"
	obs.Datastream = ds

	err := c.InsertObservation(obs)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("Inserted New Observation")
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例10: FindDatastreams

func FindDatastreams(c gossamer.Client) {
	ol, e := c.FindDatastreams()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetDatastream(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got Datastream Entity ", o.GetId())
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例11: FindObservedProperties

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())
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例12: FindLocations

func FindLocations(c gossamer.Client) {
	ol, e := c.FindLocations()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetLocation(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got Location Entity ", o.GetId())
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例13: FindFeaturesOfInterest

func FindFeaturesOfInterest(c gossamer.Client) {
	ol, e := c.FindFeaturesOfInterest()
	if e != nil {
		log.Fatal(e)
	}

	for _, v := range ol {
		o, err := c.GetFeaturesOfInterest(v.GetId())
		if err != nil {
			log.Fatal(err)
		} else {
			log.Println("Got FeaturesofInterest Entity ", o.GetId())
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:15,代码来源:run_client.go

示例14: PatchObservations

func PatchObservations(c gossamer.Client) {
	l, err := c.QueryObservations().Top(1).All()
	if err != nil {
		log.Fatal(err)
	}

	var o gossamer.Observation
	if len(l) > 0 {
		o = l[0].(gossamer.Observation)

		n := gossamer.CloneObservationEntity(o)
		n.ResultQuality = "Value was changed"
		n.ResultTime = gossamer.NewTimeInstant(time.Now())

		c.PatchObservation(n)
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:17,代码来源:run_client.go

示例15: UpdateSensors

func UpdateSensors(c gossamer.Client) {
	l, err := c.QuerySensors().Top(1).All()
	if err != nil {
		log.Fatal(err)
	}

	var o gossamer.Sensor
	if len(l) > 0 {
		o = l[0].(gossamer.Sensor)

		n := gossamer.CloneSensorEntity(o)
		n.Description = "Updated description"

		err = c.UpdateSensor(n)
		if err != nil {
			log.Fatal(err)
		}
	}
}
开发者ID:zubairhamed,项目名称:gossamer,代码行数:19,代码来源:run_client.go


注:本文中的github.com/zubairhamed/gossamer.Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。