device

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExternalIPUpdater added in v0.0.4

func ExternalIPUpdater(ctx context.Context, status chan interface{})

func GetAPIEndpoint added in v1.0.0

func GetAPIEndpoint[T any](api API, endpoint string) T

GetAPIEndpoint is a helper function to assert an API endpoint as the appropriate type. We don't know what type of endpoint might be stored in the device API, so this function helps to safely establish the endpoint type.

func StoreAPIInContext added in v1.0.0

func StoreAPIInContext(ctx context.Context, a API) context.Context

StoreAPIInContext returns a new Context that embeds an API.

Types

type API added in v1.0.0

type API interface {
	SensorWorkers() []func(context.Context, chan interface{})
	EndPoint(string) interface{}
}

func FetchAPIFromContext added in v1.0.0

func FetchAPIFromContext(ctx context.Context) (API, error)

FetchAPIFromContext returns the API stored in ctx, or an error if there is none.

Jump to

Keyboard shortcuts

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