linux Bluetooth programming in c -


I'm trying to run a basic code in Linux [Ubuntu] to search for a Bluetooth device, but something The problem is facing. I have used the command to install sudo apt-get blues, it is saying that the blues is already the latest version but there is an error that is capable of finding bluetooth.h and other files is not. Is there a complete library package, or I am downloading this header file? I am following the link given below.

Perhaps you did not include the required header.

Here is an example code for scanning for Bluetooth devices

  #include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Unistd.h & gt; # Include & lt; Sys / socket.h & gt; # Include & lt; Bluetooth / bluetooth.h & gt; # Include & lt; Bluetooth / HCHHH & gt; # Include & lt; Bluetooth / hci_lib.h & gt; Int main (int argc, char ** argv) {inquiry_info * ii = null; Int max_rsp, num_rsp; Int dev_id, sock, lane, flags; Int i; Four letters [19] = {0}; Four names [248] = {0}; Dev_id = hci_get_route (NULL); Sock = hci_open_dev (dev_id); If (dev_id & lt; 0 || sock & lt; 0) {mirror ("opening socket"); Exit (1); } Lane = 8; Max_rsp = 255; Flags = IREQ_CACHE_FLUSH; Ii = (inquiry_info *) malloc (max_rsp * sizeof (inquiry_info)); Num_rsp = hci_inquiry (dev_id, len, max_rsp, null, and ii, flags); If (num_rsp & lt; 0) membrane ("hci_inquiry"); For (i = 0; i & lt; num_rsp; i ++) {ba2str (and (ii + i) -> BDADDR, edit); Memget (name, 0, size (name)); If (hci_read_remote_name (sock, & amp; (ii + i) - & gt; bdaddr, sizeof (name), name, 0) & lt; 0 strcpy (name, "[unknown]"); Printf ("% s% s \ n", Eder, name); } Free (ii); Closed (sock); Return 0; }   

To compile it on Linux, just do it

  GCC-O SimplexCcWW   

Edit:

The original code can be found in

Comments