From: Stephen K. <ste...@gm...> - 2007-08-17 15:52:45
|
Hi, I'm attempting to retrieve the bdaddr of a device which is sending a file with OBEX to the obexpushd daemon. I use OBEX_GetFD() and getpeername(). Here is the function i'm using: int get_bdaddr(obex_t *handle, char *str) { int fd; struct sockaddr_rc sa; socklen_t len = sizeof(sa); if( getpeername(handle,(struct sockaddr *)&sa,&len) < 0 ) return 0; ba2str(&sa.rc_bdaddr,str); printf("\n\tADDRESS: %s\n", str); printf("\tchannel: %d\n", sa.rc_channel); printf("\tfamily: %d\n", sa.rc_family); return 1; } and here is how I call the function from the code: if (intf & (1 << INTF_BLUETOOTH)) { fd = OBEX_GetFD(BT_HANDLE); printf("about to get_bdaddr...\n"); get=get_bdaddr(fd,str); printf("\n\tADDRESS2: %s\n", str); } The channel and family values appear to be correct (channel is 9) but the problem is that the address value is: 00:00:00:00:00 Does anybody know how I can get the actual bdaddr of the sending device? regards, Stephen. |