Documentation ¶
Index ¶
- Constants
- func ToAutoEventModel(a AutoEvent) models.AutoEvent
- func ToAutoEventModels(autoEventDTOs []AutoEvent) []models.AutoEvent
- func ToCommandModel(c Command) models.Command
- func ToCommandModels(commandDTOs []Command) []models.Command
- func ToDeviceResourceModel(d DeviceResource) models.DeviceResource
- func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource
- func ToProfileResourceModel(p ProfileResource) models.ProfileResource
- func ToProfileResourceModels(profileResourceDTOs []ProfileResource) []models.ProfileResource
- func ToPropertyValueModel(p PropertyValue) models.PropertyValue
- func ToProtocolModels(protocolDTOs map[string]ProtocolProperties) map[string]models.ProtocolProperties
- func ToProtocolPropertiesModel(p ProtocolProperties) models.ProtocolProperties
- func ToReadingModel(r BaseReading, _ string) models.Reading
- func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation
- type AutoEvent
- type BaseReading
- type BinaryReading
- type Command
- type Device
- type DeviceProfile
- type DeviceResource
- type DeviceService
- type Event
- type ProfileResource
- type PropertyValue
- type ProtocolProperties
- type ResourceOperation
- type SimpleReading
- type UpdateDevice
- type UpdateDeviceProfile
- type UpdateDeviceService
Constants ¶
const ( ValueTypeBool = "Bool" ValueTypeString = "String" ValueTypeUint8 = "Uint8" ValueTypeUint16 = "Uint16" ValueTypeUint32 = "Uint32" ValueTypeUint64 = "Uint64" ValueTypeInt8 = "Int8" ValueTypeInt16 = "Int16" ValueTypeInt32 = "Int32" ValueTypeInt64 = "Int64" ValueTypeFloat32 = "Float32" ValueTypeFloat64 = "Float64" ValueTypeBinary = "Binary" ValueTypeBoolArray = "BoolArray" ValueTypeStringArray = "StringArray" ValueTypeUint8Array = "Uint8Array" ValueTypeUint16Array = "Uint16Array" ValueTypeUint32Array = "Uint32Array" ValueTypeUint64Array = "Uint64Array" ValueTypeInt8Array = "Int8Array" ValueTypeInt16Array = "Int16Array" ValueTypeInt32Array = "Int32Array" ValueTypeInt64Array = "Int64Array" ValueTypeFloat32Array = "Float32Array" ValueTypeFloat64Array = "Float64Array" )
Constants related to Reading ValueTypes
Variables ¶
This section is empty.
Functions ¶
func ToAutoEventModel ¶ added in v0.1.67
ToAutoEventModel transforms the AutoEvent DTO to the AutoEvent model
func ToAutoEventModels ¶ added in v0.1.70
ToAutoEventModels transforms the AutoEvent DTO array to the AutoEvent model array
func ToCommandModel ¶ added in v0.1.67
ToCommandModel transforms the Command DTO to the Command model
func ToCommandModels ¶ added in v0.1.70
ToCommandModels transforms the Command DTOs to the Command models
func ToDeviceResourceModel ¶ added in v0.1.67
func ToDeviceResourceModel(d DeviceResource) models.DeviceResource
ToDeviceResourceModel transforms the DeviceResource DTO to the DeviceResource model
func ToDeviceResourceModels ¶ added in v0.1.70
func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource
ToDeviceResourceModels transforms the DeviceResource DTOs to the DeviceResource models
func ToProfileResourceModel ¶ added in v0.1.67
func ToProfileResourceModel(p ProfileResource) models.ProfileResource
ToProfileResourceModel transforms the ProfileResource DTO to the ProfileResource model
func ToProfileResourceModels ¶ added in v0.1.70
func ToProfileResourceModels(profileResourceDTOs []ProfileResource) []models.ProfileResource
ToProfileResourceModels transforms the ProfileResource DTOs to the ProfileResource models
func ToPropertyValueModel ¶ added in v0.1.67
func ToPropertyValueModel(p PropertyValue) models.PropertyValue
ToPropertyValueModel transforms the PropertyValue DTO to the PropertyValue model
func ToProtocolModels ¶ added in v0.1.70
func ToProtocolModels(protocolDTOs map[string]ProtocolProperties) map[string]models.ProtocolProperties
ToProtocolModels transforms the Protocol DTO map to the Protocol model map
func ToProtocolPropertiesModel ¶ added in v0.1.67
func ToProtocolPropertiesModel(p ProtocolProperties) models.ProtocolProperties
ToPropertyValueModel transforms the ProtocolProperties DTO to the ProtocolProperties model
func ToReadingModel ¶
func ToReadingModel(r BaseReading, _ string) models.Reading
Convert Reading DTO to Reading model
func ToResourceOperationModel ¶ added in v0.1.67
func ToResourceOperationModel(ro ResourceOperation) models.ResourceOperation
ToResourceOperationModel transforms the ResourceOperation DTO to the ResourceOperation model
Types ¶
type AutoEvent ¶ added in v0.1.67
type AutoEvent struct { // Frequency indicates how often the specific resource needs to be polled. // It represents as a duration string. // The format of this field is to be an unsigned integer followed by a unit which may be "ms", "s", "m" or "h" // representing milliseconds, seconds, minutes or hours. Eg, "100ms", "24h" Frequency string `json:"frequency" validate:"required,autoevent-frequency"` // OnChange indicates whether the device service will generate an event only, // if the reading value is different from the previous one. // If true, only generate events when readings change OnChange bool `json:"onChange,omitempty"` // Resource indicates the name of the resource in the device profile which describes the event to generate Resource string `json:"resource" validate:"required"` }
AutoEvent supports auto-generated events sourced from a device service This object and its properties correspond to the AutoEvent object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/AutoEvent
type BaseReading ¶
type BaseReading struct { common.Versionable `json:",inline"` Id string `json:"id"` Created int64 `json:"created"` Origin int64 `json:"origin" validate:"required"` DeviceName string `json:"deviceName" validate:"required"` Name string `json:"name" validate:"required"` Labels []string `json:"labels,omitempty"` ValueType string `json:"valueType" validate:"required"` BinaryReading `json:",inline" validate:"-"` SimpleReading `json:",inline" validate:"-"` }
BaseReading defines the content of a reading object (usually generated by a device service) which can contain a SimpleReading or a BinaryReading (but not both). This object and its properties correspond to the BaseReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BaseReading
func FromReadingModelToDTO ¶ added in v0.1.65
func FromReadingModelToDTO(reading models.Reading) BaseReading
func (BaseReading) Validate ¶ added in v0.1.69
func (b BaseReading) Validate() error
Validate satisfies the Validator interface
type BinaryReading ¶
type BinaryReading struct { BinaryValue []byte `json:"binaryValue" validate:"gt=0,dive,required"` MediaType string `json:"mediaType" validate:"required"` }
BinaryReading defines the content of the binary form of a reading object (usually generated by a device service) This object and its properties correspond to the BinaryReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/BinaryReading
type Command ¶ added in v0.1.67
type Command struct { Name string `json:"name" yaml:"name" validate:"required"` // Command name (unique on the profile) Get bool `json:"get" yaml:"get,omitempty" validate:"required_without=Put"` // Get Command enabled Put bool `json:"put" yaml:"put,omitempty" validate:"required_without=Get"` // Put Command enabled }
Command defines a specific read/write operation targeting a device This object and its properties correspond to the Command object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Command
type Device ¶ added in v0.1.67
type Device struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty"` Created int64 `json:"created,omitempty"` Modified int64 `json:"modified,omitempty"` Name string `json:"name" validate:"required"` Description string `json:"description,omitempty"` AdminState string `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"` OperatingState string `json:"operatingState" validate:"oneof='ENABLED' 'DISABLED'"` LastConnected int64 `json:"lastConnected,omitempty"` LastReported int64 `json:"lastReported,omitempty"` Labels []string `json:"labels,omitempty"` Location interface{} `json:"location,omitempty"` ServiceName string `json:"serviceName" validate:"required"` ProfileName string `json:"profileName" validate:"required"` AutoEvents []AutoEvent `json:"autoEvents,omitempty" validate:"dive"` Protocols map[string]ProtocolProperties `json:"protocols,omitempty" validate:"required,gt=0"` }
Device represents a registered device participating within the EdgeX Foundry ecosystem This object and its properties correspond to the Device object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/Device
type DeviceProfile ¶ added in v0.1.67
type DeviceProfile struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty"` Name string `json:"name" yaml:"name" validate:"required" ` Manufacturer string `json:"manufacturer,omitempty" yaml:"manufacturer,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Model string `json:"model,omitempty" yaml:"model,omitempty"` Labels []string `json:"labels,omitempty" yaml:"labels,flow,omitempty"` DeviceResources []DeviceResource `json:"deviceResources" yaml:"deviceResources" validate:"required,gt=0,dive"` DeviceCommands []ProfileResource `json:"deviceCommands,omitempty" yaml:"deviceCommands,omitempty" validate:"dive"` CoreCommands []Command `json:"coreCommands,omitempty" yaml:"coreCommands,omitempty" validate:"dive"` }
DeviceProfile represents the attributes and operational capabilities of a device. It is a template for which there can be multiple matching devices within a given system. This object and its properties correspond to the DeviceProfile object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceProfile
type DeviceResource ¶ added in v0.1.67
type DeviceResource struct { Description string `json:"description" yaml:"description,omitempty"` Name string `json:"name" yaml:"name,omitempty" validate:"required"` Tag string `json:"tag" yaml:"tag,omitempty"` Properties PropertyValue `json:"properties" yaml:"properties"` Attributes map[string]string `json:"attributes" yaml:"attributes,omitempty"` }
DeviceResource represents a value on a device that can be read or written This object and its properties correspond to the DeviceResource object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceResource
type DeviceService ¶ added in v0.1.67
type DeviceService struct { common.Versionable `json:",inline"` Id string `json:"id,omitempty"` Name string `json:"name" validate:"required"` Created int64 `json:"created,omitempty"` Modified int64 `json:"modified,omitempty"` Description string `json:"description,omitempty"` LastConnected int64 `json:"lastConnected,omitempty"` LastReported int64 `json:"lastReported,omitempty"` OperatingState string `json:"operatingState" validate:"oneof='ENABLED' 'DISABLED'"` Labels []string `json:"labels,omitempty"` BaseAddress string `json:"baseAddress" validate:"required,uri"` AdminState string `json:"adminState" validate:"oneof='LOCKED' 'UNLOCKED'"` }
DeviceService represents a service that is responsible for proxying connectivity between a set of devices and the EdgeX Foundry core services. This object and its properties correspond to the DeviceService object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/DeviceService
type Event ¶ added in v0.1.65
type Event struct { common.Versionable `json:",inline"` ID string `json:"id"` Pushed int64 `json:"pushed,omitempty"` DeviceName string `json:"deviceName" validate:"required"` Created int64 `json:"created"` Origin int64 `json:"origin" validate:"required"` Readings []BaseReading `json:"readings" validate:"gt=0,dive,required"` Tags map[string]string `json:"tags,omitempty" xml:"-"` // Have to ignore since map not supported for XML }
Event represents a single measurable event read from a device This object and its properties correspond to the Event object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/Event
func FromEventModelToDTO ¶ added in v0.1.65
type ProfileResource ¶ added in v0.1.67
type ProfileResource struct { Name string `json:"name,omitempty" yaml:"name,omitempty" validate:"required"` Get []ResourceOperation `json:"get,omitempty" yaml:"get,omitempty" validate:"required_without=Set"` Set []ResourceOperation `json:"set,omitempty" yaml:"set,omitempty" validate:"required_without=Get"` }
ProfileResource defines read/write capabilities native to the device This object and its properties correspond to the ProfileResource object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ProfileResource
type PropertyValue ¶ added in v0.1.67
type PropertyValue struct { Type string `json:"type" yaml:"type" validate:"required"` ReadWrite string `json:"readWrite,omitempty" yaml:"readWrite,omitempty"` Units string `json:"units,omitempty" yaml:"units,omitempty"` Minimum string `json:"minimum,omitempty" yaml:"minimum,omitempty"` Maximum string `json:"maximum,omitempty" yaml:"maximum,omitempty"` DefaultValue string `json:"defaultValue,omitempty" yaml:"defaultValue,omitempty"` Mask string `json:"mask,omitempty" yaml:"mask,omitempty"` Shift string `json:"shift,omitempty" yaml:"shift,omitempty"` Scale string `json:"scale,omitempty" yaml:"scale,omitempty"` Offset string `json:"offset,omitempty" yaml:"offset,omitempty"` Base string `json:"base,omitempty" yaml:"base,omitempty"` Assertion string `json:"assertion,omitempty" yaml:"assertion,omitempty"` FloatEncoding string `json:"floatEncoding,omitempty" yaml:"floatEncoding,omitempty" validate:"omitempty,oneof='Base64' 'eNotation'"` MediaType string `json:"mediaType,omitempty" yaml:"mediaType,omitempty"` }
PropertyValue defines constraints with regard to the range of acceptable values assigned to an event reading and defined as a property within a device profile. This object and its properties correspond to the PropertyValue object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/PropertyValue
type ProtocolProperties ¶ added in v0.1.67
ProtocolProperties contains the device connection information in key/value pair
type ResourceOperation ¶ added in v0.1.67
type ResourceOperation struct { DeviceResource string `json:"deviceResource" yaml:"deviceResource" validate:"required"` // The replacement of Object field Parameter string `json:"parameter" yaml:"parameter,omitempty"` Mappings map[string]string `json:"mappings" yaml:"mappings,omitempty"` }
ResourceOperation defines an operation of which a device is capable This object and its properties correspond to the ResourceOperation object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/ResourceOperation
type SimpleReading ¶
type SimpleReading struct { Value string `json:"value" validate:"required"` FloatEncoding string `json:"floatEncoding,omitempty"` }
SimpleReading defines the content of the simple reading object (usually generated by a device service) which can contain simple non-binary data types. This object and its properties correspond to the SimpleReading object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-data/2.x#/SimpleReading
type UpdateDevice ¶ added in v0.1.70
type UpdateDevice struct { Id *string `json:"id" validate:"required_without=Name"` Name *string `json:"name" validate:"required_without=Id"` Description *string `json:"description"` AdminState *string `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"` OperatingState *string `json:"operatingState" validate:"omitempty,oneof='ENABLED' 'DISABLED'"` LastConnected *int64 `json:"lastConnected"` LastReported *int64 `json:"lastReported"` ServiceName *string `json:"serviceName"` ProfileName *string `json:"profileName"` Labels []string `json:"labels"` Location interface{} `json:"location"` AutoEvents []AutoEvent `json:"autoEvents" validate:"dive"` Protocols map[string]ProtocolProperties `json:"protocols" validate:"omitempty,gt=0"` Notify *bool `json:"notify"` }
UpdateDevice represents a registered device participating within the EdgeX Foundry ecosystem This object and its properties correspond to the UpdateDevice object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDevice
type UpdateDeviceProfile ¶ added in v0.1.70
type UpdateDeviceProfile struct { Id *string `json:"id" validate:"required_without=Name"` Name *string `json:"name" yaml:"name" validate:"required_without=Id" ` Manufacturer *string `json:"manufacturer" yaml:"manufacturer"` Description *string `json:"description" yaml:"description"` Model *string `json:"model" yaml:"model"` Labels []string `json:"labels" yaml:"labels,flow"` DeviceResources []DeviceResource `json:"deviceResources" yaml:"deviceResources" validate:"omitempty,gt=0,dive"` DeviceCommands []ProfileResource `json:"deviceCommands" yaml:"deviceCommands" validate:"dive"` CoreCommands []Command `json:"coreCommands" yaml:"coreCommands" validate:"dive"` }
UpdateDeviceProfile represents the attributes and operational capabilities of a device. It is a template for which there can be multiple matching devices within a given system. This object and its properties correspond to the UpdateDeviceProfile object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceProfile
type UpdateDeviceService ¶ added in v0.1.70
type UpdateDeviceService struct { Id *string `json:"id" validate:"required_without=Name"` Name *string `json:"name" validate:"required_without=Id"` BaseAddress *string `json:"baseAddress"` OperatingState *string `json:"operatingState" validate:"omitempty,oneof='ENABLED' 'DISABLED'"` Labels []string `json:"labels"` AdminState *string `json:"adminState" validate:"omitempty,oneof='LOCKED' 'UNLOCKED'"` }
UpdateDeviceService represents a service that is responsible for proxying connectivity between a set of devices and the EdgeX Foundry core services. This object and its properties correspond to the UpdateDeviceService object in the APIv2 specification: https://app.swaggerhub.com/apis-docs/EdgeXFoundry1/core-metadata/2.x#/UpdateDeviceService