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

WiFi-NAN devices show up multiple times #44

Open
janusw opened this issue Feb 15, 2022 · 4 comments
Open

WiFi-NAN devices show up multiple times #44

janusw opened this issue Feb 15, 2022 · 4 comments

Comments

@janusw
Copy link
Contributor

janusw commented Feb 15, 2022

While BT and WiFi-Beacon devices only show up once in the list of devices (they have a fixed MAC), WiFi-Beacon devices show up multiple times (apparently because the NAN Id is changing frequently).

One would need to deduplicate this via the ID info provided by the device in the DRI packets, I guess?

@friissoren
Copy link
Collaborator

Hmmm.... Yes. That is probably the case.

The Android API for NaN does not provide a MAC address to indicate which transmitter a given "ping" was received from. It does give some small hash value (I suspect the range of that is just a byte?) which is different for each transmitter and stays consistent (at least for a while):
https://github.com/opendroneid/receiver-android/blob/master/Android/app/src/main/java/org/opendroneid/android/bluetooth/WiFiNaNScanner.java#L101

https://developer.android.com/reference/android/net/wifi/aware/PeerHandle#hashCode()

The only NaN transmitter I have done any testing with, is the ESP32 implementation. It is quite possible that different transmitter implementations behave different and cause a (frequent?) change of this hash code. For the ESP32 transmitter, I have not done any long term testing to see if this happens.

BTW: You can see the value of the hash code in the detailed Info view for each device in the list. It is in the MAC field.

If the transmitter is following the standard, for NaN, it is mandated that message packs are used, so each ping should always contain the basic ID message. In theory, that would at least allow the app to detect that the hash code has changed but it is still the same transmitter that it is receiving from.

@janusw
Copy link
Contributor Author

janusw commented Feb 15, 2022

The only NaN transmitter I have done any testing with, is the ESP32 implementation. It is quite possible that different transmitter implementations behave different and cause a (frequent?) change of this hash code. For the ESP32 transmitter, I have not done any long term testing to see if this happens.

I see this both with the EPS32 implementation (from https://github.com/sxjack/uav_electronic_ids) and with other devices. In both cases the ID changes within a couple of seconds.

BTW: You can see the value of the hash code in the detailed Info view for each device in the list. It is in the MAC field.

Yes, the 'hash' simply seems to be a consecutive number. I see values like:

NAN ID: 119
NAN ID: 120
NAN ID: 121

If the transmitter is following the standard, for NaN, it is mandated that message packs are used, so each ping should always contain the basic ID message. In theory, that would at least allow the app to detect that the hash code has changed but it is still the same transmitter that it is receiving from.

Sounds reasonable. Without that, I guess it's basically impossible to get a longer 'track' from a NAN device (you would just see a series of single spots, each as a separate transmitter device).

@friissoren
Copy link
Collaborator

In both cases the ID changes within a couple of seconds.
I don't recall it changing that fast. I might be wrong. Maybe the ESP32 SW has changed "recently"?

Unfortunately I won't be able to dive into the details of this any time soon. Getting all the SW components updated with the few changes from the final ASTM v1.1 specification will have to be done before anything else (as soon as I can find a spare moment for even getting that done).

@janusw
Copy link
Contributor Author

janusw commented Feb 15, 2022

Alright, no hurry here. I only wanted to raise the issue, since it had just occurred to me ...

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