Documentation
¶
Index ¶
- Constants
- type AdminState
- type AutoEvent
- type BaseReading
- type BinaryReading
- type Command
- type Device
- type DeviceProfile
- type DeviceResource
- type DeviceService
- type Event
- type OperatingState
- type ProfileResource
- type PropertyValue
- type ProtocolProperties
- type Reading
- type ResourceOperation
- type SimpleReading
- type Timestamps
Constants ¶
const ( // Locked : device is locked // Unlocked : device is unlocked Locked = "LOCKED" Unlocked = "UNLOCKED" )
const ( Enabled = "ENABLED" Disabled = "DISABLED" )
Enabled : ENABLED Disabled : DISABLED
const ( // Base64Encoding : the float value is represented in Base64 encoding Base64Encoding = "Base64" // ENotation : the float value is represented in eNotation ENotation = "eNotation" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminState ¶ added in v0.1.67
type AdminState string
AdminState controls the range of values which constitute valid administrative states for a device
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
// 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
// Resource indicates the name of the resource in the device profile which describes the event to generate
Resource string
}
AutoEvent supports auto-generated events sourced from a device service
type BaseReading ¶
type BaseReading struct {
Id string
Created int64 // When the reading was created
Origin int64
DeviceName string
Name string
Labels []string // Custom labels assigned to a reading, added in the APIv2 specification.
ValueType string // Indicates the datatype of the value property
}
BaseReading contains data that was gathered from a device. Readings returned will all inherit from BaseReading but their concrete types will be either SimpleReading or BinaryReading, potentially interleaved in the APIv2 specification.
type BinaryReading ¶
type BinaryReading struct {
BaseReading `json:",inline"`
BinaryValue []byte // Binary data payload
MediaType string // indicates what the content type of the binaryValue property is
}
An event reading for a binary data type BinaryReading object in the APIv2 specification.
func (BinaryReading) GetBaseReading ¶ added in v0.1.68
func (b BinaryReading) GetBaseReading() BaseReading
Implement GetBaseReading() method in order for BinaryReading and SimpleReading structs to implement the abstract Reading interface and then be used as a Reading. Also, the Reading interface can access the BaseReading fields. This is Golang's way to implement inheritance.
type Command ¶ added in v0.1.67
type Command struct {
Name string // Command name (unique on the profile)
Get bool // Get Command enabled
Put bool // Put Command enabled
}
Command defines a specific read/write operation targeting a device
type Device ¶ added in v0.1.67
type Device struct {
Timestamps
Id string // ID uniquely identifies the device, a UUID for example
Name string // Unique name for identifying a device
Description string // Description of the device
AdminState AdminState // Admin state (locked/unlocked)
OperatingState OperatingState // Operating state (enabled/disabled)
Protocols map[string]ProtocolProperties // A map of supported protocols for the given device
LastConnected int64 // Time (milliseconds) that the device last provided any feedback or responded to any request
LastReported int64 // Time (milliseconds) that the device reported data to the core microservice
Labels []string // Other labels applied to the device to help with searching
Location interface{} // Device service specific location (interface{} is an empty interface so it can be anything)
ServiceName string // Associated Device Service - One per device
ProfileName string // Associated Device Profile - Describes the device
AutoEvents []AutoEvent // A list of auto-generated events coming from the device
Notify bool // If the 'notify' property is set to true, the device service managing the device will receive a notification.
}
Device represents a registered device participating within the EdgeX Foundry ecosystem
type DeviceProfile ¶ added in v0.1.67
type DeviceProfile struct {
Timestamps
Description string // Description.
Id string
Name string // Non-database identifier (must be unique)
Manufacturer string // Manufacturer of the device
Model string // Model of the device
Labels []string // Labels used to search for groups of profiles
DeviceResources []DeviceResource
DeviceCommands []ProfileResource
CoreCommands []Command // List of commands to Get/Put information for devices associated with this profile
}
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.
type DeviceResource ¶ added in v0.1.67
type DeviceResource struct {
Description string
Name string
Tag string
Properties PropertyValue
Attributes map[string]string
}
DeviceResource represents a value on a device that can be read or written
type DeviceService ¶ added in v0.1.67
type DeviceService struct {
Timestamps
Id string
Name string // time in milliseconds that the device last provided any feedback or responded to any request
Description string // Description of the device service
LastConnected int64 // time in milliseconds that the device last reported data to the core
LastReported int64 // operational state - either enabled or disabled
OperatingState OperatingState // operational state - ether enabled or disableddc
Labels []string // tags or other labels applied to the device service for search or other identification needs
BaseAddress string // BaseAddress is a fully qualified URI, e.g. <protocol>:\\<hostname>:<port>/<optional path>
AdminState AdminState // Device Service Admin State
}
DeviceService represents a service that is responsible for proxying connectivity between a set of devices and the EdgeX Foundry core services.
type Event ¶
type Event struct {
CorrelationId string
Checksum string
Id string // Id uniquely identifies an event, for example a UUID
Pushed int64 // Pushed is a timestamp indicating when the event was exported. If unexported, the value is zero.
DeviceName string // DeviceName identifies the source of the event
Created int64 // Created is a timestamp indicating when the event was created.
Origin int64 // Origin is a timestamp that can communicate the time of the original reading, prior to event creation
Readings []Reading // Readings will contain zero to many entries for the associated readings of a given event.
Tags map[string]string // Tags is an optional collection of key/value pairs that all the event to be tagged with custom information.
}
Event represents a single measurable event read from a device
type ProfileResource ¶ added in v0.1.67
type ProfileResource struct {
Name string
Get []ResourceOperation
Set []ResourceOperation
}
ProfileResource defines read/write capabilities native to the device
type PropertyValue ¶ added in v0.1.67
type PropertyValue struct {
Type string // ValueDescriptor Type of property after transformations
ReadWrite string // Read/Write Permissions set for this property
Units string // A string which describes the measurement units associated with a property value Examples include "deg/s", "degreesFarenheit", "G", or "% Relative Humidity"
Minimum string // Minimum value that can be get/set from this property
Maximum string // Maximum value that can be get/set from this property
DefaultValue string // Default value set to this property if no argument is passed
Mask string // Mask to be applied prior to get/set of property
Shift string // Shift to be applied after masking, prior to get/set of property
Scale string // Multiplicative factor to be applied after shifting, prior to get/set of property
Offset string // Additive factor to be applied after multiplying, prior to get/set of property
Base string // Base for property to be applied to, leave 0 for no power operation (i.e. base ^ property: 2 ^ 10)
Assertion string // Required value of the property, set for checking error state. Failing an assertion condition will mark the device with an error state
FloatEncoding string // FloatEncoding indicates the representation of floating value of reading. It should be 'Base64' or 'eNotation'
MediaType string // A string value used to indicate the type of binary data if Type=binary
}
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.
type ProtocolProperties ¶ added in v0.1.67
ProtocolProperties contains the device connection information in key/value pair
type Reading ¶
type Reading interface {
GetBaseReading() BaseReading
}
a abstract interface to be implemented by BinaryReading/SimpleReading
type ResourceOperation ¶ added in v0.1.67
type ResourceOperation struct {
DeviceResource string // The replacement of Object field
Parameter string
Mappings map[string]string
}
ResourceOperation defines an operation of which a device is capable
type SimpleReading ¶
type SimpleReading struct {
BaseReading `json:",inline"`
Value string // Device sensor data value
FloatEncoding string // Indicates how a float value is encoded
}
An event reading for a simple data type SimpleReading object in the APIv2 specification.
func (SimpleReading) GetBaseReading ¶ added in v0.1.68
func (s SimpleReading) GetBaseReading() BaseReading