Internal Representation for Bluetooth Address (Windows Embedded CE 6.0)
1/6/2010
The BD_ADDR structure is used by all stack interfaces.
#pragma pack(push, 1)
typedef struct __bd_addr {
union {
struct {
unsigned int LAP : 24; // Lower address part
unsigned int UAP : 8; // Upper address part
};
unsigned int SAP; // Significant address part
};
unsigned short NAP; // Non-significant address part
} BD_ADDR;
#pragma pack(pop)
Note
Exposed user APIs, such as port emulation and Winsock interfaces, use another type called BT_ADDR, defined in ws2bth.h.
typedef ULONGLONG bt_addr, *pbt_addr, BT_ADDR, *PBT_ADDR;
The following code example shows how to convert the BT_ADDR type to BD_ADDR.
BD_ADDR bda = (BD_ADDR*)pbt;
Conversely, you can use the SET_NAP_SAP macro to convert a Bluetooth address stored in BD_ADDR to the BT_ADDR type. The following code example shows how to use SET_NAP_SAP.
BT_ADDR bta = SET_NAP_SAP(bda.NAP, bda.SAP);
See Also
Concepts
Common Layer Characteristics
Bluetooth Protocol Stack