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, driver dsModels.ProtocolDriver, ...)
- type Bootstrap
- type Service
- func (s *Service) AddDevice(device contract.Device) (id string, err error)
- func (s *Service) AddDeviceProfile(profile contract.DeviceProfile) (id string, err error)
- func (s *Service) AddProvisionWatcher(watcher contract.ProvisionWatcher) (id string, err error)
- func (s *Service) AddRoute(route string, handler func(http.ResponseWriter, *http.Request), ...) error
- func (s *Service) AsyncReadings() bool
- func (s *Service) DeviceProfiles() []contract.DeviceProfile
- func (*Service) DeviceResource(deviceName string, deviceResource string, _ string) (contract.DeviceResource, bool)
- func (s *Service) Devices() []contract.Device
- func (s *Service) GetDeviceByName(name string) (contract.Device, error)
- func (s *Service) GetProvisionWatcherByName(name string) (contract.ProvisionWatcher, error)
- func (s *Service) Name() string
- func (s *Service) ProvisionWatchers() []contract.ProvisionWatcher
- func (s *Service) RemoveDevice(id string) error
- func (s *Service) RemoveDeviceByName(name string) error
- func (s *Service) RemoveDeviceProfile(id string) error
- func (*Service) RemoveDeviceProfileByName(name string) error
- func (s *Service) RemoveProvisionWatcher(id string) error
- func (*Service) ResourceOperation(deviceName string, deviceResource string, method string) (contract.ResourceOperation, bool)
- func (s *Service) Stop(force bool)
- func (s *Service) UpdateDevice(device contract.Device) error
- func (*Service) UpdateDeviceProfile(profile contract.DeviceProfile) error
- func (s *Service) UpdateProvisionWatcher(watcher contract.ProvisionWatcher) error
- func (s *Service) 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 Service ¶
type Service struct {
// contains filtered or unexported fields
}
A Service listens for requests and routes them to the right command
func RunningService ¶
func RunningService() *Service
RunningService returns the Service instance which is running
func (*Service) AddDevice ¶
AddDevice adds a new Device to the Device Service and Core Metadata Returns new Device id or non-nil error.
func (*Service) AddDeviceProfile ¶
func (s *Service) 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 (*Service) AddProvisionWatcher ¶
func (s *Service) 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 (*Service) AddRoute ¶
func (s *Service) 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 (*Service) AsyncReadings ¶
AsyncReadings returns a bool value to indicate whether the asynchronous reading is enabled.
func (*Service) DeviceProfiles ¶
func (s *Service) DeviceProfiles() []contract.DeviceProfile
DeviceProfiles return all managed DeviceProfiles from cache
func (*Service) DeviceResource ¶
func (*Service) 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 (*Service) GetDeviceByName ¶
GetDeviceByName returns the Device by its name if it exists in the cache, or returns an error.
func (*Service) GetProvisionWatcherByName ¶
func (s *Service) GetProvisionWatcherByName(name string) (contract.ProvisionWatcher, error)
GetProvisionWatcherByName returns the Watcher by its name if it exists in the cache, or returns an error.
func (*Service) ProvisionWatchers ¶
func (s *Service) ProvisionWatchers() []contract.ProvisionWatcher
ProvisionWatchers return all managed Watchers from cache
func (*Service) RemoveDevice ¶
RemoveDevice removes the specified Device by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*Service) RemoveDeviceByName ¶
RemoveDevice removes the specified Device by name from the cache and ensures that the instance in Core Metadata is also removed.
func (*Service) RemoveDeviceProfile ¶
RemoveDeviceProfile removes the specified DeviceProfile by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*Service) RemoveDeviceProfileByName ¶
RemoveDeviceProfileByName removes the specified DeviceProfile by name from the cache and ensures that the instance in Core Metadata is also removed.
func (*Service) RemoveProvisionWatcher ¶
RemoveProvisionWatcher removes the specified Watcher by id from the cache and ensures that the instance in Core Metadata is also removed.
func (*Service) ResourceOperation ¶
func (*Service) 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 (*Service) UpdateDevice ¶
UpdateDevice updates the Device in the cache and ensures that the copy in Core Metadata is also updated.
func (*Service) UpdateDeviceProfile ¶
func (*Service) UpdateDeviceProfile(profile contract.DeviceProfile) error
UpdateDeviceProfile updates the DeviceProfile in the cache and ensures that the copy in Core Metadata is also updated.
func (*Service) UpdateProvisionWatcher ¶
func (s *Service) UpdateProvisionWatcher(watcher contract.ProvisionWatcher) error
UpdateProvisionWatcher updates the Watcher in the cache and ensures that the copy in Core Metadata is also updated.