arquicanedo / barbecueboss

Barbecue ConnectIQ App for Garmin Devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Tenergy] ProfileRegistrationException: Too Many Profiles

arquicanedo opened this issue · comments

Tenergy crashes when the probe is enabled 3 times.

Screen Shot 2020-07-14 at 5 16 51 PM

Generates this runtime error

Error: Unhandled Exception
Exception: ProfileRegistrationException: Too Many Profiles
Stack:

  • initialize() at /Users/canedo/eclipse-workspace/barbecue_app/ext/tenergy/lib/ciq-tenergy-solis-barrel/core/BluetoothDelegate.mc:87 0x10004114
  • initialize() at /Users/canedo/eclipse-workspace/barbecue_app/source/Controllers/BluetoothController.mc:17 0x100038a7
  • setMeatProbeEnabled() at /Users/canedo/eclipse-workspace/barbecue_app/source/Controller.mc:149 0x10005e20
  • onMeatProbeToggled() at /Users/canedo/eclipse-workspace/barbecue_app/source/Views/Smoke/SmokeSettingsInputDelegate.mc:76 0x10002034

I found this note in the BLE documentation related to registerProfile

Registration can fail if too many profiles are registered, the current limit is 3.

That explains why on the third enable we get the error above. This seems to be a limitation in the BLE implementation of connectIQ. If that session registers 3 times it crashes.

I wrapped the registerProfile call in a try-catch. However, this may introduce weird behaviors as the BLE is interpreting as 3 profiles registered for that session.

After you review we can close.

I'm going to move the registration out the constructor for the bluetooth delegate and into a method in the TenergySolis module. It only needs to be done once when the app starts regardless of how many times you connect/disconnect from the device. So really, it should only be call one time ever during the runtime of the app instance.

move the profile registration into an initialize() method in the TenergySolaris module. Now, when the controller initializes bluetooth it also calls this method (first) to make sure the profile is registered. This bluetooth setup (creating the controller) only happens once on app start so we shouldn't have any more trouble with this.

I see the initialize() call from Controller.mc:123 but it does not find it. It looks like the update to the repo does not automatically update the modules. Can you please push the changes also to the ext/tenergy module?

d'oh, forgot about that. fixed & pushed

Working now. Thanks!

Closing.