MCPcopy Index your code
hub / github.com/edgexfoundry/device-sdk-go

github.com/edgexfoundry/device-sdk-go @v4.0.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v4.0.2 ↗ · + Follow
598 symbols 2,202 edges 85 files 288 documented · 48%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Go Device Service SDK

Build Status Code Coverage Go Report Card GitHub Latest Dev Tag) GitHub Latest Stable Tag) GitHub License GitHub go.mod Go version GitHub Pull Requests GitHub Contributors GitHub Committers GitHub Commit Activity

Overview

This repository is a set of Go packages that can be used to build Go-based device services for use within the EdgeX framework.

Usage

Developers can make their own device service by implementing the ProtocolDriver interface for their desired IoT protocol, and the main function to start the Device Service. To implement the main function, the startup package can be optionally leveraged, or developers can write customized bootstrap code by themselves.

Please see the provided simple device service as an example, included in this repository.

Command Line Options

The following command line options are available

  -cd=<path>
  --configDir=<path>
        Specify an alternate configuration directory.
  -p=<profile>
  --profile=<profile>
        Specify a profile other than default.
  -cf=<file>
  --configFile=<file>
        Indicates name of the local configuration file.
  -i=<instace>
  --instance=<instance>
        Provides a service name suffix which allows unique instance to be created.
        If the option is provided, service name will be replaced with "<name>_<instance>"
  -o
  --overwrite
        Overwrite configuration in the Registry with local values.
  -op 
  --overwriteProfiles
        Overwrite core-metadata with the versions of the associated device profile files.  
        *** Use with caution *** Use will clobber existing profiles in core-metadata, problematic 
        if those profiles were edited by hand intentionally or used by other services.
  -od
  --overwriteDevices
        Overwrite core-metadata with the versions of the associated device files.  
        *** Use with caution *** Use will clobber existing devices in core-metadata, problematic 
        if those devices were edited by hand intentionally.
  -r
  --registry
        Indicates the service should use the registry.
  -cp
  --configProvider
        Indicates to use Configuration Provider service at specified URL.
        URL Format: {type}.{protocol}://{host}:{port} ex: consul.http://localhost:8500

Float value encoding

In EdgeX v1, float values had two kinds of encoding, Base64, and scientific notation (eNotation).

After v2, EdgeX only uses scientific notation (eNotation) to present float values.

Community

License

Apache-2.0

Versioning

Please refer to the EdgeX Foundry versioning policy for information on how EdgeX services are released and how EdgeX services are compatible with one another. Specifically, device services (and the associated SDK), application services (and the associated app functions SDK), and client tools (like the EdgeX CLI and UI) can have independent minor releases, but these services must be compatible with the latest major release of EdgeX.

Long Term Support

Please refer to the EdgeX Foundry LTS policy for information on support of EdgeX releases. The EdgeX community does not offer support on any non-LTS release outside of the latest release.

Extension points exported contracts — how you extend this code

ProtocolDriver (Interface)
ProtocolDriver is a low-level device-specific interface used by other components of an EdgeX Device Service to interact [2 …
pkg/interfaces/protocoldriver.go
ProvisionWatcherCache (Interface)
(no doc) [2 implementers]
internal/cache/provisionwatcher.go
DeviceServiceSDK (Interface)
DeviceServiceSDK defines the interface for an EdgeX Device Service SDK [2 implementers]
pkg/interfaces/service.go
DeviceCache (Interface)
(no doc) [1 implementers]
internal/cache/devices.go
ExtendedProtocolDriver (Interface)
ExtendedProtocolDriver is a low-level device-specific interface implemented by device services that support extended Pro [2 …
pkg/interfaces/extendedprotocoldriver.go
ProfileCache (Interface)
(no doc) [1 implementers]
internal/cache/profiles.go
DeviceServiceSDKExt (Interface)
DeviceServiceSDKExt extends DeviceServiceSDK with additional methods that bypass device validation. [1 implementers]
pkg/interfaces/service.go
UpdatableConfig (Interface)
UpdatableConfig interface allows services to have custom configuration populated from configuration stored in the Config
pkg/interfaces/service.go

Core symbols most depended-on inside this repo

Get
called by 113
internal/container/allowedfailstracker.go
Run
called by 87
pkg/interfaces/service.go
ForName
called by 37
internal/cache/devices.go
Add
called by 34
internal/cache/devices.go
Devices
called by 32
internal/cache/devices.go
Profiles
called by 32
internal/cache/profiles.go
NewCommandValue
called by 30
pkg/models/commandvalue.go
Update
called by 24
internal/cache/devices.go

Shape

Method 316
Function 229
Struct 38
Interface 12
TypeAlias 3

Languages

Go100%

Modules by API surface

pkg/interfaces/service.go46 symbols
pkg/interfaces/mocks/DeviceServiceSDK.go41 symbols
pkg/models/commandvalue.go33 symbols
pkg/models/commandvalue_test.go30 symbols
internal/cache/profiles.go29 symbols
internal/cache/devices.go25 symbols
pkg/service/service.go22 symbols
example/driver/simpledriver.go22 symbols
internal/cache/provisionwatcher.go18 symbols
pkg/interfaces/mocks/ProtocolDriver.go14 symbols
pkg/service/manageddevices.go13 symbols
internal/application/command.go13 symbols

For agents

$ claude mcp add device-sdk-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact