coapconv

package
v2.21.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoapCodeToStatus

func CoapCodeToStatus(code codes.Code, operation Operation) commands.Status

func GetAccept

func GetAccept(opts message.Options) message.MediaType

GetAccept returns expected content format by client

func GetContentData

func GetContentData(opts message.Options, body io.Reader) (data []byte, contentFormat int32)

func GrpcErr2CoapCode

func GrpcErr2CoapCode(err error, operation Operation) coapCodes.Code

func MakeMediaType

func MakeMediaType(coapContentFormat int32, contentType string) (message.MediaType, error)

func NewCoapResourceCreateRequest

func NewCoapResourceCreateRequest(ctx context.Context, messagePool *pool.Pool, event *events.ResourceCreatePending) (*pool.Message, error)

func NewCoapResourceDeleteRequest

func NewCoapResourceDeleteRequest(ctx context.Context, messagePool *pool.Pool, event *events.ResourceDeletePending) (*pool.Message, error)

func NewCoapResourceRetrieveRequest

func NewCoapResourceRetrieveRequest(ctx context.Context, messagePool *pool.Pool, event *events.ResourceRetrievePending) (*pool.Message, error)

func NewCoapResourceUpdateRequest

func NewCoapResourceUpdateRequest(ctx context.Context, messagePool *pool.Pool, event *events.ResourceUpdatePending) (*pool.Message, error)

func NewCommandMetadata

func NewCommandMetadata(sequenceNumber uint64, connectionID string) *commands.CommandMetadata

func NewConfirmResourceCreateRequest

func NewConfirmResourceCreateRequest(resourceID *commands.ResourceId, correlationID, connectionID string, req *pool.Message) *commands.ConfirmResourceCreateRequest

func NewConfirmResourceDeleteRequest

func NewConfirmResourceDeleteRequest(resourceID *commands.ResourceId, correlationID, connectionID string, req *pool.Message) *commands.ConfirmResourceDeleteRequest

func NewConfirmResourceRetrieveRequest

func NewConfirmResourceRetrieveRequest(resourceID *commands.ResourceId, correlationID, connectionID string, req *pool.Message) *commands.ConfirmResourceRetrieveRequest

func NewConfirmResourceUpdateRequest

func NewConfirmResourceUpdateRequest(resourceID *commands.ResourceId, correlationID, connectionID string, req *pool.Message) *commands.ConfirmResourceUpdateRequest

func NewContent

func NewContent(opts message.Options, body io.Reader) *commands.Content

func NewCreateResourceRequest

func NewCreateResourceRequest(resourceID *commands.ResourceId, req *mux.Message, connectionID string) (*commands.CreateResourceRequest, error)

func NewDeleteResourceRequest

func NewDeleteResourceRequest(resourceID *commands.ResourceId, req *mux.Message, connectionID string) (*commands.DeleteResourceRequest, error)

func NewNotifyResourceChangedRequest

func NewNotifyResourceChangedRequest(resourceID *commands.ResourceId, resourceTypes []string, connectionID string, req *pool.Message) *commands.NotifyResourceChangedRequest

func NewNotifyResourceChangedRequestsFromBatchResourceDiscovery

func NewNotifyResourceChangedRequestsFromBatchResourceDiscovery(deviceID, connectionID string, req *pool.Message) ([]*commands.NotifyResourceChangedRequest, error)

func NewRetrieveResourceRequest

func NewRetrieveResourceRequest(resourceID *commands.ResourceId, req *mux.Message, connectionID string) (*commands.RetrieveResourceRequest, error)

func NewUpdateResourceRequest

func NewUpdateResourceRequest(resourceID *commands.ResourceId, req *mux.Message, connectionID string) (*commands.UpdateResourceRequest, error)

func StatusToCoapCode

func StatusToCoapCode(status commands.Status, operation Operation) codes.Code

func ToGrpcCode added in v2.6.0

func ToGrpcCode(code coapCodes.Code, def codes.Code) codes.Code

ToGrpcCode converts coap.Code to grpc.Code

func ToHTTPCode added in v2.6.0

func ToHTTPCode(code coapCodes.Code, def int) int

ToHTTPCode converts coap.Code to http.Status

Types

type EncodeFunc

type EncodeFunc = func(v interface{}) ([]byte, error)

func GetEncoder

func GetEncoder(accept message.MediaType) (EncodeFunc, error)

GetEncoder returns encoder by accept

type Operation

type Operation uint8
const (
	Create   Operation = 1
	Retrieve Operation = 2
	Update   Operation = 3
	Delete   Operation = 4
)

Jump to

Keyboard shortcuts

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