I want to know the client address when my obex server is receiving file. I find this data is stored in struct lb_customdata_t of function of btobexserver_trans_accept (the module name is btobexserver.c in lightblue), I inserted this simple sentence to see if the address is correct just after calling accept function:
it works except two wrong bytes in the bluetooth address, the first two bytes always are 1F:00 whatever the real values are. my cell phone's address is: "1A:00:66:50:BE:16", but I got "1F:00:66:50:BE:16", I have tried other devices but the result all were same, can you help me to get the right remote device address?
Thank you.
Junbao Wu
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have you tried using ba2str() instead? batostr() changes the byte ordering before converting the address whereas ba2str() does not. Something like this should work:
I want to know the client address when my obex server is receiving file. I find this data is stored in struct lb_customdata_t of function of btobexserver_trans_accept (the module name is btobexserver.c in lightblue), I inserted this simple sentence to see if the address is correct just after calling accept function:
customdata->fd = accept(customdata->serverfd, (struct sockaddr *) &customdata->rfcomm,
&addrlen);
printf("\n\tADDRESS: %s\n", batostr((struct sockaddr *)&customdata->rfcomm));
it works except two wrong bytes in the bluetooth address, the first two bytes always are 1F:00 whatever the real values are. my cell phone's address is: "1A:00:66:50:BE:16", but I got "1F:00:66:50:BE:16", I have tried other devices but the result all were same, can you help me to get the right remote device address?
Thank you.
Junbao Wu
Hi Junbao,
Have you tried using ba2str() instead? batostr() changes the byte ordering before converting the address whereas ba2str() does not. Something like this should work:
char buf[1024];
ba2str(&customdata->rfcomm.rc_bdaddr, buf);
printf("\n\tADDRESS: %s\n", buf);
It's great! it works!
I have used the ba2str before but I got the same wrong address.
Your message is so quick and so helpful, thank you so much!