From: thanit sara <sara200t@uregina.ca>
To: BlueZ users <bluez-users@lists.sourceforge.net>
Subject: [Bluez-users] How to access the RSSI value from the "inquiry_result_format_with_RSSI" (from newbie)
Date: Thu, 21 Aug 2008 17:03:38 -0500 [thread overview]
Message-ID: <BLU117-W323C2D9620C852EC69619ADF6B0@phx.gbl> (raw)
In-Reply-To: <3e9cdced0808200740p335fd2acq6c2e2aef891293f0@mail.gmail.com>
Dear all, I am trying to implement the code to get rssi values from near by devices. I have successfully changed the inquiry mode to be 0x01 and sent out the inquiry. I can see from the "Hci dump" that it is working, I can see the inquiry result with RSSI values. However, My problem is how can I get(/keep) those rssi values so that I can use them later on.I know there is a struct "inquiry_info_with_rssi", but what should I assign to this to get the response value.Please give me some hint so that I could move on. Your kindness is greatly appreciated.Below is my code.//Set up an event filter looking after the inquiry related events struct hci_filter InqFilter; hci_filter_clear(&InqFilter); hci_filter_set_ptype(HCI_EVENT_PKT, &InqFilter); hci_filter_set_event(EVT_INQUIRY_RESULT, &InqFilter); hci_filter_set_event(EVT_INQUIRY_RESULT_WITH_RSSI, &InqFilter); hci_filter_set_event(EVT_INQUIRY_COMPLETE, &InqFilter); if (setsockopt(sock, SOL_HCI, HCI_FILTER
, &InqFilter, sizeof(InqFilter)) < 0) { perror("Fail to setup filter!"); exit(1); } //***************************************************** //inquiry with the RSSI result inquiry_info_with_rssi read_rssi; //Note **I try to define this struct variable here, but not sure what to assign to it. write_inquiry_mode_cp cpp; cpp.mode = 0x01; //set inquiry mode int set_Inquiring = hci_send_cmd(sock, OGF_HOST_CTL, OCF_WRITE_INQUIRY_MODE, WRITE_INQUIRY_MODE_RP_SIZE, &cpp); inquiry_cp cp; cp.lap[0] =0x33; cp.lap[1] =0x8b; cp.lap[2] =0x9e; cp.length = 4; //=4*1.28second = 5seconds cp.num_rsp =0; //do inquiry int Inquiring = hci_send_cmd(sock, OGF_LINK_CTL,OCF_INQUIRY , INQUIRY_CP_SIZE, &cp); if (Inquiring < 0) { printf("starting to inquire: %d\n",Inquiring); exit(1); } else printf ("Done inquiry with RSSI!\n"); printf("rssi value = %d \n", read_rssi.rssi);
close( sock );//close socket//***************************************************** Best regards,Newbie
_________________________________________________________________
If you like crossword puzzles, then you'll love Flexicon, a game which combines four overlapping crossword puzzles into one!
http://g.msn.ca/ca55/208
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
prev parent reply other threads:[~2008-08-21 22:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 13:15 [Bluez-users] Problem with CreateBonding after update 3.31 -> 3.36 Fritz Code
2008-08-20 14:40 ` Fritz Code
2008-08-21 22:03 ` thanit sara [this message]
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=BLU117-W323C2D9620C852EC69619ADF6B0@phx.gbl \
--to=sara200t@uregina.ca \
--cc=bluez-users@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