gongsiutil

package
v0.0.0-...-8dae094 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_IMAGE = iota
	TYPE_BATTERY
	TYPE_TEMPERATURE
	TYPE_DISTANCE
)

Defined NGSI variable types that can be received

Variables

This section is empty.

Functions

func FindAttribute

func FindAttribute(cr *gongsi.NotifyContextRequest, attribute string) (string, error)

Receive an UpdateContext that contains image and sizes associated with distance estimation with a JSON described as:

{
    "contextElement": {
        "id": "SILO001",
        "type": "SILO",
        "isPattern": false,
        "attributes": [
            {
                "name": "distance",
                "type": "float32",
                "value": "11.01"
            },
            {
                "name": "image",
                "type": "string",
                "value": "11086 11060 11154 11134 11276 11026 10876 10998 10828 11158 11428 11267 11002 11277 10850 10807 11014 11124 3747 11061 10994 11251 11121 11335 10945 11353 11095 11121 11263 11261 11159 11070 11364 11162 11133 11194 11063 10830 11265 11058 10892 10788 11342 10938 11136 11964 11050 11567 11249 10928 11248 11167 10919 11179 10844 10881 11318 11227 11286 11039 11061 11179 10915 11085"
            },
            {
                "name": "numcols",
                "type": "int32",
                "value": "8.00"
            },
            {
                "name": "numrows",
                "type": "int32",
                "value": "8.00"
            }
        ]
    }
}

func GetContextType

func GetContextType(cr *gongsi.NotifyContextRequest) (contextType int)

func GetId

func GetId(cr *gongsi.NotifyContextRequest) (out string, err error)

Get Id from NGSI ContextElement

type ContextElement struct {
	Id                  string             `json:"id"`
	Type                string             `json:"type,omitempty"`
	IsPattern           bool               `json:"isPattern"`
	AttributeDomainName string             `json:"attributeDomainName,omitempty"`
	Attributes          []ContextAttribute `json:"attributes,omitempty"`
	Metadatas           []ContextMetadata  `json:"metadatas,omitempty"`
}

func GetType

func GetType(cr *gongsi.NotifyContextRequest) (out string, err error)

Types

type Attribute

type Attribute struct {
	Attr string
	Type string
}

func FindTypedAttribute

func FindTypedAttribute(cr *gongsi.NotifyContextRequest, attribute string) (ret Attribute, e error)

type ContextError

type ContextError struct {
	When time.Time
	What string
}

func (ContextError) Error

func (e ContextError) Error() string

Jump to

Keyboard shortcuts

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