ex

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
TMBOY
Date:
Tue Jul 18 16:54:45 2017 +0800
Revision:
47:9e361da97763
?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
TMBOY 47:9e361da97763 1 // Copyright 2017 Baidu Inc. All Rights Reserved.
TMBOY 47:9e361da97763 2 // Author: Su Hao (suhao@baidu.com)
TMBOY 47:9e361da97763 3 //
TMBOY 47:9e361da97763 4 // Description: The CoAP endpoint definitions.
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
TMBOY 47:9e361da97763 7 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H
TMBOY 47:9e361da97763 8
TMBOY 47:9e361da97763 9 #include "baidu_ca_internal.h"
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 #define LIFETIME_MAX_LEN (10)
TMBOY 47:9e361da97763 12
TMBOY 47:9e361da97763 13 /**
TMBOY 47:9e361da97763 14 * Endpoint registration parameters
TMBOY 47:9e361da97763 15 */
TMBOY 47:9e361da97763 16 typedef struct _baidu_ca_coap_endpoint_s {
TMBOY 47:9e361da97763 17 char* name_ptr; // Endpoint name
TMBOY 47:9e361da97763 18 bca_size_t name_len;
TMBOY 47:9e361da97763 19
TMBOY 47:9e361da97763 20 char* type_ptr; // Endpoint type
TMBOY 47:9e361da97763 21 bca_size_t type_len;
TMBOY 47:9e361da97763 22
TMBOY 47:9e361da97763 23 char* lifetime_ptr; // Endpoint lifetime in seconds. eg. "1200" = 1200 seconds
TMBOY 47:9e361da97763 24 bca_size_t lifetime_len;
TMBOY 47:9e361da97763 25
TMBOY 47:9e361da97763 26 bca_addr_t* address; // Endpoint address to be accessed by the server, optional, default NULL
TMBOY 47:9e361da97763 27 } bca_coap_ep_t, *bca_coap_ep_ptr;
TMBOY 47:9e361da97763 28
TMBOY 47:9e361da97763 29 /*
TMBOY 47:9e361da97763 30 * Create the endpoint.
TMBOY 47:9e361da97763 31 *
TMBOY 47:9e361da97763 32 * @Param hdlr, in, the global context for baidu ca
TMBOY 47:9e361da97763 33 * @Param name, in, the endpoint name
TMBOY 47:9e361da97763 34 * @Param type, in, the endpoint type
TMBOY 47:9e361da97763 35 * @Param lifetime, in, the lifetime of the endpoint
TMBOY 47:9e361da97763 36 * @Param addr, in, the endpoint address to be accessed by the server, optional, default NULL
TMBOY 47:9e361da97763 37 * @Return bca_coap_ep_ptr, the endpoint context pointer
TMBOY 47:9e361da97763 38 */
TMBOY 47:9e361da97763 39 BCA_INT bca_coap_ep_ptr bca_coap_ep_create(const char* name,
TMBOY 47:9e361da97763 40 const char* type,
TMBOY 47:9e361da97763 41 bca_u32_t lifetime,
TMBOY 47:9e361da97763 42 const bca_addr_t* addr);
TMBOY 47:9e361da97763 43
TMBOY 47:9e361da97763 44
TMBOY 47:9e361da97763 45 /*
TMBOY 47:9e361da97763 46 * Destroy the endpoint that created by ${link bca_coap_ep_create}.
TMBOY 47:9e361da97763 47 *
TMBOY 47:9e361da97763 48 * @Param hdlr, in, the global context for baidu ca
TMBOY 47:9e361da97763 49 * @Param ptr, in, the endpoint context pointer
TMBOY 47:9e361da97763 50 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 51 */
TMBOY 47:9e361da97763 52 BCA_INT bca_status_t bca_coap_ep_destroy(bca_coap_ep_ptr ptr);
TMBOY 47:9e361da97763 53
TMBOY 47:9e361da97763 54 #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_COAP_EP_H