command

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingLastValue = errors.New("missing last value in mgw-last-value")
View Source
var ErrMissingLastValueCode = 513 //custom code to signify missing last-value in mgw-last-value

Functions

func StartKafkaCacheInvalidator added in v1.0.3

func StartKafkaCacheInvalidator(ctx context.Context, config configuration.Config) (err error)

Types

type BatchRequest

type BatchRequest []CommandMessage

func (BatchRequest) Validate

func (this BatchRequest) Validate() error

type BatchResultElement

type BatchResultElement struct {
	StatusCode int         `json:"status_code"`
	Message    interface{} `json:"message"`
}

type Command

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

func New

func New(ctx context.Context, config configuration.Config) (cmd *Command, err error)

func NewWithFactories

func NewWithFactories(ctx context.Context, config configuration.Config, comFactory interfaces.ComFactory, marshallerFactory interfaces.MarshallerFactory, iotFactory interfaces.IotFactory, timescaleFactory interfaces.TimescaleFactory) (cmd *Command, err error)

func (*Command) Batch

func (this *Command) Batch(token auth.Token, batch BatchRequest, timeout string, preferEventValue bool) []BatchResultElement

func (*Command) Command

func (this *Command) Command(token auth.Token, cmd CommandMessage, timeout string, preferEventValue bool) (code int, resp interface{})

func (*Command) DeviceCommand

func (this *Command) DeviceCommand(token auth.Token, deviceId string, serviceId string, functionId string, aspectId string, input interface{}, timeout string, preferEventValue bool, batch *eventbatch.EventBatch, characteristicId string) (code int, resp interface{})

func (*Command) ErrorMessageHandler

func (this *Command) ErrorMessageHandler(message messages.ProtocolMsg) error

func (*Command) GetEventBatch

func (this *Command) GetEventBatch(token auth.Token, tasks BatchRequest, preferEventValue bool) (batch *eventbatch.EventBatch, err error)

func (*Command) GetLastEventValue

func (this *Command) GetLastEventValue(token auth.Token, device model.Device, service model.Service, protocol model.Protocol, characteristicId string, functionId string, aspect model.AspectNode, eventBatch *eventbatch.EventBatch, timeout time.Duration) (code int, result interface{})

func (*Command) GetMetricsHttpHandler added in v1.0.11

func (this *Command) GetMetricsHttpHandler() *metrics.Metrics

func (*Command) GetSubTasks

func (this *Command) GetSubTasks(token string, deviceGroupId string, functionId string, aspectId string, deviceClassId string, input interface{}) (result []SubCommand, err error)

func (*Command) GroupCommand

func (this *Command) GroupCommand(token auth.Token, groupId string, functionId string, aspectId string, deviceClassId string, input interface{}, timeout string, preferEventValue bool, batch *eventbatch.EventBatch, characteristicId string) (code int, resp interface{})

func (*Command) HandleTaskResponse

func (this *Command) HandleTaskResponse(message messages.ProtocolMsg) (err error)

type CommandMessage

type CommandMessage struct {
	FunctionId string      `json:"function_id"`         //mandatory
	AspectId   string      `json:"aspect_id,omitempty"` //optional
	Input      interface{} `json:"input"`

	//device command
	DeviceId  string `json:"device_id,omitempty"`
	ServiceId string `json:"service_id,omitempty"`

	//group command
	GroupId string `json:"group_id,omitempty"`

	DeviceClassId    string `json:"device_class_id,omitempty"`
	CharacteristicId string `json:"characteristic_id,omitempty"`
}

func (CommandMessage) Hash

func (this CommandMessage) Hash() string

func (CommandMessage) Validate

func (this CommandMessage) Validate() error

type SubCommand

type SubCommand struct {
	FunctionId string `json:"function_id"` //mandatory
	AspectId   string
	Input      interface{} `json:"input"`
	DeviceId   string      `json:"device_id,omitempty"`
	ServiceId  string      `json:"service_id,omitempty"`
}

Directories

Path Synopsis
dependencies

Jump to

Keyboard shortcuts

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