extperipheral

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package extperipheral provides helper functions for creating peripheral extensions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(logger log.Interface, unmarshal types.UnmarshalFunc, impl PeripheralConnector) types.Handler

Types

type Handler

type Handler struct {
	*util.BaseHandler
	// contains filtered or unexported fields
}

func (*Handler) HandleCmd

func (c *Handler) HandleCmd(
	ctx context.Context,
	id, seq uint64,
	kind arhatgopb.CmdType,
	payload []byte,
) (interface{}, error)

type Peripheral

type Peripheral interface {
	Operate(
		ctx context.Context,
		params map[string]string,
		data []byte,
	) ([][]byte, error)

	CollectMetrics(
		ctx context.Context,
		params map[string]string,
	) ([]*arhatgopb.PeripheralMetricsMsg_Value, error)

	Close(ctx context.Context)
}

type PeripheralConnector

type PeripheralConnector interface {
	Connect(
		ctx context.Context,
		target string,
		params map[string]string,
		tlsConfig *arhatgopb.TLSConfig,
	) (Peripheral, error)
}

Jump to

Keyboard shortcuts

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