Documentation ¶
Index ¶
- Constants
- func FromProtocolModelsToDTOs(protocolModels map[string]models.ProtocolProperties) map[string]ProtocolProperties
- 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 ToDeviceModel(dto Device) models.Device
- func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile
- func ToDeviceResourceModel(d DeviceResource) models.DeviceResource
- func ToDeviceResourceModels(deviceResourceDTOs []DeviceResource) []models.DeviceResource
- func ToDeviceServiceModel(dto DeviceService) models.DeviceService
- 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) 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 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 FromProtocolModelsToDTOs ¶ added in v0.1.89
func FromProtocolModelsToDTOs(protocolModels map[string]models.ProtocolProperties) map[string]ProtocolProperties
FromProtocolModelsToDTOs transforms the Protocol model map to the Protocol DTO map
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 ToDeviceModel ¶ added in v0.1.89
ToDeviceModel transforms the Device DTO to the Device Model
func ToDeviceProfileModel ¶ added in v0.1.86
func ToDeviceProfileModel(deviceProfileDTO DeviceProfile) models.DeviceProfile
ToDeviceProfileModel transforms the DeviceProfile DTO to the DeviceProfile model
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 ToDeviceServiceModel ¶ added in v0.1.89
func ToDeviceServiceModel(dto DeviceService) models.DeviceService
ToDeviceServiceModel transforms the DeviceService DTO to the DeviceService Model
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) 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
func FromAutoEventModelToDTO ¶ added in v0.1.89
FromAutoEventModelToDTO transforms the AutoEvent model to the AutoEvent DTO
func FromAutoEventModelsToDTOs ¶ added in v0.1.89
ToAutoEventModels transforms the AutoEvent model array to the AutoEvent DTO array
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
func FromCommandModelToDTO ¶ added in v0.1.86
FromCommandModelToDTO transforms the Command model to the Command DTO
func FromCommandModelsToDTOs ¶ added in v0.1.86
FromCommandModelsToDTOs transforms the Command models to the Command DTOs
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
func FromDeviceModelToDTO ¶ added in v0.1.89
FromDeviceModelToDTO transforms the Device Model to the Device DTO
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
func FromDeviceProfileModelToDTO ¶ added in v0.1.86
func FromDeviceProfileModelToDTO(deviceProfile models.DeviceProfile) DeviceProfile
FromDeviceProfileModelToDTO transforms the DeviceProfile Model to the DeviceProfile DTO
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
func FromDeviceResourceModelToDTO ¶ added in v0.1.86
func FromDeviceResourceModelToDTO(d models.DeviceResource) DeviceResource
FromDeviceResourceModelToDTO transforms the DeviceResource model to the DeviceResource DTO
func FromDeviceResourceModelsToDTOs ¶ added in v0.1.86
func FromDeviceResourceModelsToDTOs(deviceResourceModels []models.DeviceResource) []DeviceResource
FromDeviceResourceModelsToDTOs transforms the DeviceResource models to the DeviceResource DTOs
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
func FromDeviceServiceModelToDTO ¶ added in v0.1.89
func FromDeviceServiceModelToDTO(ds models.DeviceService) DeviceService
FromDeviceServiceModelToDTO transforms the DeviceService Model to the DeviceService DTO
type Event ¶ added in v0.1.65
type Event struct { common.Versionable `json:",inline"` Id string `json:"id" validate:"required,uuid"` 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
func FromProfileResourceModelToDTO ¶ added in v0.1.86
func FromProfileResourceModelToDTO(p models.ProfileResource) ProfileResource
FromProfileResourceModelToDTO transforms the ProfileResource model to the ProfileResource DTO
func FromProfileResourceModelsToDTOs ¶ added in v0.1.86
func FromProfileResourceModelsToDTOs(profileResourceModels []models.ProfileResource) []ProfileResource
FromProfileResourceModelsToDTOs transforms the ProfileResource models to the ProfileResource DTOs
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
func FromPropertyValueModelToDTO ¶ added in v0.1.86
func FromPropertyValueModelToDTO(p models.PropertyValue) PropertyValue
FromPropertyValueModelToDTO transforms the PropertyValue Model to the PropertyValue DTO
type ProtocolProperties ¶ added in v0.1.67
ProtocolProperties contains the device connection information in key/value pair
func FromProtocolPropertiesModelToDTO ¶ added in v0.1.89
func FromProtocolPropertiesModelToDTO(p models.ProtocolProperties) ProtocolProperties
FromProtocolPropertiesModelToDTO transforms the ProtocolProperties model to the ProtocolProperties DTO
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
func FromResourceOperationModelToDTO ¶ added in v0.1.86
func FromResourceOperationModelToDTO(ro models.ResourceOperation) ResourceOperation
FromResourceOperationModelToDTO transforms the ResourceOperation model to the ResourceOperation DTO
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 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