Documentation ¶
Index ¶
- Constants
- func FindAttribute(cr *gongsi.NotifyContextRequest, attribute string) (string, error)
- func GetContextType(cr *gongsi.NotifyContextRequest) (contextType int)
- func GetId(cr *gongsi.NotifyContextRequest) (out string, err error)
- func GetType(cr *gongsi.NotifyContextRequest) (out string, err error)
- type Attribute
- type ContextError
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"` }
Types ¶
type Attribute ¶
func FindTypedAttribute ¶
func FindTypedAttribute(cr *gongsi.NotifyContextRequest, attribute string) (ret Attribute, e error)
type ContextError ¶
func (ContextError) Error ¶
func (e ContextError) Error() string
Click to show internal directories.
Click to hide internal directories.