cyb3rcitiz3n / bluecove

Automatically exported from code.google.com/p/bluecove
0 stars 0 forks source link

Can not get friendly name of device in deviceDiscovered method on Mac OS X #22

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start an inquiry, e.g. discAgent.startInquiry(DiscoveryAgent.GIAC, 
discoverer);
2. At the beginning of the DiscoveryListener deviceDiscovered(RemoteDevice 
rDevice, 
DeviceClass dClass) method, get the friendly name of the device: 
rDevice.getFriendlyName(false);
3. Watch it explode.

-What is the expected output? What do you see instead?
Friendly name of the device. An exception (below).

javax.bluetooth.BluetoothStateException: Another inquiry already running
    at com.intel.bluetooth.BluetoothStackOSX.getRemoteDeviceFriendlyName(Native Method)
    at com.intel.bluetooth.RemoteDeviceHelper.getFriendlyName(RemoteDeviceHelper.java:211)
    at javax.bluetooth.RemoteDevice.getFriendlyName(RemoteDevice.java:131)
    at wiiremotej.WiiRemoteDiscoverer.deviceDiscovered(WiiRemoteDiscoverer.java:47)
    at 
com.intel.bluetooth.BluetoothStackOSX.deviceDiscoveredCallback(BluetoothStackOSX
.java:273)
    at com.intel.bluetooth.BluetoothStackOSX.runDeviceInquiryImpl(Native Method)
    at com.intel.bluetooth.BluetoothStackOSX.runDeviceInquiry(BluetoothStackOSX.java:250)
    at com.intel.bluetooth.DeviceInquiryThread.run(DeviceInquiryThread.java:82)

-What version of the product are you using? On what operating system?
2.0.2 (with sources from today at ~1:40 AM EST). Mac OS X 10.5.1.

Original issue reported on code.google.com by ctt...@gmail.com on 30 Dec 2007 at 7:26

GoogleCodeExporter commented 8 years ago
I've written a sample class to demonstrate the issue. Just run this code with 
any sort of discoverable bluetooth 
device nearby on a Mac and you should get the error I mentioned above.

import javax.bluetooth.*;

public class BluetoothTest
{
    public static void main(String[] args) throws Exception
    {
        DiscoveryAgent agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
        DiscoveryListener listener = new DiscoveryListener()
        {
            public void deviceDiscovered(RemoteDevice rDevice, DeviceClass dClass)
            {
                try
                {
                    System.out.println("Discovery");
                    System.out.println(rDevice.getFriendlyName(false));
                }
                catch(Exception e){e.printStackTrace();}
            }
            public void inquiryCompleted(int discType){System.out.println("Inquiry completed");}
            public void servicesDiscovered(int transID, ServiceRecord[] servRecord){}
            public void serviceSearchCompleted(int transID, int respCode){}
        };

        agent.startInquiry(DiscoveryAgent.GIAC, listener);
        Thread.currentThread().sleep(30000);
    }

}

Original comment by ctt...@gmail.com on 30 Dec 2007 at 7:07

GoogleCodeExporter commented 8 years ago
Hi ctta0s
 I run the last build bluecove-2.0.2-20071230.060228-70.jar and your test application
works fine. I used OS X 10.4.8

 I remember that I fixed this problem some time two weeks ago.
 Can you conform that you have a problem with the latest build on your OS version?

Vlad

Original comment by skarzhev...@gmail.com on 31 Dec 2007 at 6:00

GoogleCodeExporter commented 8 years ago
I ran it with the build you specified downloaded from 
http://www.pyx4me.com/maven2-
snapshot/net/sf/bluecove/bluecove/2.0.2-SNAPSHOT/

I got the same error:
BlueCove version 2.0.2-SNAPSHOT on mac
Discovery
javax.bluetooth.BluetoothStateException: Another inquiry already running
    at com.intel.bluetooth.BluetoothStackOSX.getRemoteDeviceFriendlyName(Native Method)
    at com.intel.bluetooth.RemoteDeviceHelper.getFriendlyName(RemoteDeviceHelper.java:211)
    at javax.bluetooth.RemoteDevice.getFriendlyName(RemoteDevice.java:131)
    at BluetoothTest$1.deviceDiscovered(BluetoothTest.java:15)
    at com.intel.bluetooth.BluetoothStackOSX.deviceDiscoveredCallback(BluetoothStackOSX.java:273)
    at com.intel.bluetooth.BluetoothStackOSX.runDeviceInquiryImpl(Native Method)
    at com.intel.bluetooth.BluetoothStackOSX.runDeviceInquiry(BluetoothStackOSX.java:250)
    at com.intel.bluetooth.DeviceInquiryThread.run(DeviceInquiryThread.java:82)
