• J2ME: enumerating Bluetooth services whilst simultaneously getting the service name

    by  • March 21, 2008 • bluetooth, j2me • 0 Comments

    On at least one device (a BlueSmirf), using the following construct in J2ME

    agent.searchServices(new int[] {0×100}, new UUID[]{new UUID},dev, this);

    will fail with an UNREACHABLE error code when searching for available Bluetooth services whilst also retrieving the service name  attribute (0×100).
    Instead, what I had to do was use

    agent.searchServices(null,new UUID[]{new UUID},dev, this);

    And then once all services have been discovered (in the serviceSearchCompleted() event of the BluetoothListener interface), populate the record with the service name by using the

    rec.populateRecord(new int[]{0×100});

    which seems to work absolutely fine! Hope this helps someone.

    About

    Web Developer for MRM Meteorite. Awarded a PhD in research into novel techniques to detect misbehaviour in peer-to-peer wireless networks. Experienced C# and ASP.net developer, with an interest in SOA, RIA and moble app development.

    http://www.paulkiddie.com

    Leave a Reply

    Your email address will not be published. Required fields are marked *