Advertisement

05.26.2008 at 11:47AM PDT, ID: 23433149
[x]
Attachment Details

Bluetooth connectivity in Linux and C

Asked by epitsi in Bluetooth, C Programming Language

Tags: C, Bluetooth

I have a couple of mobile devices that also support Bluetooth connectivity, and after some searching on the Internet I have found out how to establish a connection with these devices from my laptop in Linux, and also assign them an IP address. Basically really quick the steps involved are:

hciconfig hci0 up
hcitool scan
pand --connect MAC_ADDRESS
ifconfig bnep0 192.168.100.100 netmask 255.255.255.0

After performing these steps I can successfully ping the device with "MAC_ADDRESS" at 192.168.100.101, as well as establish SSH and SFTP connections. The problem is that I want to create a piece of code in C that does all this automatically whenever a device is in range. One way to do this is to use the system function in C, execute the previous mentioned commands, redirect their output in files, parse the files, etc. Actually I have already implemented this but it looks really bad coding from my point of view, not to mention inefficient (having to read/write from files all the time). So my question is, can I do something like that using a library available for C in Linux? Main features I want is:

- Discovery of new BT devices in range, in frequent intervals
- Establish of connection when such a device is found
- Data exchange between the two devices as long as they are in range

Thanks for your help.Start Free Trial
[+][-]05.26.2008 at 09:12PM PDT, ID: 21649298

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Bluetooth, C Programming Language
Tags: C, Bluetooth
Sign Up Now!
Solution Provided By: sunnycoder
Participating Experts: 1
Solution Grade: B
 
 
[+][-]06.07.2008 at 11:12AM PDT, ID: 21736368

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628