Ticket Created
over 4 years ago

WERETECH-10039

ANT+ Battery Status

The latest in the saga for Battery Status. I used an ANT+ dongle on my Windows Laptop, and paired it with the Eclipse Simulator. I tried both an older Garmin Cadence Sensor, and a brand new one (the one that does both ANT and BT). Same outcome. In both cases, the CIQ data field immediately gets Device State info. After maybe 30-40 seconds, the ProductInfo.serial number comes thru. Just like in real life when paired to a real Garmin Edge computer. But in both cases, even after several minutes, the Battery Status remains null.

When I pair the new cadence sensor to my actual Garmin Edge computer, the Battery Status does come up as OK within 15 seconds or so and then maybe 30 seconds later the Serial # info comes through.

Any clue why the polling code isn't seeing the Battery Status?

Oh, also, the State Update Listener is triggering, but the BatteryStatusListener is not.

  • ok so I also got 4 voltage readings after pairing my cadence sensor 2. So when can we expect another page 4 update? Every few minutes? Or only upon a state change? And to be safe, should I also issue a sendPageRequest for pages 4 and 82, to handle all devices and manufacturers that don't implement ANT+ well? We're getting closer. Thank you! /resized-image/__size/320x240/__key/commentfiles/fb5d84b10a5745448a7a45dafc1faa43-bef7cf5b-cf7f-40ec-813a-c5651a6c4bee/pastedimage1605006086260v1.png
  • Did you also setup a sendPageRequest() for pages 4 and 82? It throws an exception if you request a particular page more frequently than every 2 seconds. I'll setup logic in compute to send those requests every 10 seconds. I know page 4 might not need that request, but it can't hurt, right? Also that onMessage only handles page 82. I'll add another section for page 4. Is the parsing the same for page 4? /resized-image/__size/320x240/__key/commentfiles/fb5d84b10a5745448a7a45dafc1faa43-bef7cf5b-cf7f-40ec-813a-c5651a6c4bee/pastedimage1605004625497v1.png
  • [quote userid="63734" url="~/developer/connect-iq/f/discussion/245190/ant-battery-status/1162376"]There were more messages in that output (with the "Ant: [RX]..." messages).  I removed the duplicates.[/quote] There are always duplicates, sensors are sending each page 4 times in row. This is in case of interference or timing you might miss some messages.
  • Excellent, so it is indeed sending the data page 4. But still using getBatteryState() returns nothing? If so, I'd say this is a bug in AntPlus API then, and should enter bug ticket. For all devices, it should handle both page 4 (or any other profile specific battery state page) or common page 82, and provide it to us. The main reason of using for example getBatteryState() is that you don't have to do the data parsing yourself.
  • There were more messages in that output (with the "Ant: [RX]..." messages).  I removed the duplicates. So, looks like we need to be a bit crafty with decoding the ANT message...