NordicSemiconductor / IOS-nRF-Mesh-Library

Provision, configure and control Bluetooth mesh devices with nRF Mesh library.
https://www.nordicsemi.com/
BSD 3-Clause "New" or "Revised" License
305 stars 120 forks source link

How to migrate a custom model from library version 3.2.0 to 4.1.0? #595

Closed FluffyBunniesTasteTheBest closed 7 months ago

FluffyBunniesTasteTheBest commented 7 months ago

Version

4.1.0 (latest)

Ask the question

Do custom models require any modifications when updating the library from version 3.2.0 to 4.1.0? If so, which?

Some more details: The app is in production since about one and a half years and it is working well with library version 3.2.0. Now, after migrating to version 4.1.0 our custom model behaves a little funny:

  1. Replies from the custom model are now received through MeshNetworkDelegate.didReceiveMessage(), rather than ModelDelegate.didReceiveResponse() Well, a little copy&past could easily fix it, question is, is this intended?
  2. When some data comes in, the following message is logged: Local Vendor Model model on Primary Element (0x0001) not bound to key: Application Key 1 (index: 0) Interesting is, that the reply/status message is properly received through MeshNetworkDelegate.didReceiveMessage(). Beside that, ConfigModelAppBind is sent to the local model during app initialization.

Again, everything was working well with the version 3.2.0, so it seems like I've overlooked some crucial steps. So any ideas on what to consider when migrating a custom model to library version 4.1.0 are very much appreciated.

Thank you very much for your help - and for providing this library!

Relevant log output

No response

philips77 commented 7 months ago

Do custom models require any modifications when updating the library from version 3.2.0 to 4.1.0? If so, which?

No, nothing should change here. Perhaps only thing that vendor messages should extend either UnacknowledgedVendorMessage, AcknowledgedVendorMessage or VendorResponse, but perhaps you made that change already.

  1. Replies from the custom model are now received through MeshNetworkDelegate.didReceiveMessage(), rather than ModelDelegate.didReceiveResponse() Well, a little copy&past could easily fix it, question is, is this intended?

MeshNetworkDelegate.didReceiveMessage() reports all received messages, while ModelDelegate.didReceiveResponse() reports messages targeting the given model, i.e.:

  1. When some data comes in, the following message is logged: Local Vendor Model model on Primary Element (0x0001) not bound to key: Application Key 1 (index: 0) Interesting is, that the reply/status message is properly received through MeshNetworkDelegate.didReceiveMessage().

That means, that the second condition isn't met. The local vendor model seems not to be bound to the App Key.

Beside that, ConfigModelAppBind is sent to the local model during app initialization.

Now, that is the real issue. This seems not to work. Check if you're binding the right App Key to the correct Model, check if after that call the model is bound (you may export network configuration and check JSON).

philips77 commented 7 months ago

Btw, that works in the nRF Mesh app. After setting up local models I can control the state of the LED remotely.