static const uint8_t spp_service_record[] =
{
/* 1.ServiceClassIDList */
SDP_DES_SIZE8, 0x8,
SDP_UINT16, BT_ATTRIBUTE_SERVICE_CLASS_ID_LIST>>8&0xff, BT_ATTRIBUTE_SERVICE_CLASS_ID_LIST&0xff, /* Service class ID list attribute */
SDP_DES_SIZE8, 3,
SDP_UUID16, BT_SERVICE_CLASS_SERIAL_PORT>>8&0xff, BT_SERVICE_CLASS_SERIAL_PORT&0xff,
/* 2.ProtocolDescriptorList */
SDP_DES_SIZE8, 0x11,
SDP_UINT16, BT_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST>>8&0xff, BT_ATTRIBUTE_PROTOCOL_DESCRIPTOR_LIST&0xff,/* Protocol descriptor list attribute */
SDP_DES_SIZE8, 0xc,
SDP_DES_SIZE8, 0x3,
SDP_UUID16, BT_PROTOCOL_L2CAP>>8&0xff, BT_PROTOCOL_L2CAP&0xff, /*L2CAP*/
SDP_DES_SIZE8, 0x5,
SDP_UUID16, BT_PROTOCOL_RFCOMM>>8&0xff, BT_PROTOCOL_RFCOMM&0xff, /*RFCOMM*/
SDP_UINT8, RFCOMM_SPP_SERVER_CHNL, /*RFCOMM channel*/
/* BluetoothProfileDescriptorList */
SDP_DES_SIZE8, 0xd,
SDP_UINT16, BT_ATTRIBUTE_BLUETOOTH_PROFILE_DESCRIPTOR_LIST>>8&0xff, BT_ATTRIBUTE_BLUETOOTH_PROFILE_DESCRIPTOR_LIST&0xff, /* profile descriptor List */
SDP_DES_SIZE8, 0x8,
SDP_DES_SIZE8,0x06,
SDP_UUID16,BT_SERVICE_CLASS_SERIAL_PORT>>8&0xff, BT_SERVICE_CLASS_SERIAL_PORT&0xff,
SDP_UINT16,0x01,0x02, /* V1.2 */
};
基于AT蓝牙开发板硬件,实现经典蓝牙的SPP应用。通过SPP协议,两个蓝牙设备之间可以创建串口进行数据传输。在小数据量低速传输中比较实用,的确是一条老路了。