Documentation ¶
Overview ¶
This package provides a basic EdgeX Foundry device service implementation meant to be embedded in an application, similar in approach to the builtin net/http package.
Index ¶
- func DriverConfigs() map[string]string
- func Main(serviceName string, serviceVersion string, proto interface{}, ...)
- type Bootstrap
- type DeviceService
- func (s *DeviceService) AddDevice(device contract.Device) (id string, err error)
- func (s *DeviceService) AddDeviceProfile(profile contract.DeviceProfile) (id string, err error)
- func (s *DeviceService) AddProvisionWatcher(watcher contract.ProvisionWatcher) (id string, err error)
- func (s *DeviceService) AddRoute(route string, handler func(http.ResponseWriter, *http.Request), ...) error
- func (s *DeviceService) AsyncReadings() bool
- func (s *DeviceService) DeviceDiscovery() bool
- func (s *DeviceService) DeviceProfiles() []contract.DeviceProfile
- func (s *DeviceService) DeviceResource(deviceName string, deviceResource string, _ string) (contract.DeviceResource, bool)
- func (s *DeviceService) Devices() []contract.Device
- func (s *DeviceService) GetDeviceByName(name string) (contract.Device, error)
- func (s *DeviceService) GetProvisionWatcherByName(name string) (contract.ProvisionWatcher, error)
- func (s *DeviceService) Initialize(serviceName, serviceVersion string, proto interface{})
- func (s *DeviceService) Name() string
- func (s *DeviceService) ProvisionWatchers() []contract.ProvisionWatcher
- func (s *DeviceService) RemoveDevice(id string) error
- func (s *DeviceService) RemoveDeviceByName(name string) error
- func (s *DeviceService) RemoveDeviceProfile(id string) error
- func (s *DeviceService) RemoveDeviceProfileByName(name string) error
- func (s *DeviceService) RemoveProvisionWatcher(id string) error
- func (s *DeviceService) ResourceOperation(deviceName string, deviceResource string, method string) (contract.ResourceOperation, bool)
- func (s *DeviceService) Stop(force bool)
- func (s *DeviceService) UpdateDevice(device contract.Device) error
- func (s *DeviceService) UpdateDeviceOperatingState(deviceName string, state string) error
- func (s *DeviceService) UpdateDeviceProfile(profile contract.DeviceProfile) error
- func (s *DeviceService) UpdateFromContainer(r *mux.Router, dic *di.Container)
- func (s *DeviceService) UpdateProvisionWatcher(watcher contract.ProvisionWatcher) error
- func (s *DeviceService) Version() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DriverConfigs ¶
DriverConfigs retrieves the driver specific configuration
Types ¶
type Bootstrap ¶
type Bootstrap struct {
// contains filtered or unexported fields
}
Bootstrap contains references to dependencies required by the BootstrapHandler.
func NewBootstrap ¶
NewBootstrap is a factory method that returns an initialized Bootstrap receiver struct.
type DeviceService ¶ added in v1.3.0
type DeviceService struct { ServiceName string LoggingClient logger.LoggingClient // contains filtered or unexported fields }
func RunningService ¶
func RunningService() *DeviceService
RunningService returns the Service instance which is running
func (*DeviceService) AddDevice ¶ added in v1.3.0
func (s *DeviceService) AddDevice(device contract.Device) (id string, err error)
AddDevice adds a new Device to the Device Service and Core Metadata Returns new Device id or non-nil error.
func (*DeviceService) AddDeviceProfile ¶ added in v1.3.0
func (s *DeviceService) AddDeviceProfile(profile contract.DeviceProfile) (id string, err error)
AddDeviceProfile adds a new DeviceProfile to the Device Service and Core Metadata Returns new DeviceProfile id or non-nil error.
func (*DeviceService) AddProvisionWatcher ¶ added in v1.3.0
func (s *DeviceService) AddProvisionWatcher(watcher contract.ProvisionWatcher) (id string, err error)
AddProvisionWatcher adds a new Watcher to the cache and Core Metadata Returns new Watcher id or non-nil error.
func (*DeviceService) AddRoute ¶ added in v1.3.0
func (s *DeviceService) AddRoute(route string, handler func(http.ResponseWriter, *http.Request), methods ...string) error
AddRoute allows leveraging the existing internal web server to add routes specific to Device Service.
func (*DeviceService) AsyncReadings ¶ added in v1.3.0
func (s *DeviceService) AsyncReadings() bool
AsyncReadings returns a bool value to indicate whether the asynchronous reading is enabled.
func (*DeviceService) DeviceDiscovery ¶ added in v1.3.0
func (s *DeviceService) DeviceDiscovery() bool
func (*DeviceService) DeviceProfiles ¶ added in v1.3.0
func (s *DeviceService) DeviceProfiles() []contract.DeviceProfile
DeviceProfiles return all managed DeviceProfiles from cache
func (*DeviceService) DeviceResource ¶ added in v1.3.0
func (s *DeviceService) DeviceResource(deviceName string, deviceResource string, _ string) (contract.DeviceResource, bool)
DeviceResource retrieves the specific DeviceResource instance from cache according to the Device name and Device Resource name
func (*DeviceService) Devices ¶ added in v1.3.0
func (s *DeviceService) Devices() []contract.Device
Devices return all managed Devices from cache
func (*DeviceService) GetDeviceByName ¶ added in v1.3.0
func (s *DeviceService) GetDeviceByName(name string) (contract.Device, error)
GetDeviceByName returns the Device by its name if it exists in the cache, or returns an error.
func (*DeviceService) GetProvisionWatcherByName ¶ added in v1.3.0
func (s *DeviceService) GetProvisionWatcherByName(name string) (contract.ProvisionWatcher, error)
GetProvisionWatcherByName returns the Watcher by its name if it exists in the cache, or returns an error.
func (*DeviceService) Initialize ¶ added in v1.3.0
func (s *DeviceService) Initialize(serviceName, serviceVersion string, proto interface{})
TODO: remove common.xxx = xxx assignment after refactor are done.
func (*DeviceService) Name ¶ added in v1.3.0
func (s *DeviceService) Name() string
Name returns the name of this Device Service
func (*DeviceService) ProvisionWatchers ¶ added in v1.3.0
func (s *DeviceService) ProvisionWatchers() []contract.ProvisionWatcher
ProvisionWatchers return all managed Watchers from cache
func (*DeviceService) RemoveDevice ¶ added in v1.3.0
func (s *DeviceService) RemoveDevice(id string) error
RemoveDevice removes the specified Device by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*DeviceService) RemoveDeviceByName ¶ added in v1.3.0
func (s *DeviceService) RemoveDeviceByName(name string) error
RemoveDevice removes the specified Device by name from the cache and ensures that the instance in Core Metadata is also removed.
func (*DeviceService) RemoveDeviceProfile ¶ added in v1.3.0
func (s *DeviceService) RemoveDeviceProfile(id string) error
RemoveDeviceProfile removes the specified DeviceProfile by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*DeviceService) RemoveDeviceProfileByName ¶ added in v1.3.0
func (s *DeviceService) RemoveDeviceProfileByName(name string) error
RemoveDeviceProfileByName removes the specified DeviceProfile by name from the cache and ensures that the instance in Core Metadata is also removed.
func (*DeviceService) RemoveProvisionWatcher ¶ added in v1.3.0
func (s *DeviceService) RemoveProvisionWatcher(id string) error
RemoveProvisionWatcher removes the specified Watcher by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*DeviceService) ResourceOperation ¶ added in v1.3.0
func (s *DeviceService) ResourceOperation(deviceName string, deviceResource string, method string) (contract.ResourceOperation, bool)
ResourceOperation retrieves the first matched ResourceOpereation instance from cache according to the Device name, Device Resource name, and the method (get or set).
func (*DeviceService) Stop ¶ added in v1.3.0
func (s *DeviceService) Stop(force bool)
Stop shuts down the Service
func (*DeviceService) UpdateDevice ¶ added in v1.3.0
func (s *DeviceService) UpdateDevice(device contract.Device) error
UpdateDevice updates the Device in the cache and ensures that the copy in Core Metadata is also updated.
func (*DeviceService) UpdateDeviceOperatingState ¶ added in v1.3.0
func (s *DeviceService) UpdateDeviceOperatingState(deviceName string, state string) error
UpdateDeviceOperatingState updates the Device's OperatingState with given name in Core Metadata and device service cache.
func (*DeviceService) UpdateDeviceProfile ¶ added in v1.3.0
func (s *DeviceService) UpdateDeviceProfile(profile contract.DeviceProfile) error
UpdateDeviceProfile updates the DeviceProfile in the cache and ensures that the copy in Core Metadata is also updated.
func (*DeviceService) UpdateFromContainer ¶ added in v1.3.0
func (s *DeviceService) UpdateFromContainer(r *mux.Router, dic *di.Container)
func (*DeviceService) UpdateProvisionWatcher ¶ added in v1.3.0
func (s *DeviceService) UpdateProvisionWatcher(watcher contract.ProvisionWatcher) error
UpdateProvisionWatcher updates the Watcher in the cache and ensures that the copy in Core Metadata is also updated.
func (*DeviceService) Version ¶ added in v1.3.0
func (s *DeviceService) Version() string
Version returns the version number of this Device Service