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 wrapper for user's transport.
TMBOY 47:9e361da97763 5
TMBOY 47:9e361da97763 6 #ifndef BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
TMBOY 47:9e361da97763 7 #define BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H
TMBOY 47:9e361da97763 8
TMBOY 47:9e361da97763 9 #include "baidu_ca_transport.h"
TMBOY 47:9e361da97763 10
TMBOY 47:9e361da97763 11 /*
TMBOY 47:9e361da97763 12 * Create the socket context.
TMBOY 47:9e361da97763 13 *
TMBOY 47:9e361da97763 14 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 15 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 16 */
TMBOY 47:9e361da97763 17 BCA_INT bca_status_t bca_trans_wrapper_create(bca_trans_ptr trans);
TMBOY 47:9e361da97763 18
TMBOY 47:9e361da97763 19 /*
TMBOY 47:9e361da97763 20 * Connect to the host.
TMBOY 47:9e361da97763 21 *
TMBOY 47:9e361da97763 22 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 23 * @Param addr, in, the target address infomations
TMBOY 47:9e361da97763 24 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 25 */
TMBOY 47:9e361da97763 26 BCA_INT bca_status_t bca_trans_wrapper_connect(bca_trans_ptr trans,
TMBOY 47:9e361da97763 27 const bca_addr_t* addr);
TMBOY 47:9e361da97763 28
TMBOY 47:9e361da97763 29 /*
TMBOY 47:9e361da97763 30 * Send data.
TMBOY 47:9e361da97763 31 *
TMBOY 47:9e361da97763 32 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 33 * @Param data, in, the data will be sent
TMBOY 47:9e361da97763 34 * @Param size, in, the data size
TMBOY 47:9e361da97763 35 * @Param addr, in, the target address infomations
TMBOY 47:9e361da97763 36 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 37 */
TMBOY 47:9e361da97763 38 BCA_INT bca_status_t bca_trans_wrapper_send(bca_trans_ptr trans,
TMBOY 47:9e361da97763 39 const void* data,
TMBOY 47:9e361da97763 40 bca_size_t size,
TMBOY 47:9e361da97763 41 const bca_addr_t* addr);
TMBOY 47:9e361da97763 42
TMBOY 47:9e361da97763 43 /*
TMBOY 47:9e361da97763 44 * Receive data.
TMBOY 47:9e361da97763 45 *
TMBOY 47:9e361da97763 46 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 47 * @Param data, out, the data will be read
TMBOY 47:9e361da97763 48 * @Param size, in, the data size
TMBOY 47:9e361da97763 49 * @Param addr, out, the target address infomations
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_trans_wrapper_recv(bca_trans_ptr trans,
TMBOY 47:9e361da97763 53 void* data,
TMBOY 47:9e361da97763 54 bca_size_t size,
TMBOY 47:9e361da97763 55 bca_addr_t* addr);
TMBOY 47:9e361da97763 56
TMBOY 47:9e361da97763 57 /*
TMBOY 47:9e361da97763 58 * Receive data.
TMBOY 47:9e361da97763 59 *
TMBOY 47:9e361da97763 60 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 61 * @Param data, out, the data will be read
TMBOY 47:9e361da97763 62 * @Param size, in, the data size
TMBOY 47:9e361da97763 63 * @Param timeout, in, the receive timeout
TMBOY 47:9e361da97763 64 * @Param addr, out, the target address infomations
TMBOY 47:9e361da97763 65 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 66 */
TMBOY 47:9e361da97763 67 BCA_INT bca_status_t bca_trans_wrapper_recv_timeout(bca_trans_ptr trans,
TMBOY 47:9e361da97763 68 void* data,
TMBOY 47:9e361da97763 69 bca_size_t size,
TMBOY 47:9e361da97763 70 bca_u32_t timeout,
TMBOY 47:9e361da97763 71 bca_addr_t* addr);
TMBOY 47:9e361da97763 72
TMBOY 47:9e361da97763 73 /*
TMBOY 47:9e361da97763 74 * Disconnect from the remote host.
TMBOY 47:9e361da97763 75 *
TMBOY 47:9e361da97763 76 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 77 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 78 */
TMBOY 47:9e361da97763 79 BCA_INT bca_status_t bca_trans_wrapper_close(bca_trans_ptr trans);
TMBOY 47:9e361da97763 80
TMBOY 47:9e361da97763 81 /*
TMBOY 47:9e361da97763 82 * Destroy the socket context.
TMBOY 47:9e361da97763 83 *
TMBOY 47:9e361da97763 84 * @Param hdlr, in, the context for the transport
TMBOY 47:9e361da97763 85 * @Return bca_status_t, the operation result
TMBOY 47:9e361da97763 86 */
TMBOY 47:9e361da97763 87 BCA_INT bca_status_t bca_trans_wrapper_destroy(bca_trans_ptr trans);
TMBOY 47:9e361da97763 88
TMBOY 47:9e361da97763 89 #endif // BAIDU_IOT_TINYDU_IOT_OS_SRC_IOT_BAIDU_CA_SOURCE_BAIDU_CA_TRANS_WRAPPER_H