nRF5 SDK for Thread v0.9.0
Data Structures | Macros | Typedefs | Enumerations

This module includes functions that control CoAP communication. More...

Data Structures

struct  otCoapOption
 
struct  otCoapHeader
 
struct  otCoapResource
 

Macros

#define OT_DEFAULT_COAP_PORT   5683
 Default CoAP port, as specified in RFC 7252.
 
#define OT_COAP_HEADER_MAX_LENGTH   128
 Max CoAP header length (bytes)
 

Typedefs

typedef enum otCoapType otCoapType
 
typedef enum otCoapCode otCoapCode
 
typedef enum otCoapOptionType otCoapOptionType
 
typedef struct otCoapOption otCoapOption
 
typedef struct otCoapHeader otCoapHeader
 
typedef void(* otCoapResponseHandler )(void *aContext, otCoapHeader *aHeader, otMessage *aMessage, const otMessageInfo *aMessageInfo, ThreadError aResult)
 
typedef void(* otCoapRequestHandler )(void *aContext, otCoapHeader *aHeader, otMessage *aMessage, const otMessageInfo *aMessageInfo)
 
typedef struct otCoapResource otCoapResource
 

Enumerations

enum  otCoapType { kCoapTypeConfirmable = 0x00, kCoapTypeNonConfirmable = 0x10, kCoapTypeAcknowledgment = 0x20, kCoapTypeReset = 0x30 }
 
enum  otCoapCode {
  kCoapCodeEmpty = 0x00, kCoapRequestGet = 0x01, kCoapRequestPost = 0x02, kCoapRequestPut = 0x03,
  kCoapRequestDelete = 0x04, kCoapResponseCodeMin = 0x40, kCoapResponseCreated = 0x41, kCoapResponseDeleted = 0x42,
  kCoapResponseValid = 0x43, kCoapResponseChanged = 0x44, kCoapResponseContent = 0x45
}
 
enum  otCoapOptionType {
  kCoapOptionObserve = 6, kCoapOptionUriPath = 11, kCoapOptionContentFormat = 12, kCoapOptionMaxAge = 14,
  kCoapOptionUriQuery = 15
}
 

Detailed Description

This module includes functions that control CoAP communication.

Typedef Documentation

typedef enum otCoapCode otCoapCode

CoAP Code values.

typedef struct otCoapHeader otCoapHeader

This structure represents a CoAP header.

typedef struct otCoapOption otCoapOption

This structure represents a CoAP option.

CoAP Option Numbers

typedef void(* otCoapRequestHandler)(void *aContext, otCoapHeader *aHeader, otMessage *aMessage, const otMessageInfo *aMessageInfo)

This function pointer is called when a CoAP request with a given Uri-Path is received.

Parameters
[in]aContextA pointer to arbitrary context information.
[in]aHeaderA pointer to the CoAP header.
[in]aMessageA pointer to the message.
[in]aMessageInfoA pointer to the message info for aMessage.

This structure represents a CoAP resource.

typedef void(* otCoapResponseHandler)(void *aContext, otCoapHeader *aHeader, otMessage *aMessage, const otMessageInfo *aMessageInfo, ThreadError aResult)

This function pointer is called when a CoAP response is received or on the request timeout.

Parameters
[in]aContextA pointer to application-specific context.
[in]aHeaderA pointer to the received CoAP header. NULL if no response was received.
[in]aMessageA pointer to the message buffer containing the response. NULL if no response was received.
[in]aMessageInfoA pointer to the message info for aMessage. NULL if no response was received.
[in]aResultA result of the CoAP transaction.
Return values
kThreadError_NoneA response was received successfully.
kThreadError_AbortA CoAP transaction was reseted by peer.
kThreadError_ResponseTimeoutNo response or acknowledgment received during timeout period.
typedef enum otCoapType otCoapType

CoAP Type values.

Enumeration Type Documentation

enum otCoapCode

CoAP Code values.

Enumerator
kCoapCodeEmpty 

Empty message code.

kCoapRequestGet 

Get.

kCoapRequestPost 

Post.

kCoapRequestPut 

Put.

kCoapRequestDelete 

Delete.

kCoapResponseCodeMin 

2.00

kCoapResponseCreated 

Created.

kCoapResponseDeleted 

Deleted.

kCoapResponseValid 

Valid.

kCoapResponseChanged 

Changed.

kCoapResponseContent 

Content.

CoAP Option Numbers

Enumerator
kCoapOptionObserve 

Observe.

kCoapOptionUriPath 

Uri-Path.

kCoapOptionContentFormat 

Content-Format.

kCoapOptionMaxAge 

Max-Age.

kCoapOptionUriQuery 

Uri-Query.

enum otCoapType

CoAP Type values.

Enumerator
kCoapTypeConfirmable 

Confirmable.

kCoapTypeNonConfirmable 

Non-confirmable.

kCoapTypeAcknowledgment 

Acknowledgment.

kCoapTypeReset 

Reset.


Documentation feedback | Developer Zone | Subscribe | Updated