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

📄 nonbluez.h

📁 linux下bluetooth后台服务程序
💻 H
字号:
#ifndef __nonbluez_h__#define __nonbluez_h__typedef struct {  unsigned char iBytes[6];} __attribute__((packed)) TBluetoothAddress;struct TSCOSocketAddress {  sa_family_t       iSCOFamily;  TBluetoothAddress iSCOBluetoothAddress;};struct TRFCOMMSocketAddress {  sa_family_t       iRFCOMMFamily;  TBluetoothAddress iRFCOMMBluetoothAddress;  unsigned char     iRFCOMMChannel;};struct THCIDeviceRequirements {  unsigned short iDeviceID;  unsigned long  iDeviceOptions;};struct TSCOOptions {  unsigned short mtu;};#define SocketLevelSCO          17#define SCOOptions              1#define BluetoothProtocolHCI    1#define BluetoothProtocolSCO    2#define BluetoothProtocolRFCOMM	3#define HCISETSCAN	_IOW('H', 221, int)#define HciDeviceDisableScan    0#define HciDeviceScanInquiry    1#define HciDeviceScanPage       2static inline void BluetoothAddressToString(const TBluetoothAddress *aBluetoothAddress, char *aString){  sprintf(aString, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",                   aBluetoothAddress->iBytes[5],                    aBluetoothAddress->iBytes[4],                    aBluetoothAddress->iBytes[3],                    aBluetoothAddress->iBytes[2],                    aBluetoothAddress->iBytes[1],                    aBluetoothAddress->iBytes[0]);}static inline int HeX(int c){  if (c>='0' && c <= '9') return c-'0';  if (c>='a' && c <= 'f') return 10+(c-'a');  if (c>='A' && c <= 'F') return 10+(c-'A');  return 0;}static inline void StringToBluetoothAddress(const char *aString, TBluetoothAddress *aBluetoothAddress){  aBluetoothAddress->iBytes[5] = 16*HeX(aString[0])+HeX(aString[1]);  aBluetoothAddress->iBytes[4] = 16*HeX(aString[3])+HeX(aString[4]);  aBluetoothAddress->iBytes[3] = 16*HeX(aString[6])+HeX(aString[7]);  aBluetoothAddress->iBytes[2] = 16*HeX(aString[9])+HeX(aString[10]);  aBluetoothAddress->iBytes[1] = 16*HeX(aString[12])+HeX(aString[13]);  aBluetoothAddress->iBytes[0] = 16*HeX(aString[15])+HeX(aString[16]);}#define CopyBluetoothAddress(dst, src) memcpy((dst), (src), sizeof(TBluetoothAddress))#endif // __nonbluez_h__

⌨️ 快捷键说明

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