spin7ion / android-bluetooth

Automatically exported from code.google.com/p/android-bluetooth
1 stars 0 forks source link

Problem with device discovery sample on HTC Hero #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run AndroidBluetoothLibrarySamples
2. Choose Device Discovery Sample
3. Start device search

What is the expected output? What do you see instead?
I'm expecting a list of device names and addresses. My device is found (I
see its address), but a NullPointerException is thrown on line 92 of
DeviceDiscoverySample.java, which is:

name = localBluetoothDevice.getRemoteName(address);

(checked out from SVN on September 12)

What version of the product are you using? On what operating system?
HTC Hero, Android 1.5. I tried with the following devices being discovered:
- MacBook Pro
- Sony Ericsson k800i phone
- Lego Mindstorms NXT brick

and the result is always the same - a NPE when trying to get device name by
address.

Please provide any additional information below.
What I managed to figure out is that when the getRemoteName method is
called via reflection in LocalBluetoothDevice.java:855, it returns null, so
the NPE originates from calling toString(), but the actual problem seems to
be with the getRemoteName method. I checked that a method with such name
exists in the class under bluetoothServiceClass, but it returns null when
invoked.

Any ideas would be appreciated :)

Original issue reported on code.google.com by jacek.ku...@gmail.com on 13 Sep 2009 at 12:28

GoogleCodeExporter commented 9 years ago
Will work on that as soon as possible. Thanks.

Original comment by gerda...@gmail.com on 13 Sep 2009 at 1:45

GoogleCodeExporter commented 9 years ago
HTC Hero is currently not supported. Unfortunately, I have not this handset and 
I
have not found a way to get a sample unit to work on it for fixing the bug. 

Original comment by gerda...@gmail.com on 17 Oct 2009 at 6:21

GoogleCodeExporter commented 9 years ago

Original comment by gerda...@gmail.com on 17 Oct 2009 at 8:36

GoogleCodeExporter commented 9 years ago
OK, perhaps I could look into the problem myself. Do you have any ideas what the
problem may be, where may it come from and what to look at? Just to give me some
starting point.

Original comment by jacek.ku...@gmail.com on 19 Oct 2009 at 2:01

GoogleCodeExporter commented 9 years ago
If you are available, I can send to you a utility class I used to run java 
reflection
for Bluetooth service.

Original comment by gerda...@gmail.com on 19 Oct 2009 at 2:26

GoogleCodeExporter commented 9 years ago
OK, please do. I'll try to have a look.

Original comment by jacek.ku...@gmail.com on 19 Oct 2009 at 2:29

GoogleCodeExporter commented 9 years ago
Jacek, please contact me privately @gmail.com, we will try to find a workaround 
for
the Hero. Thanks.

Original comment by gerda...@gmail.com on 19 Oct 2009 at 3:39

GoogleCodeExporter commented 9 years ago
Hello,

Did you find a way to fix this?

I am also available to try to find the problem if you can give me indication on 
where
to search.

Original comment by victor.n...@gmail.com on 21 Oct 2009 at 7:30

GoogleCodeExporter commented 9 years ago
Hello, it doesn't seem like reflection is not working but more like the 
getRemoteName
of the BluetoothDevice (see
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java
/android/bluetooth/BluetoothDevice.java;h=951b4b0ab471c9a7f57da6ec282a7892b4830c
5b;hb=358d23017d0d6c4636eb7599ae7a9b48108899a3
)
is returning null because of an exception…

Not sure but I think the log corresponding to the one in the method in the 
cited file is:
10-23 11:03:58.470: INFO/bluetooth_common.cpp(62): com.ti.btips, /com/ti/btips,
com.ti.btips.bmg, GetRemoteDeviceName

Original comment by victor.n...@gmail.com on 23 Oct 2009 at 9:20

GoogleCodeExporter commented 9 years ago
And please note that there is some example on how the settings application does 
it here:
http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=tree;f=sr
c/com/android/settings/bluetooth;h=b384704c93590a61f80544debeca4d706b6f6e27;hb=4
3f027a086d4fb175589f335ed0f808d1894a9eb

(for android 1.5)

Original comment by victor.n...@gmail.com on 23 Oct 2009 at 9:22

GoogleCodeExporter commented 9 years ago
I tried samples today on HTC Hero ( 1.5, latest ROM build,  unbranded ) 
and it worked.

My environment:
 Idea 9 EAP, Ubuntu , SDK 1.6

Original comment by konstant...@gmail.com on 27 Oct 2009 at 10:34

GoogleCodeExporter commented 9 years ago
That's good news. I'll have to upgrade to the latest ROM and check.

Did you build the samples with SDK 1.6 or did you use the Market version?

Original comment by jacek.ku...@gmail.com on 27 Oct 2009 at 10:38

GoogleCodeExporter commented 9 years ago
When you say that you tried samples, do you mean those on the svn or those on 
the market?

If I recall correctly, I tried both and none worked (the name of the devices was
always ERROR).

Original comment by victor.n...@gmail.com on 27 Oct 2009 at 10:39

GoogleCodeExporter commented 9 years ago
I just checked out today,   and build them with 1.5 contained in 1.6 SDK

Original comment by konstant...@gmail.com on 27 Oct 2009 at 12:30

GoogleCodeExporter commented 9 years ago
Mea culpa - Problem is definitely there. 

Original comment by konstant...@gmail.com on 27 Oct 2009 at 3:09

GoogleCodeExporter commented 9 years ago
Hi all.

Unfortunately I have not an HTC Hero nor I can purchase one in a short time. To 
do
investigation on this device I definitively need to have it for one or two 
weeks, to
understand at least if there is a workaround to let the library running on it 
or we
have to consider this handset as not compatible. 

Stefano.

Original comment by gerda...@gmail.com on 27 Oct 2009 at 3:20

GoogleCodeExporter commented 9 years ago
Hello, why not work in conjunction with the guys from Bluecove that are working 
on
it, maybe they can help you for this matter.

See:
http://groups.google.com/group/bluecove-developers/browse_thread/thread/a05875b9
28c89dc2

Original comment by victor.n...@gmail.com on 27 Oct 2009 at 4:48

GoogleCodeExporter commented 9 years ago
Maybe it is no longer required:

http://android-developers.blogspot.com/2009/10/announcing-android-20-support-in-
sdk.html

Original comment by gerda...@gmail.com on 27 Oct 2009 at 5:05

GoogleCodeExporter commented 9 years ago
Obviously, it will take some time to have Android 2.0 on already released 
device and
maybe they will not support JSR-82 like Bluecove do it.

Original comment by victor.n...@gmail.com on 27 Oct 2009 at 5:12

GoogleCodeExporter commented 9 years ago
Here is logcat from HTC Hero:
-----------------------------
10-28 10:02:48.072: ERROR/AG(115): CIEV: 6,4
10-28 10:02:48.072: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:02:51.062: ERROR/AG(115): CIEV: 6,3
10-28 10:02:51.062: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:02:53.282: VERBOSE/BluetoothDeviceService.cpp(63): startDiscoveryNative
10-28 10:02:53.282: INFO/bluetooth_common.cpp(63): com.ti.btips, /com/ti/btips,
com.ti.btips.bmg, SearchByCod
10-28 10:02:53.322: WARN/InputManagerService(63): Window already focused, 
ignoring
focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@439fe958
10-28 10:02:53.617: VERBOSE/BluetoothEventLoop.cpp(63): COD = 4063492
10-28 10:02:53.632: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:53.632: WARN/System.err(22875):
action:android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:53.642: INFO/System.out(22875): Device found with address
00:0A:3A:88:AE:F3, class 4063492 and rssi -1
10-28 10:02:53.672: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:02:54.152: VERBOSE/BluetoothEventLoop.cpp(63): COD = 268
10-28 10:02:54.162: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:54.162: WARN/System.err(22875):
action:android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:54.162: INFO/System.out(22875): Device found with address
00:25:56:D4:BD:76, class 268 and rssi -1
10-28 10:02:54.172: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:02:56.392: VERBOSE/BluetoothEventLoop.cpp(63): COD = 5243404
10-28 10:02:56.392: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:56.402: WARN/System.err(22875):
action:android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
10-28 10:02:56.402: INFO/System.out(22875): Device found with address
00:19:79:D1:6B:26, class 5243404 and rssi -1
10-28 10:02:56.402: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:02:57.062: ERROR/AG(115): CIEV: 6,4
10-28 10:02:57.062: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:03:03.592: VERBOSE/BluetoothEventLoop.cpp(63): DiscoveryCompleted 
signal
received
10-28 10:03:03.592: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.DISCOVERY_COMPLETED
10-28 10:03:03.592: WARN/System.err(22875):
action:android.bluetooth.intent.action.DISCOVERY_COMPLETED
10-28 10:03:03.592: VERBOSE/BluetoothDeviceService.cpp(63): getRemoteNameNative
10-28 10:03:03.602: INFO/bluetooth_common.cpp(63): com.ti.btips, /com/ti/btips,
com.ti.btips.bmg, GetRemoteDeviceName
10-28 10:03:03.612: WARN/System.err(22875): result:null
10-28 10:03:03.612: INFO/System.out(22875): Device: empty
10-28 10:03:03.612: INFO/System.out(22875): - This is a computer
10-28 10:03:03.612: VERBOSE/BluetoothDeviceService.cpp(63): getRemoteNameNative
10-28 10:03:03.612: INFO/bluetooth_common.cpp(63): com.ti.btips, /com/ti/btips,
com.ti.btips.bmg, GetRemoteDeviceName
10-28 10:03:03.632: WARN/System.err(22875): result:null
10-28 10:03:03.632: INFO/System.out(22875): Device: empty
10-28 10:03:03.632: INFO/System.out(22875): - This is a computer
10-28 10:03:03.632: VERBOSE/BluetoothDeviceService.cpp(63): getRemoteNameNative
10-28 10:03:03.632: INFO/bluetooth_common.cpp(63): com.ti.btips, /com/ti/btips,
com.ti.btips.bmg, GetRemoteDeviceName
10-28 10:03:03.642: WARN/System.err(22875): result:null
10-28 10:03:03.642: INFO/System.out(22875): Device: empty
10-28 10:03:03.652: INFO/System.out(22875): - This is a phone
10-28 10:03:05.442: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:03:05.864: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:03:06.472: VERBOSE/BluetoothEventRedirector(346): Received
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
10-28 10:06:36.092: ERROR/AG(115): CIEV: 6,5
10-28 10:06:36.092: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:06:42.082: ERROR/AG(115): CIEV: 6,4
10-28 10:06:42.082: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:06:54.092: ERROR/AG(115): CIEV: 6,5
10-28 10:06:54.092: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:06:54.442: DEBUG/dalvikvm(63): GC freed 28433 objects / 1497592 bytes 
in 319ms
10-28 10:06:57.082: ERROR/AG(115): CIEV: 6,4
10-28 10:06:57.082: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:07:28.752: ERROR/AG(115): CIEV: 6,5
10-28 10:07:28.752: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
10-28 10:07:49.732: ERROR/AG(115): CIEV: 6,4
10-28 10:07:49.732: INFO/bluetooth_common.cpp(115): com.ti.btips, /com/ti/btips,
com.ti.btips.ag, SetIndicatorValue
--------------------------

( I guarded that NPE and added some additional output to show actions arriving 
to 
BluetoothBroadcastReceiver ) 

Original comment by konstant...@gmail.com on 28 Oct 2009 at 9:13

GoogleCodeExporter commented 9 years ago
Hi all.

As officially announced by HTC on their Twitter page:

http://twitter.com/htc/status/5243593307

"Hero will be getting an Eclair update"

Therefore (and given that I have not an HTC Hero to work with), there is no 
need to
invest for porting the Bluetooth API on this handset that is going to get 
official
Bluetooth support. On the other hand, I'll continue to work to support those 
handsets
(probably HTC Dream and Magic) for which no update plan has been announced. 

I consider this issue as not applicable to the project.

Original comment by gerda...@gmail.com on 30 Oct 2009 at 2:36

GoogleCodeExporter commented 9 years ago
Ok, I think that's great :)

Thank you for your work!

Original comment by victor.n...@gmail.com on 30 Oct 2009 at 5:03