WTK emulator bluetooth connection problem

Posted by Gokhan B. on Stack Overflow See other posts from Stack Overflow or by Gokhan B.
Published on 2010-03-14T12:34:22Z Indexed on 2010/03/14 12:35 UTC
Read the original article Hit count: 414

Filed under:
|
|
|
|

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 ?

© Stack Overflow or respective owner

Related posts about java

Related posts about j2me