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 ¶
const ( Online = "online" Offline = "offline" Unknown = "unknown" )
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 ¶
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.