resources

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: Apache-2.0 Imports: 24 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PublishToCloud schema.BitMask = 1 << 7

Variables

This section is empty.

Functions

func CreateErrorResponse added in v2.4.0

func CreateErrorResponse(ctx context.Context, code codes.Code, err error) (*pool.Message, error)

func CreateResponseBadRequest

func CreateResponseBadRequest(ctx context.Context, err error) (*pool.Message, error)

func CreateResponseContent

func CreateResponseContent(ctx context.Context, data interface{}, code codes.Code) (*pool.Message, error)

func CreateResponseContentWithCodec added in v2.5.0

func CreateResponseContentWithCodec(ctx context.Context, codec coap.Codec, data interface{}, code codes.Code) (*pool.Message, error)

func CreateResponseMethodNotAllowed

func CreateResponseMethodNotAllowed(ctx context.Context, token message.Token) *pool.Message

func GetETag

func GetETag() uint64

func MergeCBORStructs

func MergeCBORStructs(a ...interface{}) interface{}

func ToUUID

func ToUUID(id string) uuid.UUID

func Unique

func Unique(strSlice []string) []string

Types

type CreateSubscriptionFunc

type CreateSubscriptionFunc func(*net.Request, func(*pool.Message, error)) (func(), error)

type GetHandlerFunc

type GetHandlerFunc func(*net.Request) (*pool.Message, error)

type PostHandlerFunc

type PostHandlerFunc func(*net.Request) (*pool.Message, error)

type Resource

type Resource struct {
	Href               string
	ResourceInterfaces []string
	PolicyBitMask      schema.BitMask
	// contains filtered or unexported fields
}

func NewResource

func NewResource(href string, getHandler GetHandlerFunc, postHandler PostHandlerFunc, resourceTypes, resourceInterfaces []string) *Resource

func (*Resource) Close

func (r *Resource) Close()

Close closes resource and cancel all subscriptions

func (*Resource) ETag

func (r *Resource) ETag() []byte

func (*Resource) GetHref

func (r *Resource) GetHref() string

func (*Resource) GetPolicyBitMask

func (r *Resource) GetPolicyBitMask() schema.BitMask

func (*Resource) GetResourceInterfaces

func (r *Resource) GetResourceInterfaces() []string

func (*Resource) GetResourceTypes

func (r *Resource) GetResourceTypes() []string

func (*Resource) HandleRequest

func (r *Resource) HandleRequest(req *net.Request) (*pool.Message, error)

func (*Resource) SetObserveHandler

func (r *Resource) SetObserveHandler(loop *eventloop.Loop, createSubscription CreateSubscriptionFunc)

func (*Resource) SetResourceTypes added in v2.5.0

func (r *Resource) SetResourceTypes(resourceTypes []string)

func (*Resource) SupportsOperations added in v2.5.0

func (r *Resource) SupportsOperations() SupportedOperation

func (*Resource) UpdateETag

func (r *Resource) UpdateETag()

type SupportedOperation added in v2.5.0

type SupportedOperation int
const (
	SupportedOperationRead SupportedOperation = 0x1 << iota
	SupportedOperationWrite
	SupportedOperationObserve
)

func (SupportedOperation) HasOperation added in v2.5.0

func (o SupportedOperation) HasOperation(operation SupportedOperation) bool

Directories

Path Synopsis
secure

Jump to

Keyboard shortcuts

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