12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #ifndef __TUP_API_H
- #define __TUP_API_H
- #include "datatype.h"
- //#include "platform.h"
- //#include "lsapi_event.h"
- #define NW_API_EV_BASE 5000
- #define USER_EVENT_EXIT (NW_API_EV_BASE+12)
- #define USER_EVENT_TIMEOUT (NW_API_EV_BASE+13)
- #define USER_EVENT_LSB (NW_API_EV_BASE+14)
- #define USER_EVENT_UART (NW_API_EV_BASE+15)
- #define USER_EVENT_TONE (NW_API_EV_BASE+16)
- #define USER_ENENT_AGPS (NW_API_EV_BASE+17)
- #define USER_EVENT_PA (NW_API_EV_BASE+18)
- #define USER_EVENT_VAT (NW_API_EV_BASE+19)
- #define USER_EVENT_HTTP (NW_API_EV_BASE+20)
- #include "nwy_socket.h"
- #include "nwy_osi_api.h"
- typedef void (*MY_SOCK_CB)(void *param);
- typedef enum{
- TUP_STATUS_TRUE,
- TUP_STATUS_FALSE,
- TUP_STATUS_WAIT,
- TUP_STATUS_ONLINE
- }TUP_CONNECT_ENUM;
- typedef enum{
- CNNT_READY,
- CNNT_BUSY,
- CNNT_OK,
- CNNT_ERROR,
- CNNT_CLOSED,
- CNNT_TOUT
- }CNNT_ENUM;
- typedef struct{
- T_INT32 fd;
- T_UINT16 port;
- T_INT8 *saddr; //连接服务器地址
- T_UINT8 tupType;//连接类型 TUP_TCP TUP_UDP
- MY_SOCK_CB tupRecvCallBack; //连接回调
- T_UINT8 errno; //SOCK连接错误代码
- T_UINT16 stacksize;//连接时创建线程的栈分配大小
- struct sockaddr_in sockAddr;//UDP时使用
- CNNT_ENUM tupStatus; //连接状态或结果 0正在连接 1 连接成功,2连接失败 3连接断开
- T_UINT8 index; //做成模块,开给对外用户sock接口模块时使用
- // LSAPI_OSI_Timer_t *ptimer_t;//链接超时判断定时器
- T_UINT8 *defPara;//备用
- }TUPSEND_DEF;
- typedef struct{
- uint32_t id; /*!< event id **/
- uint32_t param1; /*!< parameter 1 **/
- uint32_t param2; /*!< parameter 2 **/
- uint32_t param3; /*!< parameter 3 **/
- }TUPEVENT_DEF;
- #define TUP_EVENT_SOCK_LINK_OK 1
- #define TUP_EVENT_SOCK_LINK_ERR 2
- #define TUP_EVENT_SOCK_LINK_TIMEOUT 3
- #define TUP_EVENT_SOCK_LINK_SERVER_SHUT 4
- #define TUP_EVENT_SOCK_LINK_RECV 5
- #define TUP_EVENT_SOCK_LINK_CLIENT_SHUT 6
- void trySendTup(T_UINT8 *data, T_UINT16 len, TUP_ENUM tup, TUPSEND_DEF *para);
- TUP_CONNECT_ENUM tryConnectTup(T_INT8 *seraddr, TUP_ENUM tup,TUPSEND_DEF *para);
- void tupParaSet(TUPSEND_DEF *para, T_UINT16 port, MY_SOCK_CB *callback,T_UINT16 stacksize);
- void showTupEventInfo(const char *name, T_UINT32 id,TUPSEND_DEF *para,char );
- void userCloseSocket(T_INT32 *fd);
- #endif
|