KNX IoT
KNX IoT Point API stack implementation
oc_client_state.h File Reference

CoAP client. More...

#include "messaging/coap/constants.h"
#include "oc_endpoint.h"
#include "oc_ri.h"
#include <stdbool.h>
#include "oc_blockwise.h"

Go to the source code of this file.

Data Structures

struct  oc_client_cb_t
 client callback information More...
 
struct  oc_client_handler_t
 client handler information More...
 
struct  oc_client_response_t
 Client response information. More...
 

Typedefs

typedef struct oc_client_cb_t oc_client_cb_t
 client callback information More...
 
typedef struct oc_client_handler_t oc_client_handler_t
 client handler information More...
 
typedef oc_discovery_flags_t(* oc_discovery_all_handler_t) (const char *, int len, oc_endpoint_t *endpoint, void *)
 discovery_all handler More...
 
typedef oc_discovery_flags_t(* oc_discovery_handler_t) (const char *, int len, const char *, oc_string_array_t, oc_interface_mask_t, oc_endpoint_t *, oc_resource_properties_t, void *)
 
typedef void(* oc_response_handler_t) (oc_client_response_t *)
 client response handler More...
 

Enumerations

enum  oc_discovery_flags_t { OC_STOP_DISCOVERY = 0 , OC_CONTINUE_DISCOVERY }
 discovery flags More...
 
enum  oc_qos_t { HIGH_QOS = 0 , LOW_QOS }
 Quality of Service. More...
 

Functions

oc_client_cb_toc_ri_alloc_client_cb (const char *uri, oc_endpoint_t *endpoint, oc_method_t method, const char *query, oc_client_handler_t handler, oc_qos_t qos, void *user_data)
 allocate the client callback information More...
 
oc_client_cb_toc_ri_find_client_cb_by_mid (uint16_t mid)
 find the client callback info by message id (mid) More...
 
oc_client_cb_toc_ri_find_client_cb_by_token (uint8_t *token, uint8_t token_len)
 find the client callback info by token More...
 
void oc_ri_free_client_cbs_by_endpoint (oc_endpoint_t *endpoint)
 free the client callback information by endpoint More...
 
void oc_ri_free_client_cbs_by_mid (uint16_t mid)
 free the client callback information by message id (mid) More...
 
oc_client_cb_toc_ri_get_client_cb (const char *uri, oc_endpoint_t *endpoint, oc_method_t method)
 retrieve the client callback information More...
 
bool oc_ri_invoke_client_cb (void *response, oc_blockwise_state_t **response_state, oc_client_cb_t *cb, oc_endpoint_t *endpoint)
 invoke the Client callback when a response is received More...
 
bool oc_ri_is_client_cb_valid (oc_client_cb_t *client_cb)
 is the client callback information valid More...
 
