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

Added Hash of MAC address for nearby bluetooth devices #440

Merged
merged 8 commits into from
Mar 28, 2024

Conversation

this-Aditya
Copy link
Member

No description provided.

Comment on lines 134 to 136
val newPairedDevices = pairedDevices.subtract(allPairedDevices)
allPairedDevices.addAll(newPairedDevices)
allPairedDevices.removeAll(allPairedDevices.subtract(pairedDevices)) // removing devices which are previously paired but unpaired now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this essentially just keeping the current pairedDevices in allPairedDevices? So why do we do all the subtract/add ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From bluetoothAdapter.bondedDevices we get a set of all the paired devices. From that set, we only take the newly paired devices with respect to the last fetched ones; thus, pairedDevices.subtract(allPairedDevices) is used.

  • allPairedDevices.addAll(newPairedDevices): To retain the newly connected devices also.
  • allPairedDevices.removeAll(allPairedDevices.subtract(pairedDevices)): If some devices are unpaired from what we got from the last iteration, we simply remove those unpaired devices. (As pairedDevices returns the currently paired devices, if some device is present in the paired devices list of the previous iteration (allPairedDevices) but not in the latest one, then we just remove it).

I assumed that we want to send the data for devices only once when they are recognized. If we need to send the list of all the devices that are paired with the device in every call of BluetoothDevice.ACTION_FOUND, then this can be removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just keep the latest list in that case? allPairedDevices = pairedDevices

@@ -16,6 +16,7 @@ org.gradle.jvmargs=-Xmx3072m -XX:MaxMetaspaceSize=1536m -Dfile.encoding=UTF-8 -X
org.gradle.parallel=true
org.gradle.vfs.watch=true
kotlin.code.style=official
android.jetifier.ignorelist=jackson-core-2.16.1.jar
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI tests are failing after updating the schemas to the latest version. Jackson-core is responsible for the failing tests. Hence, I found this solution to ignore it from Jetifier.

Copy link
Member

@yatharthranjan yatharthranjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@yatharthranjan yatharthranjan merged commit 9678845 into RADAR-base:dev Mar 28, 2024
2 checks passed
@this-Aditya this-Aditya deleted the mac_hash branch April 1, 2024 16:37
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

Successfully merging this pull request may close these issues.

None yet

2 participants