Results 1 to 1 of 1
Thread: Disabling Bluetooth passkey
- 12-29-2009, 01:33 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
Disabling Bluetooth passkey
Tbh, i'm not even sure if this is a Java or more of a windows problem, but since i'm coding in Java, i might as well ask here, maybe someone can help me...
I'm building a bluetooth-server, that's supposed to initialize the bluetooth device, register a service and then wait for incoming connections. When a client connects, the server should start a simple file transfer. The Server itself seems to be running fine (code see below), but unfortunately, i can't establish any connections. When i try to connect with a second device, both that device and the comp running the server are asked to enter a passkey. But, as servers go, this one's supposed to run unattended, so no passkey is entered on the server-side, resulting in a failed connection attempt. Is there a way of disabling the need for a passkey on the server-side (or set one up via the code that would be applicable for all connection attempts)?
(site note: also, even after entering a passkey on both sides, the server sees no connection, but i assume that's somehow tied to my main problem).
using WinXP and the BlueCove implementation of the BT stack.
Java Code:import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import javax.bluetooth.*; import javax.microedition.io.*; public class FileServer { private void startServer() throws IOException { System.out.println("Server started, waiting for connections..."); //Name of Service String myServiceName = "ClientDistributor"; //UUID of Service String myServiceUUID = "CB230ADBD1AE4bf495195C59525BC659"; UUID MYSERVICEUUID_UUID = new UUID(myServiceUUID, false); //Server URI String connURL = "btspp://localhost:"+MYSERVICEUUID_UUID.toString()+";"+"name="+myServiceName+";authenticate=false;encrypt=false;"; //create connection StreamConnectionNotifier scn = (StreamConnectionNotifier) Connector.open(connURL); //open connection, insert service into sddb and wait for clients StreamConnection sc = scn.acceptAndOpen(); //client connected, get handle RemoteDevice rd = RemoteDevice.getRemoteDevice(scn); System.out.println("New client connection... " + rd.getFriendlyName(false)); scn.close(); } public static void main(String[] args) throws IOException { //get local device //display local device address and name LocalDevice localDevice = LocalDevice.getLocalDevice(); System.out.println("Address: " + localDevice.getBluetoothAddress()); System.out.println("Name: " + localDevice.getFriendlyName()); //set discoverable localDevice.setDiscoverable(DiscoveryAgent.GIAC); //Clients retrieve the discovery agent DiscoveryAgent discoveryAgent = localDevice.getDiscoveryAgent(); FileServer fileServer = new FileServer(); fileServer.startServer(); } }Last edited by lambi; 12-29-2009 at 03:05 PM.
Similar Threads
-
[SOLVED] Disabling Inherited Methods
By Singing Boyo in forum New To JavaReplies: 7Last Post: 05-17-2009, 07:04 AM -
Disabling a button at EOF
By dbashby in forum New To JavaReplies: 1Last Post: 03-10-2009, 02:37 PM -
Transfering files over Bluetooth (with javax.bluetooth)
By weber10 in forum CLDC and MIDPReplies: 0Last Post: 02-26-2009, 08:14 PM -
Disabling part of a method
By juru in forum Advanced JavaReplies: 10Last Post: 10-27-2008, 01:41 AM -
disabling JButtons after win in TicTacToe
By noisepoet in forum New To JavaReplies: 1Last Post: 05-18-2007, 11:01 PM


LinkBack URL
About LinkBacks

Bookmarks