本文整理汇总了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))
}
示例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")
}
示例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")
}
示例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")
}
示例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")
}
示例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")
}
示例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")
}
示例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())
}
}
}
示例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")
}
示例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())
}
}
}
示例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())
}
}
}
示例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())
}
}
}
示例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())
}
}
}
示例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)
}
}
示例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)
}
}
}