Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i install bluez on ubuntu for development?

Beginner Question:

I'd like to use the BlueZ driver in my Raspberry Pi for a simple way to connect to an iPhone app I'm writing, but I'm trying to prototype it first on my Ubuntu boot (I dual boot a macbook pro w/ macOS sierra/Ubuntu 16.04). I am having trouble getting the bluetooth header "bluetooth.h" to show up in my c program. I've tried doing sudo apt-get install bluez, but no bluetooth.h header shows up in my system after I perform this command. Here are the includes for my prototype application:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>

when I gcc the program, I link to -lbluetooth, but my system can't find that lib either.

I should be using BlueZ for this, right? I've read that BlueZ is the official bluetooth stack for Linux, and I plan to put Raspbian Jesse on my raspberry pi; I'm just sanity checking that I'm on the right path.

like image 812
iiian Avatar asked Nov 29 '16 18:11

iiian


1 Answers

http://docs.cubieboard.org/tutorials/common/development/bluez_programming

Looks like this tutorial had the answers, sudo apt-get install bluez installed the driver, but not the related development headers. Instead use sudo apt-get install bluez libbluetooth-dev. Now -lbluetooth is found as a lib.

like image 174
iiian Avatar answered Oct 12 '22 22:10

iiian