nelsonenzo
YaBB Newbies
Offline
Posts: 2
Bluetooth connection for desktop
Oct 31st , 2008, 12:55am
Hello, I am trying to use my built in bluetooth adapter to recognize another blue tooth device, either a phone or the 'Smirf' from arduino. I downloaded the processing bluetooth library and installed it. But when I run the following example script it gives me the following error (below) My adapter has a broadcom stack, which according to bluecove.org it is supported . I have the latest Java installed as well.as well. I am able to connect to the arduino bluetooth as a serial device, but then it is a serial port, not a true bluetooth connection. I am not able to therefor do things like search for other blue tooth devices. What am I missing? "java.lang.RuntimeException: No supported stack installed or no dongle available" Code: import bluetoothDesktop.*; PFont font; Bluetooth bt; String statusMsg = "inactive"; Service[] services = new Service[0]; Device[] devices = new Device[0]; Client[] clients = new Client[0]; void setup() { size(600,300); font = createFont("Courier", 15); textFont(font); try { bt = new Bluetooth(this, Bluetooth.UUID_RFCOMM); //I have also tried bt=new Bluetooth(this); with no luck // Start a Service bt.start("simpleService"); bt.find(); statusMsg = "starting search"; } catch (RuntimeException e) { statusMsg = "bluetooth off?"; println(e); } } void draw() { background(0); fill(255); text("Status: " + statusMsg, 10, 30); translate(20, 60); text("Devices:", 0, 0); if (devices!=null) { for (int i=0; i<devices.length; i++) { text(devices[i].name, 0, 30+i*20); } } translate(160, 0); text("Services:", 0, 0); if (services!=null) { for (int i=0; i<services.length; i++) { text(services[i].name, 0,30+ i*20); } } translate(200, 0); text("Clients:", 0, 0); if (clients!=null) { for (int i=0; i<clients.length; i++) { text(clients[i].device.name, 0, 30+i*20); } } for (int i=0; i<clients.length; i++) { if (clients[i].available()>0) { println("Client " + i + " sent: " + clients[i].readUTF()); } } } void deviceDiscoverEvent(Device d) { statusMsg = "Found device at: " + d.address + "..."; devices = (Device[])append(devices, d); } void deviceDiscoveryCompleteEvent(Device[] d) { statusMsg = "Found " + d.length + " devices found."; devices = d; } void serviceDiscoverEvent(Service[] s) { statusMsg = "Found Service " + s[0].name + "..."; services = (Service[])append(services,s[0]); } void serviceDiscoveryCompleteEvent(Service[] s) { services = (Service[])s; statusMsg = "Search complete."; } void clientConnectEvent(Client c) { clients = (Client[])append(clients, c); } void keyPressed() { for (int i=0; i<clients.length; i++) { clients[i].writeUTF(""+key); println("Server sent to all clients: " + key); } }