xrt

package
v4.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchXRTResWithSubTimeout

func FetchXRTResWithSubTimeout(ctx context.Context, requestId string, requestMap RequestMap, subscribeTimeout time.Duration, response any) errors.EdgeX

FetchXRTResWithSubTimeout subscribe multiple messages of the same requestId for the given subscribe timeout, and the result will be appended in the response slice After the subscribe timeout, the response slice pointer will be returned

func FetchXRTResponse

func FetchXRTResponse(ctx context.Context, requestId string, requestMap RequestMap, responseTimeout time.Duration) ([]byte, errors.EdgeX)

func NewXrtClient

func NewXrtClient(ctx context.Context, messageBus messaging.MessageClient, requestTopic string, replyTopic string,
	responseTimeout time.Duration, lc logger.LoggingClient, clientOptions *ClientOptions) (interfaces.EdgeClient, errors.EdgeX)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client implements the client of MQTT management API, https://docs.iotechsys.com/edge-xrt21/mqtt-management/mqtt-management.html

func (*Client) AddDevice

func (c *Client) AddDevice(ctx context.Context, device dtos.Device) errors.EdgeX

func (*Client) AddDeviceProfile

func (c *Client) AddDeviceProfile(ctx context.Context, profile dtos.DeviceProfile) errors.EdgeX

func (*Client) AddDiscoveredDevice

func (c *Client) AddDiscoveredDevice(ctx context.Context, device dtos.Device) errors.EdgeX

AddDiscoveredDevice adds discovered device without profile, which means the device is not usable until the profile is set or generate by device:scan

func (*Client) AddSchedule

func (c *Client) AddSchedule(ctx context.Context, schedule xrtmodels.Schedule) errors.EdgeX

func (*Client) AllDeviceProfiles

func (c *Client) AllDeviceProfiles(ctx context.Context) ([]string, errors.EdgeX)

func (*Client) AllDevices

func (c *Client) AllDevices(ctx context.Context) ([]string, errors.EdgeX)

func (*Client) AllSchedules

func (c *Client) AllSchedules(ctx context.Context) ([]string, errors.EdgeX)

func (*Client) Close

func (c *Client) Close() errors.EdgeX

func (*Client) DeleteDeviceByName

func (c *Client) DeleteDeviceByName(ctx context.Context, name string) errors.EdgeX

func (*Client) DeleteDeviceProfileByName

func (c *Client) DeleteDeviceProfileByName(ctx context.Context, name string) errors.EdgeX

func (*Client) DeleteScheduleByName

func (c *Client) DeleteScheduleByName(ctx context.Context, name string) errors.EdgeX

func (*Client) DeviceByName

func (c *Client) DeviceByName(ctx context.Context, name string) (xrtmodels.DeviceInfo, errors.EdgeX)

func (*Client) DeviceProfileByName

func (c *Client) DeviceProfileByName(ctx context.Context, name string) (dtos.DeviceProfile, errors.EdgeX)

func (*Client) DiscoverComponents

func (c *Client) DiscoverComponents(ctx context.Context, category string, subscribeTimeout time.Duration) ([]xrtmodels.MultiComponentsResponse, errors.EdgeX)

func (*Client) ReadDeviceResources

func (c *Client) ReadDeviceResources(ctx context.Context, deviceName string, resourceNames []string) (xrtmodels.MultiResourcesResult, errors.EdgeX)

func (*Client) ScanDevice

func (c *Client) ScanDevice(ctx context.Context, device dtos.Device, options map[string]any) errors.EdgeX

ScanDevice checks a device profile for updates.

func (*Client) SetResponseTimeout

func (c *Client) SetResponseTimeout(responseTimeout time.Duration)

func (*Client) TriggerDiscovery

func (c *Client) TriggerDiscovery(ctx context.Context) errors.EdgeX

func (*Client) UpdateDevice

func (c *Client) UpdateDevice(ctx context.Context, device dtos.Device) errors.EdgeX

func (*Client) UpdateDeviceProfile

func (c *Client) UpdateDeviceProfile(ctx context.Context, profile dtos.DeviceProfile) errors.EdgeX

func (*Client) UpdateLuaScript

func (c *Client) UpdateLuaScript(ctx context.Context, luaScript string) errors.EdgeX

func (*Client) WriteDeviceResources

func (c *Client) WriteDeviceResources(ctx context.Context, deviceName string, resourceValuePairs, options map[string]any) errors.EdgeX

type ClientOptions

type ClientOptions struct {
	*CommandOptions
	*DiscoveryOptions
	*StatusOptions
}

func NewClientOptions

func NewClientOptions(commandOptions *CommandOptions, discoveryOptions *DiscoveryOptions, statusOptions *StatusOptions) *ClientOptions

type CommandOptions

type CommandOptions struct {
	CommandTopic            string
	DiscoveryTopic          string
	DiscoveryMessageHandler MessageHandler
}

CommandOptions provides the config for sending the request to manage components

func NewCommandOptions

func NewCommandOptions(commandTopic string, discoveryTopic string, discoveryMessageHandler MessageHandler) *CommandOptions

type DiscoveryOptions

type DiscoveryOptions struct {
	DiscoveryTopic           string
	DiscoveryMessageHandler  MessageHandler
	DiscoveryDuration        time.Duration
	DiscoveryTimeout         time.Duration
	ExtentedDiscoveryOptions map[string]any
}

DiscoveryOptions provides the config for sending the discovery request like discovery:trigger, device:scan

func NewDiscoveryOptions

func NewDiscoveryOptions(discoveryTopic string, discoveryMessageHandler MessageHandler, discoveryDuration, discoveryTimeout time.Duration) *DiscoveryOptions

func NewDiscoveryOptionsExtended

func NewDiscoveryOptionsExtended(discoveryTopic string, discoveryMessageHandler MessageHandler, discoveryDuration, discoveryTimeout time.Duration, extendedDiscoveryOptions map[string]any) *DiscoveryOptions

type MessageHandler

type MessageHandler func(message types.MessageEnvelope)

type RequestMap

type RequestMap interface {
	Add(id string)
	Get(id string) (chan []byte, bool)
	Delete(id string)
}

RequestMap maintains the mapping between requestId and command response channel of []byte type

func NewRequestMap

func NewRequestMap() RequestMap

type StatusOptions

type StatusOptions struct {
	StatusTopic          string
	StatusMessageHandler MessageHandler
}

StatusOptions provides the config for subscribing the XRT status

func NewStatusOptions

func NewStatusOptions(statusTopic string, statusMessageHandler MessageHandler) *StatusOptions

type Subscription

type Subscription struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL