deviceconnection

package
v0.47.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package deviceconnection is the task type "device_connection": it reads the connection state of the device selected for the task (SNRGY-5151). The output "result" is "online", "offline" or "unknown". The cloud reads it from device-repository, a gateway from the device-manager of the gateway. The state at the moment of the read is all it gives; a change between this read and a later wait for the connection event is not seen.

Index

Constants

View Source
const (
	Online  = "online"
	Offline = "offline"
	Unknown = "unknown"
)
View Source
const TaskType = "device_connection"

Variables

This section is empty.

Functions

This section is empty.

Types

type Devices

type Devices interface {
	ReadDevice(ctx context.Context, id string, token string, action devicerepomodel.AuthAction) (models.Device, error, int)
	ReadExtendedDevice(ctx context.Context, id string, token string, action devicerepomodel.AuthAction, fullDt bool) (models.ExtendedDevice, error, int)
}

Devices is the part of the device-repository client the task needs. The reads are not cached: the connection state is what changes.

type Gateway

type Gateway interface {
	State(ctx context.Context, localId string) (string, error)
}

Gateway reads the state at the device-manager of a gateway by local device id: online, offline or unknown.

type Type

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

func New

func New(devices Devices, tokens auth.UserTokenSource) *Type

New reads the state from device-repository with the token of the owner of the instance.

func NewLocal

func NewLocal(devices Devices, tokens auth.UserTokenSource, gateway Gateway) *Type

NewLocal reads the device from the mirror of device-repository on the gateway and its state at the device-manager; gateway is nil without a url of the device-manager.

func (*Type) Execute

func (this *Type) Execute(ctx context.Context, task engine.Task) (engine.TaskResult, error)

Jump to

Keyboard shortcuts

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