Linux bluetooth development
 help / color / mirror / Atom feed
From: "Khoo Teck Ping" <eng10166@nus.edu.sg>
To: <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] Erasure of records of previously discovered devices
Date: Thu, 7 Apr 2005 21:49:29 +0800	[thread overview]
Message-ID: <001a01c53b78$a1e1c7d0$344914ac@stu.nus.edu.sg> (raw)

[-- 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 --]

             reply	other threads:[~2005-04-07 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-07 13:49 Khoo Teck Ping [this message]
2005-04-07 14:02 ` [Bluez-devel] Erasure of records of previously discovered devices Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001a01c53b78$a1e1c7d0$344914ac@stu.nus.edu.sg' \
    --to=eng10166@nus.edu.sg \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox