65 lines
2.4 KiB
C
65 lines
2.4 KiB
C
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
#ifndef __N11_GPRS_H__
|
|
#define __N11_GPRS_H__
|
|
|
|
#define N11_CONN_TCP 1
|
|
#define N11_CONN_UDP 0
|
|
typedef void (*iot_n11_fn_rcv)(void *data, uint32_t dlen);
|
|
|
|
/**
|
|
* @brief iot_n11_gprs_establish_network_connection() - Establish a TCP|UDP
|
|
* connection.
|
|
* @param conn_type: 1 for TCP, 0 for UDP.
|
|
* @param dst_ipaddr: The destination ip address.
|
|
* @param port: The destination port number.
|
|
* @return ERR_FAIL -- Operation failed.
|
|
* @return ERR_OK -- Operation Successful.
|
|
*/
|
|
uint32_t iot_n11_gprs_establish_network_connection(uint8_t conn_type,
|
|
uint8_t *dst_ipaddr, uint32_t port);
|
|
|
|
/**
|
|
* @brief iot_n11_gprs_register_call_back() - Register an API to receive data
|
|
* from N11 chip.
|
|
* @param fn: Call back API. See iot_n11_fn_rcv.
|
|
* @return ERR_FAIL -- Operation failed.
|
|
* @return ERR_OK -- Operation Successful.
|
|
*/
|
|
uint32_t iot_n11_gprs_register_call_back(iot_n11_fn_rcv fn);
|
|
|
|
/**
|
|
* @brief iot_n11_gprs_send() - Send data to N11 chip.
|
|
* @param data: Data buffer to send.
|
|
* @param dlen: Length of data buffer to send.
|
|
* @return ERR_FAIL -- Operation failed.
|
|
* @return ERR_OK -- Operation Successful.
|
|
*/
|
|
uint32_t iot_n11_gprs_send(void *data, uint32_t dlen);
|
|
|
|
/**
|
|
* @brief iot_n11_gprs_reset() - Reset N11 chip. Call when always no response data
|
|
* from your connection.
|
|
*/
|
|
void iot_n11_gprs_reset(void);
|
|
|
|
/**
|
|
* @brief iot_n11_gprs_init() - Init this module.
|
|
* @return ERR_FAIL -- Operation failed.
|
|
* @return ERR_OK -- Operation Successful.
|
|
*/
|
|
uint32_t iot_n11_gprs_init(void);
|
|
|
|
#endif /* #define __N11_GPRS_H__ */ |