bthandler.h
来自「linux下bluetooth后台服务程序」· C头文件 代码 · 共 72 行
H
72 行
#ifndef _BTHANDLER_H_#define _BTHANDLER_H_#include "btutils.h"#include "btsocket.h"struct sBTApp { int state; int pid; char param[BT_PPP_PARAM_LEN]; struct sBTTimer removetr; struct sBTTimer ttytr; struct sBTTimer readytr; struct sBTTimer startretrytr; struct sBTTimer starttotaltr; int refcount;};typedef struct sBTApp BTApp;struct sBTConnection { BTSocket sock; int profile; int flags; char pin[BT_PIN_LEN]; int state; int error; //Buffer to keep data while connecting char* sendbuf; int sendbuflen; //Listen restart and total timeouts struct sBTTimer listenretrytr; struct sBTTimer listentotaltr; //Reconnect restart and total timeouts struct sBTTimer connectretrytr; struct sBTTimer connecttotaltr; //Bluetooth link removal timeout struct sBTTimer aclremovetr; //External app data BTApp ppp; //To speed up RIDER/GO connection times int reconnecting;};typedef struct sBTConnection *BTConnection;typedef const struct sBTConnection *cBTConnection;int BTHandlerCompare(cBTConnection con, const char *bdaddr, int chan, int profile, int *res);int BTHandlerCreate(BTConnection *con, const char *bdaddr, int chan, int profile, int flags, const char *pin);int BTHandlerDestroy(BTConnection con);int BTHandlerStartApp(BTConnection con, const char *param);int BTHandlerStopApp(BTConnection con);int BTHandlerSend(BTConnection con, const char *buf, int len, int *sent);int BTHandlerReceive(BTConnection con, char *buf, int len, int *received);int BTHandlerRelease(BTConnection con);int BTHandlerClose(BTConnection con);int BTHandlerGetState(cBTConnection con, int *state);int BTHandlerGetError(cBTConnection con, int *error);int BTHandlerSetFlags(BTConnection con, int flags);int BTHandlerGetFlags(cBTConnection con, int *flags);int BTHandlerIsProfileActive(cBTConnection con, int profile, int *res);int BTHandlerNeedPair(cBTConnection con, int *res);int BTHandlerRun(BTConnection con);#endif // _BTHANDLER_H_
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?