| Reply | « Previous Thread | Next Thread » |
|
Hi,
I am having a weired problem right now , and i am not sure how to handle this. But i am hoping that maybe some of guru here could help me. I am using winsocket to communicate with mobile through bluetooth , everything working fine when i am using my bluetooth dongle and it returned me code as A0 (OBEX SUCCESS)... But when i sent the same exe to some one else , he was using LG CE110 , and instead of connecting it was retruning error code as 74 or 60. i have made my custom obex which has the following information below.. Kindly help me and guide me how to do it...Thanks... #define MAX_PKT_SIZE 0x800 #define MAX_RECV_BUFF_LEN 2000 #define MAX_SEND_BUFF_LEN 1030 // OBEX Operation codes #define OBEX_PUT (BYTE)0x02 #define OBEX_PUT_FINAL (BYTE)0x82 #define OBEX_GET_FINAL (BYTE)0x83 #define OBEX_CONNECT (BYTE)0x80 #define OBEX_DISCONNECT (BYTE)0x81 #define OBEX_ABORT (BYTE)0xFF // OBEX Header codes #define OBEX_NAME (BYTE)0x01 #define OBEX_LENGTH (BYTE)0xC3 #define OBEX_DESCRIPTION (BYTE)0x05 #define OBEX_BODY (BYTE)0x48 #define OBEX_END_OF_BODY (BYTE)0x49 // OBEX Response codes #define OBEX_CONTINUE (BYTE)0x90 #define OBEX_SUCCESS (BYTE)0xA0 #define OBEX_VERSION (BYTE)0x10 #define OBEX_CONNECT_FLAGS (BYTE)0x00 ............... and here is my code where i am reciving this error Code: Code:
SOCKADDR_BTH sab;
memset(&sab,0,sizeof(sab));
sab.addressFamily = AF_BTH;
sab.serviceClassId = OBEXObjectPushServiceClass_UUID;
sab.btAddr = dev.Address.ullLong;
sab.port = (ULONG)BT_PORT_ANY;
sockaddr* pAddr = (sockaddr*)&sab;
if(0 == connect(s,pAddr,sizeof(SOCKADDR_BTH)))
{
BYTE dataBuff[MAX_SEND_BUFF_LEN];
BYTE recvBuff[MAX_RECV_BUFF_LEN];
dataBuff[0] = OBEX_CONNECT;
*((unsigned short*)&dataBuff[1]) = htons((unsigned short)0x11);
dataBuff[3] = OBEX_VERSION;
dataBuff[4] = OBEX_CONNECT_FLAGS;
*((unsigned short*)&dataBuff[5]) = htons((unsigned short)MAX_PKT_SIZE);
if(SOCKET_ERROR == send(s,(char*)dataBuff,0x11,0))
{
printf("Failed in Send during Connect\n");
WIN_DEBUG;
return false;
}
if(SOCKET_ERROR == recv(s,(char*)recvBuff,MAX_RECV_BUFF_LEN,0))
{
printf("Failed in Recv during Connect\n");
WIN_DEBUG;
return false;
}
if(recvBuff[0] == OBEX_SUCCESS)
{
NegotiatedPacketSize = ntohs(*((unsigned short*)&recvBuff[5]));
return true;
}
else
{
//HERE I AM RECIVING THE ERROR INSTEAD OF OBEX_SUCCESS
printf("Failed Connect, Code: %s\n",ToHex(recvBuff[0]).c_str());
return false;
}
}
else
{
printf("Failed in Connect\n");
WIN_DEBUG;
return false;
}
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|