oc_discovery_flags_t oc_ri_process_discovery_payload (uint8_t *payload, int len, oc_client_handler_t handler, oc_endpoint_t *endpoint, oc_content_format_t content, void *user_data)
 handle the discovery payload (e.g. More...
 

Detailed Description

CoAP client.

Definition in file oc_client_state.h.

Typedef Documentation

◆ oc_client_cb_t

client callback information

◆ oc_client_handler_t

client handler information

◆ oc_discovery_all_handler_t

typedef oc_discovery_flags_t(* oc_discovery_all_handler_t) (const char *, int len, oc_endpoint_t *endpoint, void *)

discovery_all handler

Definition at line 80 of file oc_client_state.h.

◆ oc_response_handler_t

typedef void(* oc_response_handler_t) (oc_client_response_t *)

client response handler

Definition at line 91 of file oc_client_state.h.

Enumeration Type Documentation

◆ oc_discovery_flags_t

discovery flags

Enumerator
OC_STOP_DISCOVERY 

stop discovering (also no more data)

OC_CONTINUE_DISCOVERY 

continue discovering (more data)

Definition at line 71 of file oc_client_state.h.

71  {
72  OC_STOP_DISCOVERY = 0,
oc_discovery_flags_t
discovery flags
@ OC_CONTINUE_DISCOVERY
continue discovering (more data)
@ OC_STOP_DISCOVERY
stop discovering (also no more data)

◆ oc_qos_t

enum oc_qos_t

Quality of Service.

Enumerator
HIGH_QOS 

confirmable messages

LOW_QOS 

non-confirmable messages

Definition at line 43 of file oc_client_state.h.

43  {
44  HIGH_QOS = 0,
45  LOW_QOS
46 } oc_qos_t;
oc_qos_t
Quality of Service.
@ HIGH_QOS
confirmable messages
@ LOW_QOS
non-confirmable messages

Function Documentation

◆ oc_ri_alloc_client_cb()

oc_client_cb_t* oc_ri_alloc_client_cb ( const char *  uri,
oc_endpoint_t endpoint,
oc_method_t  method,
const char *  query,
oc_client_handler_t  handler,
oc_qos_t  qos,
void *  user_data 
)

allocate the client callback information

Parameters
urithe uri to be called
endpointthe endpoint of the device
methodthe method to be used
querythe query parameters to be used
handlerthe callback when data arrives
qosquality of service level
user_datauser data to be provided with the invocation of the callback
Returns
oc_client_cb_t* the client callback info

◆ oc_ri_find_client_cb_by_mid()

oc_client_cb_t* oc_ri_find_client_cb_by_mid ( uint16_t  mid)

find the client callback info by message id (mid)

Parameters
midthe message id
Returns
oc_client_cb_t* the client callback info

◆ oc_ri_find_client_cb_by_token()

oc_client_cb_t* oc_ri_find_client_cb_by_token ( uint8_t *  token,
uint8_t  token_len 
)

find the client callback info by token

Parameters
tokenthe token
token_lenthe token length
Returns
oc_client_cb_t* the client callback info

◆ oc_ri_free_client_cbs_by_endpoint()

void oc_ri_free_client_cbs_by_endpoint ( oc_endpoint_t endpoint)

free the client callback information by endpoint

Parameters
endpointthe endpoint

◆ oc_ri_free_client_cbs_by_mid()

void oc_ri_free_client_cbs_by_mid ( uint16_t  mid)

free the client callback information by message id (mid)

Parameters
midthe message id

◆ oc_ri_get_client_cb()

oc_client_cb_t* oc_ri_get_client_cb ( const char *  uri,
oc_endpoint_t endpoint,
oc_method_t  method 
)

retrieve the client callback information

Parameters
urithe uri for the callback
endpointthe endpoint for the callback
methodthe used method
Returns
oc_client_cb_t* the client callback info

◆ oc_ri_invoke_client_cb()

bool oc_ri_invoke_client_cb ( void *  response,
oc_blockwise_state_t **  response_state,
oc_client_cb_t cb,
oc_endpoint_t endpoint 
)

invoke the Client callback when a response is received

Parameters
responsethe response
response_statethe state of the block-wise transfer
cbthe callback
endpointthe endpoint
Returns
true
false

◆ oc_ri_is_client_cb_valid()

bool oc_ri_is_client_cb_valid ( oc_client_cb_t client_cb)

is the client callback information valid

Parameters
client_cbthe client callback information
Returns
true is correct
false is incomplete

◆ oc_ri_process_discovery_payload()

oc_discovery_flags_t oc_ri_process_discovery_payload ( uint8_t *  payload,
int  len,
oc_client_handler_t  handler,
oc_endpoint_t endpoint,
oc_content_format_t  content,
void *  user_data 
)

handle the discovery payload (e.g.

parse the response and do the callbacks)

Parameters
payloadthe received discovery response
lenthe length of the payload
handlerthe handler of the discovery
endpointthe endpoint
contentthe content format of the payload
user_datathe user data to be supplied to the handler
Returns
oc_discovery_flags_t the discovery flags (e.g. more to come)