Documentation ¶
Index ¶
- Constants
- func CreateErrorResponse(ctx context.Context, code codes.Code, err error) (*pool.Message, error)
- func CreateResponseBadRequest(ctx context.Context, err error) (*pool.Message, error)
- func CreateResponseContent(ctx context.Context, data interface{}, code codes.Code) (*pool.Message, error)
- func CreateResponseContentWithCodec(ctx context.Context, codec coap.Codec, data interface{}, code codes.Code) (*pool.Message, error)
- func CreateResponseMethodNotAllowed(ctx context.Context, token message.Token) *pool.Message
- func GetETag() uint64
- func MergeCBORStructs(a ...interface{}) interface{}
- func ToUUID(id string) uuid.UUID
- func Unique(strSlice []string) []string
- type CreateSubscriptionFunc
- type GetHandlerFunc
- type PostHandlerFunc
- type Resource
- func (r *Resource) Close()
- func (r *Resource) ETag() []byte
- func (r *Resource) GetHref() string
- func (r *Resource) GetPolicyBitMask() schema.BitMask
- func (r *Resource) GetResourceInterfaces() []string
- func (r *Resource) GetResourceTypes() []string
- func (r *Resource) HandleRequest(req *net.Request) (*pool.Message, error)
- func (r *Resource) SetObserveHandler(loop *eventloop.Loop, createSubscription CreateSubscriptionFunc)
- func (r *Resource) SetResourceTypes(resourceTypes []string)
- func (r *Resource) SupportsOperations() SupportedOperation
- func (r *Resource) UpdateETag()
- type SupportedOperation
Constants ¶
View Source
const PublishToCloud schema.BitMask = 1 << 7
Variables ¶
This section is empty.
Functions ¶
func CreateErrorResponse ¶ added in v2.4.0
func CreateResponseContent ¶
func CreateResponseContentWithCodec ¶ added in v2.5.0
func MergeCBORStructs ¶
func MergeCBORStructs(a ...interface{}) interface{}
Types ¶
type CreateSubscriptionFunc ¶
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) GetPolicyBitMask ¶
func (*Resource) GetResourceInterfaces ¶
func (*Resource) GetResourceTypes ¶
func (*Resource) HandleRequest ¶
func (*Resource) SetObserveHandler ¶
func (r *Resource) SetObserveHandler(loop *eventloop.Loop, createSubscription CreateSubscriptionFunc)
func (*Resource) SetResourceTypes ¶ added in v2.5.0
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
Click to show internal directories.
Click to hide internal directories.