Acknowledged
CIQQA-3271

LightNetworkListener.onBikeLightUpdate not called when certain data fields are installed

When certain data fields are installed alongside a CIQ application that uses LightNetworkListener, the onBikeLightUpdate method stops being called.
For example, the Smart Bike Lights data field (which uses onBikeLightUpdate) does not receive light updates when used alongside either:
- Tempe Visualizer
- TyreWiz Data Field

Both of these fields use a background service to communicate with an ANT+ sensor. Based on testing, it appears that onBikeLightUpdate stops being called when the background service of either field starts.
If the device is restarted after onBikeLightUpdate stops functioning, it resumes working even when both data fields are on the same data screen until the background service starts again (5 minutes after first use).

I tried to reproduce the issue by creating a simple data field that uses a background service to open an ANT channel and retrieve data from a Tempe sensor. Unfortunately, I was not able to reproduce the problem, as the onBikeLightUpdate method continued to be called normally.
It seems that something more is required to trigger the issue. There may be something unique in how the Tempe Visualizer or TyreWiz Data Field manage their background services or ANT channels that causes the conflict. You can find my test implementation here: https://github.com/maca88/SmartBikeLights/tree/test/ant-background-service/Source/TempeField 

Since Smart Bike Lights is a complex data field, I created a simpler one called Light Tester. It uses LightNetworkListener to display the total number of times the onBikeLightUpdate method is called. This makes it easier to observe and analyze the core issue.

How to reproduce (one ANT+ light is required):
1. Pair one or more ANT+ lights
2. Build and sideload the LightTester data field 
3. Install Tempe Visualizer data field (a Tempe sensor is not required)
4. Go to an activity and add "Light Tester" data field to a data screen
5. Turn on and off the paired light to see the "Updates=<NUMBER>" value in Light Tester increase
6. Add Tempe Visualizer to the same data screen
7. Turn the light on and off again. This time, the "Updates=<NUMBER>" value will no longer increase, indicating that onBikeLightUpdate is not being called.

The issue seems to affect all Garmin devices. I was able to reproduce the issue on all my devices:
Edge 1000
Edge 1040
Forerunner 245
Fenix 7

  • I tried to change parameters for the ANT channel, but so far no luck in reproducing it. I tried the following things individually and in combination:
    - set searchTimeoutHighPriority
    - change deviceType to zero
    - set searchThreshold
    - change ChannelType to CHANNEL_TYPE_RX_ONLY
    - use setBackgroundScan(true)


    For clarification, my data field does not open an ANT channel directly. Instead, it uses the AntPlus.LightNetwork class, which relies on the connection established by the native Sensor menu.

    When the problematic data field is added alongside mine, the light remains connected. I can confirm this because I can still use the LightNetwork.getBikeLights API to retrieve the current light mode. If the light mode changes, I can retrieve the updated mode using getBikeLights again. However, the LightNetworkListener.onBikeLightUpdate callback stops being called on a light mode change.

    I have contacted the developer of the Tempe Visualizer but have not received a response so far.

    > Or if it's on an Edge device, then editing the layout and first only adding yours, and only after it connects successfully, adding the other DataField. Do both then work?

    Yes, those are exactly the steps I followed to reproduce the issue on Edge. Even after the lights are connected, adding the other data field causes the onBikeLightUpdate callback to stop working.

    > I guess it only works for the first 5 minutes?

    The onBikeLightUpdate stops working as soon as the other data field is added for the first time, when its background service starts. The only way to temporarily restore functionality is to restart the device. After that, the callback works again, but only until 5 minutes have passed since the original start time (until the next background service run). At that point, it stops working again.

  • I don't have the code here, but if I recall correctly the channel parameters can be more or less specific. My theory is that If they are less specific then they do work when they find the Tempe or whatever they are looking for, but they also might find your light.

    And then they might use some code to look for the next ant device, and if they don't properly release the previous ant channel (that accidentally is your light) then your data field can not open the same channel.

    Again, this is just brainstorming, I'm trying to think loudly, it's not that I have any specifics about the "bad" code. Everything is guessing, maybe it'll help you to reproduce and then "fix" it and then ask the other developers to fix their code too.

    I'd also try to contact them even now. If they won't respond, then even if you got the fix, won't really help...

    Ah, another idea/question: swapping between the two datafields does have any effect? Or if it's on an edge, then editing the layout and first only adding your's and only after it connected successfully adding the other DataField? Do then both work?  I guess it will only work for the first 5 minutes?

  • The test code does open the ANT channel in the background, and it still works. So far, I haven't been able to reproduce the issue using the test code.
    Could you clarify what you mean by "how they open the and channel"? If you have a specific method/parameter in mind that might cause this behavior, please let us know.

  • I don't agree with your analysis. I think it's not because they use background. I think it's how they open the ant channel. If you moved your test code to background, I think it would still work

  • I tested your ANT+ HRM Heart Rate Monitor data field, and it works fine alongside the Light Tester. It does not interfere with the onBikeLightUpdate method.

    For users of Tempe Visualizer, I have created a new data field called Tempe Field, which does not use a background service to open the ANT channel. This setup works well with Smart Bike Lights and avoids the interference issue.

    The issue is that both the TyreWiz Data Field and Tempe Visualizer behave as intended from the perspective of their developers. In fact, Tempe Visualizer mentions in its description that it uses a background service to save battery, so this behavior is considered a feature.

    Ideally, I would like to see a fix from Garmin, since it should not be possible for one CIQ application to interfere with another. This seems like a platform-level issue that should be addressed.