📄 btutils.h
字号:
#ifndef _BTUTILS_H_#define _BTUTILS_H_#include <stdio.h>#include <signal.h>#include <sys/time.h>#define BTU_PROCBASE "/proc"#ifdef ENABLE_DEBUG_LOG#define DEBUG_LOG(fmt) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__,__FUNCTION__); fflush(stdout);}#define DEBUG_LOG1(fmt, p1) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1); fflush(stdout);}#define DEBUG_LOG2(fmt, p1, p2) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1, p2); fflush(stdout);}#define DEBUG_LOG3(fmt, p1, p2, p3) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1, p2, p3); fflush(stdout);}#define DEBUG_LOG4(fmt, p1, p2, p3, p4) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1, p2, p3, p4); fflush(stdout);}#define DEBUG_LOG5(fmt, p1, p2, p3, p4, p5) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1, p2, p3, p4, p5); fflush(stdout);}#define DEBUG_LOG6(fmt, p1, p2, p3, p4, p5, p6) { struct timeval tv; gettimeofday(&tv, NULL); printf("(%ld.%ld):", tv.tv_sec, tv.tv_usec); printf(__FILE__ "(%d): %s: " fmt "\n", (int)__LINE__, __FUNCTION__, p1, p2, p3, p4, p5, p6); fflush(stdout);}#else //ENABLE_DEBUG_LOG#define DEBUG_LOG(fmt) { }#define DEBUG_LOG1(fmt, p1) { }#define DEBUG_LOG2(fmt, p1, p2) { }#define DEBUG_LOG3(fmt, p1, p2, p3) { }#define DEBUG_LOG4(fmt, p1, p2, p3, p4) { }#define DEBUG_LOG5(fmt, p1, p2, p3, p4, p5) { }#define DEBUG_LOG6(fmt, p1, p2, p3, p4, p5, p6) { }#endif //ENABLE_DEBUG_LOGstruct sBTTimer { struct timeval start; struct timeval stop; unsigned int timeout;};typedef struct sBTTimer *BTTimer;int BTSendSig(char* procname, int sig);void BTSetTimer(BTTimer timer, unsigned int timeout);int BTTimerExpired(BTTimer timer);void BTEnablePageScan();void BTDisablePageScan();int BTIsAclLinkActive(char *bdaddrstr);void BTDestroyAclLink(char *bdaddrstr);int BTGetFileInt(const char* name);// Debug stuffchar* state2str(int state);char* error2str(int error);#endif //_BTUTILS_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -