12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #ifndef __TUP_API_H
- #define __TUP_API_H
- #include "datatype.h"
- #include "platform.h"
- #include "lsapi_event.h"
- #define USER_EVENT_EXIT (LS_API_EV_BASE+12)
- #define USER_EVENT_TIMEOUT (LS_API_EV_BASE+13)
- #define USER_EVENT_LSB (LS_API_EV_BASE+14)
- #define USER_EVENT_UART (LS_API_EV_BASE+15)
- #define USER_EVENT_USB (LS_API_EV_BASE+16)
- #define USER_EVENT_GPS (LS_API_EV_BASE+17)
- #define USER_ENENT_AGPS (LS_API_EV_BASE+18)
- #define USER_EVENT_VIBRAT (LS_API_EV_BASE+19)
- #define USER_EVENT_REC (LS_API_EV_BASE+20)
- #include "lsapi_sock.h"
- #include "lsapi_os.h"
- 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_ENUM;
- typedef struct{
- CNNT_ENUM tupStatus; //连接状态或结果 0正在连接 1 连接成功,2连接失败 3连接断开
- T_INT32 fd;
- T_UINT16 port;
- T_INT8 *saddr; //连接服务器地址
- T_UINT8 tupType;//连接类型 TUP_TCP TUP_UDP
- LSAPI_SOCK_Callback *tupRecvCallBack; //连接回调
- T_UINT8 failNo; //SOCK连接错误代码
- T_UINT16 stacksize;//连接时创建线程的栈分配大小
- LSAPI_SOCK_TcpipSocketAddr_t sockAddr;//UDP时使用
- T_UINT8 index; //做成模块,开给对外用户sock接口模块时使用
- LSAPI_OSI_Timer_t *ptimer_t;//链接超时判断定时器
- T_UINT8 *defPara;//备用
- }TUPSEND_DEF;
- 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, LSAPI_SOCK_Callback *callback,T_UINT16 stacksize);
- void showTupEventInfo(const char *name, T_UINT32 id,TUPSEND_DEF *para);
- void threadPostEvent(LSAPI_OSI_Thread_t *threadId, T_INT32 id,T_INT32 param1);
- void userExitThread(const char *name);
- #endif
|