^CBlueCove stack shutdown completed

This is from the exact code I mentioned above. If it matters, the device it 
probably discovered was my cell 
phone.

Original comment by ctt...@gmail.com on 31 Dec 2007 at 6:59

GoogleCodeExporter commented 8 years ago
There are 74 different versions in this directory. Which version did you took?

Original comment by skarzhev...@gmail.com on 31 Dec 2007 at 7:06

GoogleCodeExporter commented 8 years ago
The most recent, bluecove-2.0.2-20071230.060228-70.jar.

Original comment by ctt...@gmail.com on 31 Dec 2007 at 7:09

GoogleCodeExporter commented 8 years ago
Ok try new build:
 bluecove-2.0.2-20071231.191639-71.jar

Original comment by skarzhev...@gmail.com on 31 Dec 2007 at 7:18

GoogleCodeExporter commented 8 years ago
Ignore last comment I see the problem

Original comment by skarzhev...@gmail.com on 31 Dec 2007 at 7:53

GoogleCodeExporter commented 8 years ago
Now I change the function getRemoteDeviceFriendlyName
Tested and works fine. I even used rDevice.getFriendlyName(true)

Use build bluecove-2.0.2-20080102.194747-73.jar and later.

Are you the one making WiiRemoteJ?

Original comment by skarzhev...@gmail.com on 2 Jan 2008 at 7:51

GoogleCodeExporter commented 8 years ago
Ah, it's working now thanks, though there is one bug. Pretty much every other 
time I try to connect, I get this 
error:
WARNING: Error, unexpected IO error.
java.io.IOException: Error sending data!
    at wiiremotej.WiiRemote.sendCommand(WiiRemote.java:503)
    at wiiremotej.WiiRemote.setInputReport(WiiRemote.java:764)
    at wiiremotej.WiiRemote.setInputReport(WiiRemote.java:770)
    at wiiremotej.WiiRemote.access$300(WiiRemote.java:60)
    at wiiremotej.WiiRemote$1.run(WiiRemote.java:318)
    at java.lang.Thread.run(Thread.java:613)
Caused by: java.io.IOException: Failed to write [0xe00002bc]
    at com.intel.bluetooth.BluetoothStackOSX.l2Send(Native Method)
    at com.intel.bluetooth.BluetoothL2CAPConnection.send(BluetoothL2CAPConnection.java:113)
    at wiiremotej.WiiRemote.sendCommand(WiiRemote.java:499)
    ... 5 more
Jan 2, 2008 4:10:46 PM wiiremotej.WiiRemote construct
FINER: Initialization complete.
java.io.IOException: Error sending data!
    at wiiremotej.WiiRemote.sendCommand(WiiRemote.java:503)
    at wiiremotej.WiiRemote.setInputReport(WiiRemote.java:764)
    at wiiremotej.WiiRemote.setInputReport(WiiRemote.java:770)
    at wiiremotej.WiiRemote.setAccelerometerEnabled(WiiRemote.java:1450)
    at WRLImpl.main(WRLImpl.java:137)
Caused by: java.io.IOException: Connection is closed
    at com.intel.bluetooth.BluetoothStackOSX.l2Send(Native Method)
    at com.intel.bluetooth.BluetoothL2CAPConnection.send(BluetoothL2CAPConnection.java:113)
    at wiiremotej.WiiRemote.sendCommand(WiiRemote.java:499)
    ... 4 more

It may have to do with the timing of the connection and whether or not it finds 
another device first, though 
I'm not sure.

P.S. Yes, I am the one making WiiRemoteJ. :)

Original comment by ctt...@gmail.com on 3 Jan 2008 at 12:10

GoogleCodeExporter commented 8 years ago
Hi Cha0s
 The problem with names solved? The bug closed.
 If you have a different problem contact me directly or open the new bug as
descriptive as you did before I will do my best to help and fix.

 I have BlueCove on OSX L2CAP connecting to two cell phones working fine for last 2
hours no problems. I don't have Wii to test the application with...

 Failed to write [0xe00002bc] == IOReturnError (A general error (0xe00002bc))
http://developer.apple.com/documentation/Darwin/Reference/IOKit/IOReturn/

Vlad 
skarzhevskyy@gmail.com

Original comment by skarzhev...@gmail.com on 3 Jan 2008 at 1:21