Start New Discussion within our Software Development Community

Hello everyone,

I'm working in Ubuntu right now trying to get some code working for a bluetooth dongle that I have connected. My goal is simply to communicate with another bluetooth device. I wrote some code using Bluez in Eclipse and I cannot seem to get a simple program running. Before I begin does anyone know of any good examples for bluetooth/projects already available which I could use as an example? Bluez is written in C but all files contain a the #if _cplusplus... so I'm wondering if that might be an issue?

The code is as follows:

include <iostream>
#include "bluetooth.h"
#include <string>
#include "hci_lib.h"

using namespace std;

int main() {
	const char* btaddress = "00:06:66:03:1D:AA"; //determined this to be the 
                                                     //address of my btdongle
	bdaddr_t *blue = NULL;
	int resourcenum = 0;


	str2ba(btaddress, blue); //converts string to bdaddre_t struct
	cout<< "made it here" << endl;
    resourcenum = hci_get_route(NULL);
    cout <<resourcenum;

	cout << "hello"; // prints
	return 0;
}

The problem is it never goes past the str2ba function... Through the debugger it shows the following errors:

.gdbinit: No such file or directory.
Reading symbols from /home/user/workspace/bluetooth_test/Debug/bluetooth_test...done.

Stopped due to shared library event
Stopped due to shared library event

Any other thoughts or input would be great

This article has been dead for over six months. Start a new discussion instead.