Gammu internals  1.38.0
blue_w32.h
Go to the documentation of this file.
1 #ifndef __blue_w32_h
2 #define __blue_w32_h
3 
4 #include <winsock2.h>
5 /* MS Platform SDK */
6 
7 #include <pshpack1.h> // Without it compiled code hangs up BT stack
8 
9 typedef ULONGLONG BTH_ADDR, *PBTH_ADDR;
10 
11 #define NAP_BIT_OFFSET (8 * 4)
12 #define SAP_BIT_OFFSET (0)
13 #define GET_BYTE(num, byte) (unsigned int)((num >> (8 * byte)) & 0xff)
14 
15 #ifdef __BORLANDC__
16 #define NAP_MASK 0xFFFF00000000LL
17 #define SAP_MASK 0x0000FFFFFFFFL
18 
19 #define GET_NAP(_bth_addr) ((ULONGLONG) ((_bth_addr) >> NAP_BIT_OFFSET))
20 #define GET_SAP(_bth_addr) ((ULONGLONG) (((_bth_addr) & SAP_MASK) >> SAP_BIT_OFFSET))
21 #else
22 #define NAP_MASK 0xFFFF00000000LL
23 #define SAP_MASK 0x0000FFFFFFFFLL
24 
25 #define GET_NAP(_bth_addr) ((ULONGLONG) (((_bth_addr) & NAP_MASK) >> NAP_BIT_OFFSET))
26 #define GET_SAP(_bth_addr) ((ULONGLONG) (((_bth_addr) & SAP_MASK) >> SAP_BIT_OFFSET))
27 #endif
28 
29 #ifndef AF_BTH
30 #define AF_BTH 32
31 #endif
32 
33 typedef struct _SOCKADDR_BTH {
34  USHORT addressFamily; // Always AF_BTH
35  BTH_ADDR btAddr; // Bluetooth device address
36  GUID serviceClassId; // [OPTIONAL] system will query SDP for port
37  ULONG port; // RFCOMM channel or L2CAP PSM
39 
40 #define BTHPROTO_RFCOMM 0x0003
41 
42 #ifdef BLUETOOTH_RF_SEARCHING
43 
44 #ifndef NS_BTH
45 # define NS_BTH 16
46 #endif
47 
48 #endif
49 #endif
50 
51 /* How should editor hadle tabs in this file? Add editor commands here.
52  * vim: noexpandtab sw=8 ts=8 sts=8:
53  */
ULONG port
Definition: blue_w32.h:37
struct _SOCKADDR_BTH SOCKADDR_BTH
ULONGLONG * PBTH_ADDR
Definition: blue_w32.h:9
ULONGLONG BTH_ADDR
Definition: blue_w32.h:9
BTH_ADDR btAddr
Definition: blue_w32.h:35
struct _SOCKADDR_BTH * PSOCKADDR_BTH
GUID serviceClassId
Definition: blue_w32.h:36
USHORT addressFamily
Definition: blue_w32.h:34