Linux bluetooth development
 help / color / mirror / Atom feed
* [Bluez-devel] Erasure of records of previously discovered devices
@ 2005-04-07 13:49 Khoo Teck Ping
  2005-04-07 14:02 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Khoo Teck Ping @ 2005-04-07 13:49 UTC (permalink / raw)
  To: bluez-devel

[-- Attachment #1: Type: text/plain, Size: 1205 bytes --]

Dear all

I wrote a small c program to continuously inquire for nearby bluetooth devices and record their address, name and time of discovery. However, the program always seems to return a list of devices found earlier, even when the discovered device has been switched off. 

Following is part of the code, which does 5 rounds of inquiry, largely derived from Bastian Ballmann's hciscan program. Is there anyway I can erase records of previously found devices and do a fresh inquiry everytime? 

Thanks. 
Teck Ping



for(j = 1; j <= 5; j++)
  {
     for(i = 0; i < num_rsp; i++) 
     {
        memset(name, 0, sizeof(name));

        if(hci_read_remote_name(dd, &(info+i)->bdaddr, sizeof(name), name, 100000) < 0)
        {
           strcpy(name, "na");
        }   

        baswap(&bdaddr, &(info+i)->bdaddr);
        time_t now;
        time(&now);

        printf("%d\t%s\t%s\t%s", j, batostr(&bdaddr), name, ctime(&now));
        
        /*a+ will append text to the end of file*/
        ptr = fopen("data.txt", "a+");
           fprintf(ptr,"%d;%s;%s;%s", j, batostr(&bdaddr), name, ctime(&now));      
        fclose(ptr); /*close the opened file*/
     }
  }

[-- Attachment #2: Type: text/html, Size: 3012 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-07 14:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-07 13:49 [Bluez-devel] Erasure of records of previously discovered devices Khoo Teck Ping
2005-04-07 14:02 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox