-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
val newPairedDevices = pairedDevices.subtract(allPairedDevices) | ||
allPairedDevices.addAll(newPairedDevices) | ||
allPairedDevices.removeAll(allPairedDevices.subtract(pairedDevices)) // removing devices which are previously paired but unpaired now |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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. (AspairedDevices
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
No description provided.