⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btsocket.h

📁 linux下bluetooth后台服务程序
💻 H
字号:
#ifndef _BTSOCKET_H_#define _BTSOCKET_H_#include <netdb.h>#include <bluetooth/bluetooth.h>#include <bluetooth/hci.h>#include <bluetooth/hci_lib.h>#include <bluetooth/rfcomm.h>#include "btdefines.h"/* do not intend to support multiple ttys for now, pppd always connects to /dev/rfcomm0 */#define BTS_TTY1	"/dev/rfcomm0"#define BTS_TTY2	"/dev/bluetooth/rfcomm/0"#define BTS_TTY_NAME_LEN	13/* to be used by pppd */#define BTS_TTY			BTS_TTY1#define BTS_TTY_ID		0/* socket readiness */#define BTS_TTY_NOTREADY	0#define BTS_TTY_READY		1struct sBTSocket {	bdaddr_t bdaddr;	int chan;	int sock;	int accsock;	char tty[BTS_TTY_NAME_LEN];};typedef struct sBTSocket *BTSocket;typedef const struct sBTSocket *cBTSocket;int BTSocketCompare(cBTSocket sk, const char* bdaddr, int chan, int *res);int BTSocketCreate(BTSocket* sk, const char* bdaddr, int chan);int BTSocketDestroy(BTSocket sk);int BTSocketListen(BTSocket sk, int chan);int BTSocketStopListen(BTSocket sk);int BTSocketAccept(BTSocket sk, int timeout);int BTSocketConnect(BTSocket sk, int timeout);int BTSocketIsConnected(cBTSocket sk, int timeout);int BTSocketSend(cBTSocket sk, const char* buf, int len, int *sent, int timeout);int BTSocketReceive(cBTSocket sk, char *buf, int len, int *received, int timeout);int BTSocketClose(BTSocket sk);int BTSocketCreateTTY(BTSocket sk);int BTSocketIsTTYReady(cBTSocket sk, int *ready);int BTSocketReleaseTTY(BTSocket sk);int BTSocketGetTTYName(cBTSocket sk, char *ttyname);int BTSocketGetAddress(cBTSocket sk, char *addr);int BTSocketGetChannel(cBTSocket sk, int *chan);#endif //_BTSOCKET_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -