Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No ranging result from both phones #3

Closed
BillyYiuCimda opened this issue Jul 17, 2024 · 8 comments
Closed

No ranging result from both phones #3

BillyYiuCimda opened this issue Jul 17, 2024 · 8 comments

Comments

@BillyYiuCimda
Copy link

I tried this code on Pixel 7 Pro and Galaxy S24 Plus. One set to Controller and one to Controlee and entered address and preamble index as required. After I clicked COMMUNICATE button, no distance showed up. I tried to update the uwb:1.0.0-alpha07 to uwb:1.0.0-alpha08 but the program quits after the connection, this behavior is the same as the official uwbRanging demo program from Android Developer. I guess it is something to do the difference between Pixel and Galaxy. For Pixel, Distance, Azimuth and Elevation are all true but for Galaxy, only Distance is true, the other two are false. Can you take a look to see what is the real root cause?

@CrazyChaoz
Copy link
Owner

Interesting, I tested it on Pixel 6 Pro, Pixel 7 Pro and a Galaxy Note 20(?) Pro, and they all seemed to work rather well, although P6P has no elevation angles.

Did you try the latest push?
I fixed some api change/regression related bug.

@CrazyChaoz
Copy link
Owner

CrazyChaoz commented Jul 17, 2024

The Exception would be interesting.

If its some "session key is needed" then this is fixed, if its "library not up do date with backend" then some rebuild would do the trick.

There is also a good probability the phones need to be restarted at times, since the connection cleanup isnt always 100% working.

@BillyYiuCimda BillyYiuCimda changed the title Now ranging result from both phones No ranging result from both phones Jul 17, 2024
@BillyYiuCimda
Copy link
Author

After upgrade and restart, it can work now. Interestingly, now it can work with uwb:1.0.0-alpha08 but the official uwbRanging program still doesn't work. However, the program is not very stable, it hangs and needs restart quite frequently.

@CrazyChaoz
Copy link
Owner

official uwbRanging program still doesn't work.

You could try to put a byte[]{0,0,0,0,0,0,0,0} as sessionKey, instead of null, if you get an error related to that, otherwise just hit me up with the exception, I probably also faced it before 🙃

However, the program is not very stable, it hangs and needs restart quite frequently.

I know it isn't the most stable, and the Kotlin impl is probably better, but it is meant as a somewhat working demo, in the sense of hey, how good does this uwb thing in phones work . I could probably look at the cleanup of the coroutine stuff, but as a techdemo it does its thing well enough I think.

Also it is alpha software.
It really feels like alpha software.

You are lucky your phones don't get a kernel panic anymore from starting an uwbsession. I had to enrol a phone to the Android 14 beta since the UWB chip at some point died and not even resets were helping.

@BillyYiuCimda
Copy link
Author

I couldn't find sessionKey in the uwbRanging source code, I only see sessionKeyInfo but it is random, not null. Even I use zero array, it still quit after getting connection, while running the channelFlow. I know Alpha08 is still not perfect, but I wonder why your latest code can solve my quiting problem with Alpha08. I know it is not fair for you to troubleshoot the code from somebody else. Anyway, thanks for your help.

Oriiginal code:
val sessionKeyInfo = Random.nextBytes(8)

@BillyYiuCimda
Copy link
Author

I have opened an issue to Android, not sure whether it will be taken care of. android/connectivity-samples#308 (comment)

@BillyYiuCimda
Copy link
Author

BillyYiuCimda commented Jul 19, 2024

Since uwb:1.0.0-alpha06, RangingParameters was updated but the UwbRanging example code is still expecting old parameter set, that is why it has error. Your code makes it work for uwb:1.0.0-alpha08, thanks.
android/connectivity-samples#308 (comment)

@CrazyChaoz
Copy link
Owner

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants