Skip to content
New issue

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

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

Already on GitHub? # to your account

"MyTCN" field in debug screen empty when device is restarted #258

Open
ivnsch opened this issue Jun 10, 2020 · 1 comment
Open

"MyTCN" field in debug screen empty when device is restarted #258

ivnsch opened this issue Jun 10, 2020 · 1 comment
Labels
question Further information is requested

Comments

@ivnsch
Copy link
Collaborator

ivnsch commented Jun 10, 2020

When doing a fresh install on 2 devices with BLE enabled, the TCN generation callback of both will be executed and the TCN will be shown in the debug screen ("My TCN"), and logs.

Restarting the app on one of the devices (from Xcode or stopping/re-opening on the device), however, will not trigger the TCN generation callback, which leaves "My TCN" field on the device empty:

  • Why does this happen?
  • How does this affect the contact tracing (not sure whether it's actually an issue)?
  • Is there an easy fix for the debug screen to show it?

Context:

  • iOS - iOS as far as documented in the spec, should generate the TCN when receiving a read request. If we restart a device and are not generating it, it means that the central isn't reading or detecting the advertisements?
  • The TCN generation callback can be found in BleAdapter
@ivnsch
Copy link
Collaborator Author

ivnsch commented Jun 28, 2020

I debugged this and found the reason for this behavior:

  1. iOS - iOS uses characteristic read.
  2. On iOS - iOS, TCNs are generated only when receiving a read request.
  3. If the listener has a TCN cached for the sender's device identifier, it doesn't send a read request.
  4. The "My TCN" displayed in the UI is set when the TCN generation closure is called.

This means that if device1 is restarted, device2 has cached its TCN and will not send a new read request. The restart causes device2 to lose the "My TCN" variable, and since the TCN generation closure is not called, the UI isn't updated.

TLDR: Only an issue of the debug screen. We could try to fix it, though not sure how, e.g. we can store the last generated TCN in preferences and restore it when the device restarts. But is this TCN always meaningful? If we're testing with more than 2 devices, there will be 2 valid last generated TCNs, so we'd have to store a list, etc.

@scottleibrand

Edit: Maybe we can store the last one and label it as such in the debug screen. This would help debugging with 2 devices, without being confusing.

@ivnsch ivnsch changed the title TCN generation callback not executed "MyTCN" field in debug screen empty when device is restarted Jun 28, 2020
@ivnsch ivnsch added the question Further information is requested label Jul 1, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants