core

package module
v0.0.0-...-4d8d9dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2019 License: MIT Imports: 5 Imported by: 25

README

core

Repository for GOST core entities

Documentation

Index

Constants

View Source
const (
	// ISO8601 defines the ISO8601 date time format
	ISO8601 = "2006-01-02T15:04:05.999Z07:00"
)

Variables

View Source
var (
	EncodingUnknown  = EncodingType{0, "unknown"}
	EncodingGeoJSON  = EncodingType{1, "application/vnd.geo+json"}
	EncodingPDF      = EncodingType{2, "application/pdf"}
	EncodingSensorML = EncodingType{3, "http://www.opengis.net/doc/IS/SensorML/2.0"}
)

List of supported EncodingTypes, do not change!!

View Source
var (
	OMCategoryUnknown     = ObservationType{0, ""}
	OMCategoryObservation = ObservationType{1, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CategoryObservation"} // IRI
	OMCountObservation    = ObservationType{2, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_CountObservation"}    // integer
	OMMeasurement         = ObservationType{3, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"}         // double
	OMObservation         = ObservationType{4, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Observation"}         // any
	OMTruthObservation    = ObservationType{5, "http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_TruthObservation"}    // boolean
)

List of supported ObservationTypes

EncodingValues is a list of names mapped to their EncodingValue

EntityTypeList is a list for all known entity types

ObservationTypes is a list of names mapped to their ObservationType Value

View Source
var StringEntityMap = map[string]EntityType{
	"thing": EntityTypeThing, "things": EntityTypeThing,
	"location": EntityTypeLocation, "locations": EntityTypeLocation,
	"historicallocation": EntityTypeHistoricalLocation, "historicallocations": EntityTypeHistoricalLocation,
	"datastream": EntityTypeDatastream, "datastreams": EntityTypeDatastream,
	"sensor": EntityTypeSensor, "sensors": EntityTypeSensor,
	"observedproperty": EntityTypeObservedProperty, "observedproperties": EntityTypeObservedProperty,
	"observation": EntityTypeObservation, "observations": EntityTypeObservation,
	"featureofinterest": EntityTypeFeatureOfInterest, "featuresofinterest": EntityTypeFeatureOfInterest,
}

StringEntityMap is a map of strings that map a string to an EntityType

Functions

func CheckEncodingSupported

func CheckEncodingSupported(encodingType string) (bool, error)

CheckEncodingSupported returns true of the Location entity supports the given encoding type

func CheckMandatoryParam

func CheckMandatoryParam(errorList *[]error, param interface{}, entityType EntityType, paramName string)

CheckMandatoryParam checks if the given parameter is nil, if true then an ApiError will be added to the given list of errors.

func CreateEntityLink(isNil bool, externalURI string, entityType1 string, entityType2 string, id interface{}) string

CreateEntityLink formats the given parameters into a relative navigationlink path for example: http://example.org/OGCSensorThings/v1.0/Things(27815)/Datastreams

func CreateEntitySelfLink(externalURI string, entityLink string, id interface{}) string

CreateEntitySelfLink formats the given parameters into an external navigationlink to the entity for example: http://example.org/OGCSensorThings/v1.0/Things(27815)

func GetSupportedEncodings

func GetSupportedEncodings() string

GetSupportedEncodings returns a list of supported encodings

Types

type ArrayResponse

type ArrayResponse struct {
	Count    int          `json:"@iot.count,omitempty"`
	NextLink string       `json:"@iot.nextLink,omitempty"`
	Data     *interface{} `json:"value"`
}

ArrayResponse is the default response format for sending content back used by the server

type ArrayResponseDatastreams

type ArrayResponseDatastreams struct {
	ArrayResponse
	Data []*Datastream `json:"value"`
}

ArrayResponseDatastreams can be used to parse an array response containing datastreams

type ArrayResponseEndpoint

type ArrayResponseEndpoint struct {
	ArrayResponse
	Data []*Endpoint `json:"value"`
}

ArrayResponseEndpoint can be used to parse an array response containing endpoint information

type ArrayResponseFeaturesOfInterest

type ArrayResponseFeaturesOfInterest struct {
	ArrayResponse
	Data []*FeatureOfInterest `json:"value"`
}

ArrayResponseFeaturesOfInterest can be used to parse an array response containing features of interest

type ArrayResponseHistoricalLocations

type ArrayResponseHistoricalLocations struct {
	ArrayResponse
	Data []*HistoricalLocation `json:"value"`
}

ArrayResponseHistoricalLocations can be used to parse an array response containing historical locations

type ArrayResponseLocations

type ArrayResponseLocations struct {
	ArrayResponse
	Data []*Location `json:"value"`
}

ArrayResponseLocations can be used to parse an array response containing locations

type ArrayResponseObservations

type ArrayResponseObservations struct {
	ArrayResponse
	Data []*Observation `json:"value"`
}

ArrayResponseObservations can be used to parse an array response containing observations

type ArrayResponseObservedProperty

type ArrayResponseObservedProperty struct {
	ArrayResponse
	Data []*ObservedProperty `json:"value"`
}

ArrayResponseObservedProperty can be used to parse an array response containing observed properties

type ArrayResponseSensors

type ArrayResponseSensors struct {
	ArrayResponse
	Data []*Sensor `json:"value"`
}

ArrayResponseSensors can be used to parse an array response containing sensors

type ArrayResponseThings

type ArrayResponseThings struct {
	ArrayResponse
	Data []*Thing `json:"value"`
}

ArrayResponseThings can be used to parse an array response containing things

type BaseEntity

type BaseEntity struct {
	ID      interface{} `json:"@iot.id,omitempty"`
	NavSelf string      `json:"@iot.selfLink,omitempty"`
}

BaseEntity is the entry point for an entity

func (BaseEntity) ClearNav

func (b BaseEntity) ClearNav()

func (*BaseEntity) ContainsMandatoryParams

func (b *BaseEntity) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams defined to implement Entity

func (*BaseEntity) GetEntityType

func (b *BaseEntity) GetEntityType() EntityType

GetEntityType defined to implement Entity

func (*BaseEntity) GetID

func (b *BaseEntity) GetID() interface{}

GetID return the ID of the entity

func (*BaseEntity) GetPropertyNames

func (b *BaseEntity) GetPropertyNames() []string

GetPropertyNames returns the available properties of an entity

func (b *BaseEntity) GetSelfLink() string

GetSelfLink returns the self link of the entity

func (*BaseEntity) GetSupportedEncoding

func (b *BaseEntity) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding defined to implement Entity

func (*BaseEntity) ParseEntity

func (b *BaseEntity) ParseEntity(data []byte) error

ParseEntity defined to implement Entity

func (*BaseEntity) SetID

func (b *BaseEntity) SetID(newID interface{})

SetID sets a newID on the entity

func (b *BaseEntity) SetLinks(externalURL string) error

SetLinks defined to implement Entity

type CreateObservations

type CreateObservations struct {
	BaseEntity
	Datastreams []*Datastream `json:"Observations,omitempty"`
}

CreateObservations is used to POST multiple observations at once

func (*CreateObservations) ContainsMandatoryParams

func (c *CreateObservations) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for a Datastream are available before posting

func (CreateObservations) GetEntityType

func (c CreateObservations) GetEntityType() EntityType

GetEntityType returns the EntityType for Datastream

func (*CreateObservations) ParseEntity

func (c *CreateObservations) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (c *CreateObservations) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (c *CreateObservations) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (c *CreateObservations) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type Datastream

type Datastream struct {
	BaseEntity
	Name                string                 `json:"name,omitempty"`
	Description         string                 `json:"description,omitempty"`
	UnitOfMeasurement   map[string]interface{} `json:"unitOfMeasurement,omitempty"`
	ObservationType     string                 `json:"observationType,omitempty"`
	ObservedArea        map[string]interface{} `json:"observedArea,omitempty"`
	NavThing            string                 `json:"Thing@iot.navigationLink,omitempty"`
	NavSensor           string                 `json:"Sensor@iot.navigationLink,omitempty"`
	NavObservations     string                 `json:"Observations@iot.navigationLink,omitempty"`
	NavObservedProperty string                 `json:"ObservedProperty@iot.navigationLink,omitempty"`
	Thing               *Thing                 `json:"Thing,omitempty"`
	Sensor              *Sensor                `json:"Sensor,omitempty"`
	Observations        []*Observation         `json:"Observations,omitempty"`
	ObservedProperty    *ObservedProperty      `json:"ObservedProperty,omitempty"`
	PhenomenonTime      string                 `json:"phenomenonTime,omitempty"`
	ResultTime          string                 `json:"resultTime,omitempty"`
}

Datastream in SensorThings represents a collection of Observations from a Sensor. A physical Sensor will send its data (Observations) to a single Datastream. A Datastream can have only one Sensor and that Sensor can only sense one ObservedProperty.

func (*Datastream) ClearNav

func (d *Datastream) ClearNav()

func (*Datastream) ContainsMandatoryParams

func (d *Datastream) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for a Datastream are available before posting

func (Datastream) GetEntityType

func (d Datastream) GetEntityType() EntityType

GetEntityType returns the EntityType for Datastream

func (*Datastream) GetPropertyNames

func (d *Datastream) GetPropertyNames() []string

GetPropertyNames returns the available properties for a Datastream

func (Datastream) GetSupportedEncoding

func (d Datastream) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding returns the supported encoding tye for this entity

func (*Datastream) ParseEntity

func (d *Datastream) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (d *Datastream) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (d *Datastream) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (d *Datastream) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type EncodingType

type EncodingType struct {
	Code  int
	Value string
}

EncodingType holds the information on a EncodingType

func CreateEncodingType

func CreateEncodingType(encoding string) (EncodingType, error)

CreateEncodingType returns the int representation for a given encoding, returns an error when encoding is not supported

type Endpoint

type Endpoint struct {
	Name string `json:"name,omitempty"`
	Url  string `json:"url,omitempty"`
}

Endpoint describes the name and url of an SensorThings endpoint an array of endpoints is returned by the server by requesting the base path host/v1.0

type Entity

type Entity interface {
	ClearNav()
	ParseEntity(data []byte) error
	ContainsMandatoryParams() (bool, []error)
	GetID() interface{}
	SetID(newID interface{})
	SetAllLinks(externalURL string)
	SetSelfLink(externalURL string)
	SetLinks(externalURL string)
	GetSelfLink() string
	GetEntityType() EntityType
	GetPropertyNames() []string
	GetSupportedEncoding() map[int]EncodingType
}

Entity is the base interface for all SensorThings entities.

func EntityFromString

func EntityFromString(e string) (Entity, error)

EntityFromString returns an empty entity based on a string, returns error if string cannot be mapped to an entity

func EntityFromType

func EntityFromType(e EntityType) Entity

EntityFromType returns an empty entity belonging to the type returns nil if type cannot be mapped to an entity

type EntityLink string

EntityLink holds the name and type of a SensorThings entity link.

const (
	EntityLinkThings              EntityLink = "Things"
	EntityLinkLocations           EntityLink = "Locations"
	EntityLinkHistoricalLocations EntityLink = "HistoricalLocations"
	EntityLinkDatastreams         EntityLink = "Datastreams"
	EntityLinkSensors             EntityLink = "Sensors"
	EntityLinkObservedProperties  EntityLink = "ObservedProperties"
	EntityLinkObservations        EntityLink = "Observations"
	EntityLinkFeatureOfInterests  EntityLink = "FeaturesOfInterest"
	EntityLinkCreateObservations  EntityLink = "CreateObservations"
)

List of all EntityLinks.

func (EntityLink) ToString

func (e EntityLink) ToString() string

ToString return the string representation of the EntityLink.

type EntityType

type EntityType string

EntityType holds the name and type of a SensorThings entity.

const (
	EntityTypeVersion                      EntityType = "Version"
	EntityTypeThing                        EntityType = "Thing"
	EntityTypeLocation                     EntityType = "Location"
	EntityTypeHistoricalLocation           EntityType = "HistoricalLocation"
	EntityTypeDatastream                   EntityType = "Datastream"
	EntityTypeSensor                       EntityType = "Sensor"
	EntityTypeObservedProperty             EntityType = "ObservedProperty"
	EntityTypeObservation                  EntityType = "Observation"
	EntityTypeFeatureOfInterest            EntityType = "FeatureOfInterest"
	EntityTypeThingToLocation              EntityType = "ThingToLocation"
	EntityTypeLocationToHistoricalLocation EntityType = "LocationToHistoricalLocation"
	EntityTypeCreateObservations           EntityType = "CreateObservations"
	EntityTypeUnknown                      EntityType = "Unknown"
)

List of all EntityTypes.

func EntityTypeFromString

func EntityTypeFromString(e string) (EntityType, error)

EntityTypeFromString returns the EntityType for a given string function is case-insensitive

func (EntityType) GetArrayEndpoint

func (e EntityType) GetArrayEndpoint() string

GetArrayEndpoint returns the (array) endpoint name for the current EntityType

func (EntityType) GetEndpoint

func (e EntityType) GetEndpoint() string

GetEndpoint returns the single entity endpoint name

func (EntityType) ToString

func (e EntityType) ToString() string

ToString return the string representation of the EntityType.

type FeatureOfInterest

type FeatureOfInterest struct {
	BaseEntity
	Name               string                 `json:"name,omitempty"`
	Description        string                 `json:"description,omitempty"`
	EncodingType       string                 `json:"encodingType,omitempty"`
	Feature            map[string]interface{} `json:"feature,omitempty"`
	NavObservations    string                 `json:"Observations@iot.navigationLink,omitempty"`
	Observations       []*Observation         `json:"Observations,omitempty"`
	OriginalLocationID interface{}            `json:"-"`
}

FeatureOfInterest in SensorThings represents the phenomena an Observation is detecting. In some cases a FeatureOfInterest can be the Location of the Sensor and therefore of the Observation. A FeatureOfInterest is linked to a single Observation

func (*FeatureOfInterest) ClearNav

func (f *FeatureOfInterest) ClearNav()

func (*FeatureOfInterest) ContainsMandatoryParams

func (f *FeatureOfInterest) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for a FeatureOfInterest are available before posting

func (FeatureOfInterest) GetEntityType

func (f FeatureOfInterest) GetEntityType() EntityType

GetEntityType returns the EntityType for FeatureOfInterest

func (*FeatureOfInterest) GetPropertyNames

func (f *FeatureOfInterest) GetPropertyNames() []string

GetPropertyNames returns the available properties for a FeatureOfInterest

func (*FeatureOfInterest) ParseEntity

func (f *FeatureOfInterest) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (f *FeatureOfInterest) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (f *FeatureOfInterest) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (f *FeatureOfInterest) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type HistoricalLocation

type HistoricalLocation struct {
	BaseEntity
	Time         string      `json:"time,omitempty"`
	NavThing     string      `json:"Thing@iot.navigationLink,omitempty"`
	NavLocations string      `json:"Locations@iot.navigationLink,omitempty"`
	Thing        *Thing      `json:"Thing,omitempty"`
	Locations    []*Location `json:"Locations,omitempty"`
}

HistoricalLocation in sensorthings represents the current and previous locations of a thing including time

func (*HistoricalLocation) ClearNav

func (h *HistoricalLocation) ClearNav()

func (*HistoricalLocation) ContainsMandatoryParams

func (h *HistoricalLocation) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for a HistoricalLocation are available before posting

func (HistoricalLocation) GetEntityType

func (h HistoricalLocation) GetEntityType() EntityType

GetEntityType returns the EntityType for HistoricalLocation

func (*HistoricalLocation) GetPropertyNames

func (h *HistoricalLocation) GetPropertyNames() []string

GetPropertyNames returns the available properties for a HistoricalLocation

func (HistoricalLocation) GetSupportedEncoding

func (h HistoricalLocation) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding returns the supported encoding tye for this entity

func (*HistoricalLocation) ParseEntity

func (h *HistoricalLocation) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (h *HistoricalLocation) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (h *HistoricalLocation) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (h *HistoricalLocation) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type Location

type Location struct {
	BaseEntity
	Name                   string                 `json:"name,omitempty"`
	Description            string                 `json:"description,omitempty"`
	EncodingType           string                 `json:"encodingType,omitempty"`
	Location               map[string]interface{} `json:"location,omitempty"`
	NavThings              string                 `json:"Things@iot.navigationLink,omitempty"`
	NavHistoricalLocations string                 `json:"HistoricalLocations@iot.navigationLink,omitempty"`
	Things                 []*Thing               `json:"Things,omitempty"`
	HistoricalLocations    []*HistoricalLocation  `json:"HistoricalLocations,omitempty"`
}

Location entity locates the Thing or the Things it associated with. A Thing’s Location entity is defined as the last known location of the Thing. A Thing’s Location may be identical to the Thing’s Observations’ FeatureOfInterest. In the context of the IoT, the principle location of interest is usually associated with the location of the Thing, especially for in-situ sensing applications. For example, the location of interest of a wifi-connected thermostat should be the building or the room in which the smart thermostat is located. And the FeatureOfInterest of the Observations made by the thermostat (e.g., room temperature readings) should also be the building or the room. In this case, the content of the smart thermostat’s location should be the same as the content of the temperature readings’ feature of interest.

func (*Location) ClearNav

func (l *Location) ClearNav()

func (*Location) ContainsMandatoryParams

func (l *Location) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for Location are available before posting.

func (Location) GetEntityType

func (l Location) GetEntityType() EntityType

GetEntityType returns the EntityType for Location

func (*Location) GetPropertyNames

func (l *Location) GetPropertyNames() []string

GetPropertyNames returns the available properties for a Location

func (*Location) ParseEntity

func (l *Location) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (l *Location) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (l *Location) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (l *Location) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type Observation

type Observation struct {
	BaseEntity
	PhenomenonTime       string                 `json:"phenomenonTime,omitempty"`
	Result               json.RawMessage        `json:"result,omitempty"`
	ResultTime           *string                `json:"resultTime,omitempty"`
	ResultQuality        string                 `json:"resultQuality,omitempty"`
	ValidTime            string                 `json:"validTime,omitempty"`
	Parameters           map[string]interface{} `json:"parameters,omitempty"`
	NavDatastream        string                 `json:"Datastream@iot.navigationLink,omitempty"`
	NavFeatureOfInterest string                 `json:"FeatureOfInterest@iot.navigationLink,omitempty"`
	Datastream           *Datastream            `json:"Datastream,omitempty"`
	FeatureOfInterest    *FeatureOfInterest     `json:"FeatureOfInterest,omitempty"`
}

Observation in SensorThings represents a single Sensor reading of an ObservedProperty. A physical device, a Sensor, sends Observations to a specified Datastream. An Observation requires a FeatureOfInterest entity, if none is provided in the request, the Location of the Thing associated with the Datastream, will be assigned to the new Observation as the FeaturOfInterest.

func (*Observation) ClearNav

func (o *Observation) ClearNav()

func (*Observation) ContainsMandatoryParams

func (o *Observation) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for Observation are available before posting.

func (Observation) GetEntityType

func (o Observation) GetEntityType() EntityType

GetEntityType returns the EntityType for Observation

func (*Observation) GetPropertyNames

func (o *Observation) GetPropertyNames() []string

GetPropertyNames returns the available properties for an Observation

func (Observation) GetSupportedEncoding

func (o Observation) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding returns the supported encoding tye for this entity

func (*Observation) MarshalJSON

func (o *Observation) MarshalJSON() ([]byte, error)

MarshalJSON marshalls the observation into a JSON byte array

func (Observation) MarshalPostgresJSON

func (o Observation) MarshalPostgresJSON() ([]byte, error)

MarshalPostgresJSON marshalls an observation entity for saving into PostgreSQL

func (*Observation) ParseEntity

func (o *Observation) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (o *Observation) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (o *Observation) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (o *Observation) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type ObservationType

type ObservationType struct {
	Code  int64
	Value string
}

ObservationType holds the information on a ObservationType

func GetObservationTypeByID

func GetObservationTypeByID(observationType int64) (ObservationType, error)

GetObservationTypeByID Get the observationType based on value, returns error

func GetObservationTypeByValue

func GetObservationTypeByValue(observationType string) (ObservationType, error)

GetObservationTypeByValue Get the observationType based on value, returns error

type ObservedProperty

type ObservedProperty struct {
	BaseEntity
	Name           string        `json:"name,omitempty"`
	Description    string        `json:"description,omitempty"`
	Definition     string        `json:"definition,omitempty"`
	NavDatastreams string        `json:"Datastreams@iot.navigationLink,omitempty"`
	Datastreams    []*Datastream `json:"Datastreams,omitempty"`
}

ObservedProperty in SensorThings represents the physical phenomenon being observed by the Sensor. An ObserveProperty is linked to a Datastream which can only have one ObserveProperty

func (*ObservedProperty) ClearNav

func (o *ObservedProperty) ClearNav()

func (*ObservedProperty) ContainsMandatoryParams

func (o *ObservedProperty) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for ObservedProperty are available before posting.

func (ObservedProperty) GetEntityType

func (o ObservedProperty) GetEntityType() EntityType

GetEntityType returns the EntityType for ObservedProperty

func (*ObservedProperty) GetPropertyNames

func (o *ObservedProperty) GetPropertyNames() []string

GetPropertyNames returns the available properties for a ObservedProperty

func (ObservedProperty) GetSupportedEncoding

func (o ObservedProperty) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding returns the supported encoding tye for this entity

func (*ObservedProperty) ParseEntity

func (o *ObservedProperty) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (o *ObservedProperty) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (o *ObservedProperty) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (o *ObservedProperty) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type RawCreateObservations

type RawCreateObservations struct {
	Datastream *Datastream         `json:"Datastream,omitempty"`
	Components []string            `json:"components,omitempty"`
	Count      int64               `json:"dataArray@iot.count,omitempty"`
	Data       [][]json.RawMessage `json:"dataArray,omitempty"`
}

RawCreateObservations is used to POST multiple observations at once

type Sensor

type Sensor struct {
	BaseEntity
	Name           string        `json:"name,omitempty"`
	Description    string        `json:"description,omitempty"`
	EncodingType   string        `json:"encodingType,omitempty"`
	Metadata       string        `json:"metadata,omitempty"`
	NavDatastreams string        `json:"Datastreams@iot.navigationLink,omitempty"`
	Datastreams    []*Datastream `json:"Datastreams,omitempty"`
}

Sensor in SensorThings represents the physical device capable of observing a physical property and converting it to an electrical impulse and be converted to a empirical value to represent a measurement value of the physical property

func (*Sensor) ClearNav

func (s *Sensor) ClearNav()

func (*Sensor) ContainsMandatoryParams

func (s *Sensor) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for Sensor are available before posting.

func (Sensor) GetEntityType

func (s Sensor) GetEntityType() EntityType

GetEntityType returns the EntityType for Sensor

func (*Sensor) GetPropertyNames

func (s *Sensor) GetPropertyNames() []string

GetPropertyNames returns the available properties for a Sensor

func (*Sensor) ParseEntity

func (s *Sensor) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (s *Sensor) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (s *Sensor) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (s *Sensor) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

type Thing

type Thing struct {
	BaseEntity
	Name                   string                 `json:"name,omitempty"`
	Description            string                 `json:"description,omitempty"`
	Properties             map[string]interface{} `json:"properties,omitempty"`
	NavLocations           string                 `json:"Locations@iot.navigationLink,omitempty"`
	NavDatastreams         string                 `json:"Datastreams@iot.navigationLink,omitempty"`
	NavHistoricalLocations string                 `json:"HistoricalLocations@iot.navigationLink,omitempty"`
	Locations              []*Location            `json:"Locations,omitempty"`
	Datastreams            []*Datastream          `json:"Datastreams,omitempty"`
	HistoricalLocations    []*HistoricalLocation  `json:"HistoricalLocations,omitempty"`
}

Thing in SensorThings represents a physical object in the real world. A Thing is a good starting point in which to start creating the SensorThings model structure. A Thing has a Location and one or more Datastreams to collect Observations. A minimal Thing can be created without a Location and Datastream and there are options to create a Things with a nested linked Location and Datastream.

func (*Thing) ClearNav

func (t *Thing) ClearNav()

func (*Thing) ContainsMandatoryParams

func (t *Thing) ContainsMandatoryParams() (bool, []error)

ContainsMandatoryParams checks if all mandatory params for Thing are available before posting.

func (Thing) GetEntityType

func (t Thing) GetEntityType() EntityType

GetEntityType returns the EntityType for Thing

func (*Thing) GetPropertyNames

func (t *Thing) GetPropertyNames() []string

GetPropertyNames returns the available properties for a Thing

func (Thing) GetSupportedEncoding

func (t Thing) GetSupportedEncoding() map[int]EncodingType

GetSupportedEncoding returns the supported encoding tye for this entity

func (*Thing) ParseEntity

func (t *Thing) ParseEntity(data []byte) error

ParseEntity tries to parse the given json byte array into the current entity

func (t *Thing) SetAllLinks(externalURL string)

SetAllLinks sets the self link and relational links

func (t *Thing) SetLinks(externalURL string)

SetLinks sets the entity specific navigation links, empty string if linked(expanded) data is not nil

func (t *Thing) SetSelfLink(externalURL string)

SetSelfLink sets the self link for the entity

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL