WTK emulator bluetooth connection problem
- by Gokhan B.
Hi! I'm developing a J2ME program with eclipse / WTK 2.5.2 and having problem with connecting two emulators using bluetooth. There is one server and one .client running on two different emulators.
The problem is client program cannot discover any bluetooth device. Here is the server and client codes:
public Server()
{
try
{
LocalDevice local = LocalDevice.getLocalDevice();
local.setDiscoverable(DiscoveryAgent.GIAC);
server = (StreamConnectionNotifier)
Connector.open("btspp://localhost:"
+ UUID_STRING + ";name=" + SERVICE_NAME);
Util.Log("EchoServer() Server connector open!");
}
catch (Exception e)
{}
}
after calling Connector.open, I get following warning in console, which i believe is related:
Warning: Unregistered device: unspecified
and client code that searches for devices:
public SearchForDevices(String uuid, String nm)
{
UUIDStr = uuid;
srchServiceName = nm;
try
{
LocalDevice local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
deviceList = new Vector();
agent.startInquiry(DiscoveryAgent.GIAC, this); // non-blocking
}
catch (Exception e)
{}
}
system never calls deviceDiscovered, but calls inquiryCompleted() with INQUIRY_COMPLETED paramter, so I suppose client program runs fine.
Bluetooth is enabled at emulator settings..
any ideas ?