Documentation ¶
Index ¶
- Constants
- Variables
- func BuildAddr(host string, port string) string
- func CommandValueToReading(cv *dsModels.CommandValue, devName string, mediaType string, encoding string) *contract.Reading
- func CompareCoreCommands(a []contract.Command, b []contract.Command) bool
- func CompareDeviceCommands(a []contract.ProfileResource, b []contract.ProfileResource) bool
- func CompareDeviceProfiles(a contract.DeviceProfile, b contract.DeviceProfile) bool
- func CompareDeviceResources(a []contract.DeviceResource, b []contract.DeviceResource) bool
- func CompareDeviceServices(a contract.DeviceService, b contract.DeviceService) bool
- func CompareDevices(a contract.Device, b contract.Device) bool
- func CompareResourceOperations(a []contract.ResourceOperation, b []contract.ResourceOperation) bool
- func CompareServices(a contract.DeviceService, b contract.DeviceService) bool
- func CompareStrStrMap(a map[string]string, b map[string]string) bool
- func CompareStrings(a []string, b []string) bool
- func FilterQueryParams(queryParams string) url.Values
- func GetUniqueOrigin() int64
- func SendEvent(event *dsModels.Event)
- func UpdateLastConnected(name string)
- func VerifyIdFormat(id string, drName string) error
- type AppError
- type ConfigurationStruct
- func (c *ConfigurationStruct) EmptyWritablePtr() interface{}
- func (c *ConfigurationStruct) GetBootstrap() interfaces.BootstrapConfiguration
- func (c *ConfigurationStruct) GetLogLevel() string
- func (c *ConfigurationStruct) GetRegistryInfo() bootstrapConfig.RegistryInfo
- func (c *ConfigurationStruct) UpdateFromRaw(rawConfig interface{}) bool
- func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool
- type DeviceConfig
- type DeviceInfo
- type ServiceInfo
- type Telemetry
- type WritableInfo
Constants ¶
const ( ClientData = "Data" ClientMetadata = "Metadata" Colon = ":" HttpScheme = "http://" HttpProto = "HTTP" BootTimeoutSecondsDefault = 30 BootRetrySecondsDefault = 1 ConfigStemCore = "edgex/core/" ConfigMajorVersion = "1.0/" APICallbackRoute = clients.ApiCallbackRoute APIValueDescriptorRoute = clients.ApiValueDescriptorRoute APIPingRoute = clients.ApiPingRoute APIVersionRoute = clients.ApiVersionRoute APIMetricsRoute = clients.ApiMetricsRoute APIConfigRoute = clients.ApiConfigRoute APIAllCommandRoute = clients.ApiDeviceRoute + "/all/{command}" APIIdCommandRoute = clients.ApiDeviceRoute + "/{id}/{command}" APINameCommandRoute = clients.ApiDeviceRoute + "/name/{name}/{command}" APIDiscoveryRoute = clients.ApiBase + "/discovery" APITransformRoute = clients.ApiBase + "/debug/transformData/{transformData}" IdVar string = "id" NameVar string = "name" CommandVar string = "command" GetCmdMethod string = "get" SetCmdMethod string = "set" CorrelationHeader = clients.CorrelationHeader URLRawQuery = "urlRawQuery" SDKReservedPrefix = "ds-" )
Variables ¶
var ( ServiceName string ServiceVersion string CurrentConfig *ConfigurationStruct CurrentDeviceService contract.DeviceService ServiceLocked bool Driver dsModels.ProtocolDriver RegistryClient registry.Client EventClient coredata.EventClient AddressableClient metadata.AddressableClient DeviceClient metadata.DeviceClient DeviceServiceClient metadata.DeviceServiceClient DeviceProfileClient metadata.DeviceProfileClient LoggingClient logger.LoggingClient ValueDescriptorClient coredata.ValueDescriptorClient MetadataGeneralClient general.GeneralClient ProvisionWatcherClient metadata.ProvisionWatcherClient )
Functions ¶
func CommandValueToReading ¶
func CompareCoreCommands ¶
func CompareDeviceCommands ¶
func CompareDeviceCommands(a []contract.ProfileResource, b []contract.ProfileResource) bool
func CompareDeviceProfiles ¶
func CompareDeviceProfiles(a contract.DeviceProfile, b contract.DeviceProfile) bool
func CompareDeviceResources ¶
func CompareDeviceResources(a []contract.DeviceResource, b []contract.DeviceResource) bool
func CompareDeviceServices ¶
func CompareDeviceServices(a contract.DeviceService, b contract.DeviceService) bool
func CompareResourceOperations ¶
func CompareResourceOperations(a []contract.ResourceOperation, b []contract.ResourceOperation) bool
func CompareServices ¶
func CompareServices(a contract.DeviceService, b contract.DeviceService) bool
func CompareStrings ¶
func FilterQueryParams ¶ added in v1.1.1
func GetUniqueOrigin ¶ added in v1.1.0
func GetUniqueOrigin() int64
func UpdateLastConnected ¶ added in v1.2.0
func UpdateLastConnected(name string)
func VerifyIdFormat ¶
Types ¶
type AppError ¶
func NewBadRequestError ¶
func NewLockedError ¶
func NewNotFoundError ¶
func NewServerError ¶
type ConfigurationStruct ¶ added in v1.2.0
type ConfigurationStruct struct { // WritableInfo contains configuration settings that can be changed in the Registry . Writable WritableInfo // Clients is a map of services used by a DS. Clients map[string]bootstrapConfig.ClientInfo // Logging contains logging-specific configuration settings. Logging bootstrapConfig.LoggingInfo // Registry contains registry-specific settings. Registry bootstrapConfig.RegistryInfo // Service contains RegistryService-specific settings. Service ServiceInfo // Device contains device-specific configuration settings. Device DeviceInfo // DeviceList is the list of pre-define Devices DeviceList []DeviceConfig `consul:"-"` // Driver is a string map contains customized configuration for the protocol driver implemented based on Device SDK Driver map[string]string }
ConfigurationStruct contains the configuration properties for the device service.
func (*ConfigurationStruct) EmptyWritablePtr ¶ added in v1.2.0
func (c *ConfigurationStruct) EmptyWritablePtr() interface{}
EmptyWritablePtr returns a pointer to a service-specific empty WritableInfo struct. It is used by the bootstrap to provide the appropriate structure to registry.Client's WatchForChanges().
func (*ConfigurationStruct) GetBootstrap ¶ added in v1.2.0
func (c *ConfigurationStruct) GetBootstrap() interfaces.BootstrapConfiguration
GetBootstrap returns the configuration elements required by the bootstrap. Currently, a copy of the configuration data is returned. This is intended to be temporary -- since ConfigurationStruct drives the configuration.toml's structure -- until we can make backwards-breaking configuration.toml changes (which would consolidate these fields into an interfaces.BootstrapConfiguration struct contained within ConfigurationStruct).
func (*ConfigurationStruct) GetLogLevel ¶ added in v1.2.0
func (c *ConfigurationStruct) GetLogLevel() string
GetLogLevel returns the current ConfigurationStruct's log level.
func (*ConfigurationStruct) GetRegistryInfo ¶ added in v1.2.0
func (c *ConfigurationStruct) GetRegistryInfo() bootstrapConfig.RegistryInfo
GetRegistryInfo gets the config.RegistryInfo field from the ConfigurationStruct.
func (*ConfigurationStruct) UpdateFromRaw ¶ added in v1.2.0
func (c *ConfigurationStruct) UpdateFromRaw(rawConfig interface{}) bool
UpdateFromRaw converts configuration received from the registry to a service-specific configuration struct which is then used to overwrite the service's existing configuration struct.
func (*ConfigurationStruct) UpdateWritableFromRaw ¶ added in v1.2.0
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool
UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct which is then used to overwrite the service's existing configuration's WritableInfo struct.
type DeviceConfig ¶
type DeviceConfig struct { // Name is the Device name Name string // Profile is the profile name of the Device Profile string Description string // Other labels applied to the device to help with searching Labels []string // Protocols for the device - stores protocol properties Protocols map[string]dsModels.ProtocolProperties // AutoEvent supports auto-generated events sourced from a device service AutoEvents []dsModels.AutoEvent }
DeviceConfig is the definition of Devices which will be auto created when the Device Service starts up
type DeviceInfo ¶
type DeviceInfo struct { // DataTransform specifies whether or not the DS perform transformations // specified by valuedescriptor on a actuation or query command. DataTransform bool // InitCmd specifies a device resource command which is automatically // generated whenever a new device is added to the DS. InitCmd string // InitCmdArgs specify arguments to be used when building the InitCmd. InitCmdArgs string // MaxCmdOps defines the maximum number of resource operations that // can be sent to a Driver in a single command. MaxCmdOps int // MaxCmdValueLen is the maximum string length of a command parameter or // result (including the valuedescriptor name) that can be returned // by a Driver. MaxCmdValueLen int // InitCmd specifies a device resource command which is automatically // generated whenever a new device is removed from the DS. RemoveCmd string // RemoveCmdArgs specify arguments to be used when building the RemoveCmd. RemoveCmdArgs string // ProfilesDir specifies a directory which contains deviceprofile // files which should be imported on startup. ProfilesDir string // UpdateLastConnected specifies whether to update device's LastConnected // timestamp in metadata. UpdateLastConnected bool }
DeviceInfo is a struct which contains device specific configuration settings.
type ServiceInfo ¶
type ServiceInfo struct { // BootTimeout indicates, in milliseconds, how long the service will retry connecting to upstream dependencies // before giving up. Default is 30,000. BootTimeout int // Health check interval CheckInterval string // Indicates the interval in milliseconds at which service clients should check for any configuration updates ClientMonitor int // Host is the hostname or IP address of the service. Host string // Port is the HTTP port of the service. Port int // The protocol that should be used to call this service Protocol string // StartupMsg specifies a string to log once service // initialization and startup is completed. StartupMsg string // MaxResultCount specifies the maximum size list supported // in response to REST calls to other services. MaxResultCount int // Timeout (in milliseconds) specifies both // - timeout for processing REST calls and // - interval time the DS will wait between each retry call. Timeout int // ConnectRetries is the number of times the DS will try to connect to all dependent services. // If exceeded for even one dependent service, the DS will exit. ConnectRetries int // Labels are... Labels []string // EnableAsyncReadings to determine whether the Device Service would deal with the asynchronous readings EnableAsyncReadings bool // AsyncBufferSize defines the size of asynchronous channel AsyncBufferSize int }
ServiceInfo is a struct which contains service related configuration settings.
func (ServiceInfo) GetBootstrapServiceInfo ¶ added in v1.2.0
func (s ServiceInfo) GetBootstrapServiceInfo() bootstrapConfig.ServiceInfo
type Telemetry ¶
type Telemetry struct { Alloc, TotalAlloc, Sys, Mallocs, Frees, LiveObjects uint64 }
Telemetry provides metrics (on a given device service) to system management.
type WritableInfo ¶
type WritableInfo struct { // Level is the logging level of writing log message LogLevel string }
WritableInfo is a struct which contains configuration settings that can be changed in the Registry .