d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"KK Hung" <kkh...@avantwave.com> wrote in message
news:Ov0r7kbS...@TK2MSFTNGP11.phx.gbl...
SDP Binary Data Meaning
=============================================
0x09 0x00 0x01 Service Class ID List
0x35 0x03 Data Sequence [3 bytes]
0x19 0x11 0x05 OBEXObjectPushServiceClassID_UUID16 [0x1105]
0x09 0x00 0x04 Protocol Descriptor List
0x35 0x11 Data Sequence [17 bytes]
0x35 0x03 Protocol ID #0 [3 bytes]
0x19 0x01 0x00 L2CAP_PROTOCOL_UUID16 [0x0100]
0x35 0x05 Protocol ID #1 [5 bytes]
0x19 0x00 0x03 RFCOMM_PROTOCOL_UUID16 [0x0003]
0x08 0x01 Channel 1
0x35 0x03 Protocol ID #2 [3 bytes]
0x19 0x00 0x08 OBEX_PROTOCOL_UUID16 [0x0008]
0x09 0x01 0x00 Service Name
0x25 0x11 Text String [17 bytes]
0x4F 0x42 0x45 0x58 0x20 "OBEX Push Service"
0x50 0x75 0x73 0x68 0x20
0x53 0x65 0x72 0x76 0x69
0x63 0x65
0x09 0x00 0x09 Bluetooth Profile Descriptor List
0x35 0x08 Data Sequence [8 bytes]
0x35 0x06 Data Sequence [6 bytes]
0x19 0x11 0x05 OBEXObjectPushServiceClassID_UUID16 [0x1105]
0x09 0x01 0x00 Version 0x0100
0x09 0x03 0x03 Supported Formats List
0x35 0x02 Data Sequence [2 bytes]
0x08 0x01 vCard 2.1 [0x01]
"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message
news:ur#MdncSD...@tk2msftngp13.phx.gbl...
SEQUENCE
SEQUENCE
UUID (l2cap)
SEQUENCE
UUID (RFCOMM)
UINT8 (channel number)
SEQUENCE
UUID (OBEX)
where each indented line is an element of the sequence that has one less
indent. basically, a protocol descriptor list has a SEQUENCE where each
element in it is a PROTOCOL DESCRIPTOR LIST. A PROTOCOL DESCRIPTOR LIST is
defined as a SEQUENCE whose first element must be a UUID (any size) follow
by any number (including zero) optional elements of an type.
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"KK Hung" <kkh...@avantwave.com> wrote in message
news:eHFAVCdS...@TK2MSFTNGP11.phx.gbl...
0x09 0x00 0x04 Protocol Descriptor List
0x35 0x11 Data Sequence [17 bytes]
0x35 0x03 Protocol ID #0 [3 bytes] <======== Data Sequence
0x19 0x01 0x00 L2CAP_PROTOCOL_UUID16 [0x0100]
0x35 0x05 Protocol ID #1 [5 bytes] <======== Data Sequence
0x19 0x00 0x03 RFCOMM_PROTOCOL_UUID16 [0x0003]
0x08 0x01 Channel 1
0x35 0x03 Protocol ID #2 [3 bytes] <======== Data Sequence
0x19 0x00 0x08 OBEX_PROTOCOL_UUID16 [0x0008]
Thanks a lot for your kind help.
Yours,
KK
"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message
news:eHu$pxhSDH...@tk2msftngp13.phx.gbl...
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"KK Hung" <kkh...@avantwave.com> wrote in message
news:%23TAGQQn...@tk2msftngp13.phx.gbl...
"Doron Holan [MS]" <dor...@online.microsoft.com> wrote in message
news:#ao6UcpS...@tk2msftngp13.phx.gbl...
====== Source Code Attached ======
BTCon::Result
BTCon::Listen( char* pSDPRecord,
int sdpRecordSize)
{
int wsaResult;
int sockAddrLen;
WSAQUERYSET wsaQuerySet;
PBTH_SET_SERVICE pBTHSetService;
ULONG sdpVersion = BTH_SDP_VERSION;
HANDLE sdpRecordHandle = NULL;
BLOB blob;
Result result;
m_btSocket = socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
if (m_btSocket == INVALID_SOCKET)
{
DEBUG_MSG( DEBUG_AREA_BTCON,
DEBUG_LEVEL_WARNING,
"Listen: socket failed(%d)\n",
WSAGetLastError());
result = FAIL;
goto SocketFailed;
}
ZeroMemory(&m_sockAddr, sizeof(SOCKADDR_BTH));
m_sockAddr.addressFamily = AF_BTH;
m_sockAddr.port = BT_PORT_ANY;
wsaResult = bind( m_btSocket,
(struct sockaddr*)&m_sockAddr,
sizeof(SOCKADDR_BTH));
if (wsaResult == SOCKET_ERROR)
{
DEBUG_MSG( DEBUG_AREA_BTCON,
DEBUG_LEVEL_WARNING,
"Listen: bind failed(%d)\n",
WSAGetLastError());
result = FAIL;
goto BindFailed;
}
sockAddrLen = sizeof(SOCKADDR_BTH);
wsaResult = getsockname(m_btSocket,
(struct sockaddr*)&m_sockAddr,
&sockAddrLen);
if (wsaResult == SOCKET_ERROR)
{
DEBUG_MSG( DEBUG_AREA_BTCON,
DEBUG_LEVEL_WARNING,
"Listen: getsockname failed(%d)\n",
WSAGetLastError());
result = FAIL;
goto GetSockNameFailed;
}
printf("BTCon: channel %d assigned\n", m_sockAddr.port);
wsaResult = listen(m_btSocket, SOMAXCONN);
if (wsaResult == SOCKET_ERROR)
{
DEBUG_MSG( DEBUG_AREA_BTCON,
DEBUG_LEVEL_WARNING,
"Listen: listen failed(%d)\n",
WSAGetLastError());
result = FAIL;
goto ListenFailed;
}
ZeroMemory(&wsaQuerySet, sizeof(WSAQUERYSET));
wsaQuerySet.dwSize = sizeof(WSAQUERYSET);
wsaQuerySet.dwNameSpace = NS_BTH;
pBTHSetService = (PBTH_SET_SERVICE)malloc(sizeof(BTH_SET_SERVICE) +
sdpRecordSize);
if (pBTHSetService != NULL)
{
ZeroMemory(pBTHSetService, sizeof(BTH_SET_SERVICE));
pBTHSetService->pSdpVersion = &sdpVersion;
pBTHSetService->pRecordHandle = &sdpRecordHandle;
#if 0
SET_COD_MAJOR( pBTHSetService->fCodService,
COD_MAJOR_COMPUTER);
SET_COD_MINOR( pBTHSetService->fCodService,
COD_COMPUTER_MINOR_DESKTOP);
SET_COD_SERVICE(pBTHSetService->fCodService,
COD_SERVICE_OBJECT_XFER);
#else
pBTHSetService->fCodService = COD_SERVICE_OBJECT_XFER;
#endif
pBTHSetService->ulRecordLength = sdpRecordSize;
memcpy(pBTHSetService->pRecord, pSDPRecord, sdpRecordSize);
blob.cbSize = sizeof(BTH_SET_SERVICE) + sdpRecordSize - 1;
blob.pBlobData = (BYTE*)pBTHSetService;
wsaQuerySet.lpBlob = &blob;
}
wsaResult = WSASetService(&wsaQuerySet, RNRSERVICE_REGISTER, 0);
if (wsaResult == SOCKET_ERROR)
{
DEBUG_MSG( DEBUG_AREA_BTCON,
DEBUG_LEVEL_WARNING,
"Listen: WSASetService failed(%d)\n",
WSAGetLastError());
result = FAIL;
goto WSASetServiceFailed;
}
return SUCCESS;
/****** Error Part ******/
WSASetServiceFailed:
ListenFailed:
GetSockNameFailed:
BindFailed:
ASSERT(m_btSocket != INVALID_SOCKET);
closesocket(m_btSocket);
m_btSocket = INVALID_SOCKET;
SocketFailed:
AlreadyConnected:
return result;
}
====== Binary SDP Record ======
SDP Binary Data Meaning
=============================================
0x09 0x00 0x01 Service Class ID List
0x35 0x03 Data Sequence [3 bytes]
0x19 0x11 0x05 OBEXObjectPushServiceClassID_UUID16 [0x1105]
0x09 0x00 0x04 Protocol Descriptor List
0x35 0x11 Data Sequence [17 bytes]
0x35 0x03 Data Sequence [3 bytes]
0x19 0x01 0x00 L2CAP_PROTOCOL_UUID16 [0x0100]
0x35 0x05 Data Sequence [5 bytes]
0x19 0x00 0x03 RFCOMM_PROTOCOL_UUID16 [0x0003]
0x08 0x01 Channel 1
0x35 0x03 Data Sequence [3 bytes]
0x19 0x00 0x08 OBEX_PROTOCOL_UUID16 [0x0008]
0x09 0x01 0x00 Service Name
0x25 0x11 Text String [17 bytes]
0x4F 0x42 0x45 0x58 0x20 "OBEX Push Service"
0x50 0x75 0x73 0x68 0x20
0x53 0x65 0x72 0x76 0x69
0x63 0x65
0x09 0x00 0x09 Bluetooth Profile Descriptor List
0x35 0x08 Data Sequence [8 bytes]
0x35 0x06 Data Sequence [6 bytes]
0x19 0x11 0x05 OBEXObjectPushServiceClassID_UUID16 [0x1105]
0x09 0x01 0x00 Version 0x0100
0x09 0x03 0x03 Supported Formats List
0x35 0x02 Data Sequence [2 bytes]
0x08 0x01 vCard 2.1 [0x01]
"KK Hung" <kkh...@avantwave.com> wrote in message
news:O2CRZLqS...@TK2MSFTNGP12.phx.gbl...
d
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"KK Hung" <kkh...@avantwave.com> wrote in message
news:O2CRZLqS...@TK2MSFTNGP12.phx.gbl...