Menu

Can I get right remote device address?

Help
aptc
2007-10-04
2013-04-25
  • aptc

    aptc - 2007-10-04

    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

     
    • blam

      blam - 2007-10-04

      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);

       
    • aptc

      aptc - 2007-10-04

      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!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.