mocktr181

package
v0.4.19 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput           = fmt.Errorf("invalid input")
	ErrInvalidFileInput       = fmt.Errorf("misconfigured file input")
	ErrUnableToReadFile       = fmt.Errorf("unable to read file")
	ErrInvalidPayload         = fmt.Errorf("invalid request payload")
	ErrInvalidResponsePayload = fmt.Errorf("invalid response payload")
)

Functions

This section is empty.

Types

type Handler

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

func New

func New(egress wrpkit.Handler, source string, opts ...Option) (*Handler, error)

New creates a new instance of the Handler struct. The parameter egress is the handler that will be called to send the response. The parameter source is the source to use in the response message.

func (Handler) Enabled

func (h Handler) Enabled() bool

func (Handler) HandleWrp

func (h Handler) HandleWrp(msg wrp.Message) error

HandleWrp is called to process a tr181 command

type MockParameter

type MockParameter struct {
	Name       string
	Value      string
	Access     string
	DataType   int // add json labels here
	Attributes map[string]interface{}
	Delay      int
}

type MockParameters

type MockParameters struct {
	Parameters []MockParameter
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option is a functional option type for mocktr181 Handler.

func Enabled

func Enabled(enabled bool) Option

func FilePath

func FilePath(filePath string) Option

Sets the file location for the mocktr181 data

type Parameter

type Parameter struct {
	Name       string                 `json:"name"`
	Value      string                 `json:"value"`
	DataType   int                    `json:"dataType"`
	Attributes map[string]interface{} `json:"attributes"`
	Message    string                 `json:"message"`
	Count      int                    `json:"parameterCount"`
}

type Parameters

type Parameters struct {
	Parameters []Parameter
}

type Tr181Payload

type Tr181Payload struct {
	Command    string      `json:"command"`
	Names      []string    `json:"names"`
	Parameters []Parameter `json:"parameters"`
	StatusCode int         `json:"statusCode"`
}

Jump to

Keyboard shortcuts

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