This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Questions regarding Mesh Android app:

thanks for the answer on the previous post.

What I came to know from our firmware engineer was that your initial version of the Android app could not support

1. multiple subscriptions for the nodes and

2. also adding clients

But he said he read somewhere that this functionality is there in the Android library but is disabled.

Can you tell me the handlers and data structures to do these 2 things in my version of the app?

Parents
  • Hi,

    1. The app supports mulitple subscriptions and is not disabled.

    2. Adding clients is not supported yet in the app. That's something that will be implemented in the near future. This is a more complex functionality that will need some time to build. Unfortunately its not something I can explain here. You will have to do it manually in your UI by creating the Models you need for this.

  • I was trying to send data to the mesh using the method of:

    mMeshManagerApi.setGenericOnOffUnacknowledged(mMeshManagerApi.getProvisionedNodes().get(5),
                    genericOnOffServerModel,
                    new byte[]{0x00, 0x05},
                    0,
                    null,
                    null,
                    null,
                    isLightOn);

    I've declared the model as:

    GenericOnOffServerModel genericOnOffServerModel = new GenericOnOffServerModel(0x1000);

    However, I get the error of model not having a binding with an app key like below:

    java.lang.IllegalArgumentException: Please bind an app key to this model to control this model!
            at no.nordicsemi.android.meshprovisioner.MeshManagerApi.setGenericOnOffUnacknowledged(MeshManagerApi.java:881)
            at no.nordicsemi.android.nrfmeshprovisioner.MainFragment.send(MainFragment.java:72)
            at no.nordicsemi.android.nrfmeshprovisioner.MainFragment_ViewBinding$1.doClick(MainFragment_ViewBinding.java:30)

    I then used the method mentioned in MeshManagerApi as:

    mMeshManagerApi.bindAppKey(mMeshManagerApi.getProvisionedNodes().get(5),
    new byte[]{0x00, 0x05},
    genericOnOffServerModel,
    0);

    It doesn't work. Am I doing something wrong?
    Also what should I enter in AppKeyIndex? Where is this array and how do I get it?
  • Not sure entirely what you're trying to do by declaring a model. When you provision a node, the library will create all the models that are available in the node. So all you have to do is just list all the models you need by just calling node.getMeshModels(). From what I see you're creating a model in the app and turn on the same model in the app, so it does not look right to me.

    Also binding app keys works fine on our end so you must be doing something wrong in your implementation.

    Before binding an app key an app key should be added to that particular node. Hope that is done and if that's the case that app key should be bound to a specific model you want to talk to.

    So as you have done bindAppKey index should work as it is. Also When you send a bindAppKey message you should get a Model App Status and that will contain if its successful or not and is handled in the library. You can find the status codes in the specification as well.

    When it comes to app key index, you can get it from the node.getAddedAppKeys() list for that specific node. When you try to bind an appKey you need to specify the index of that particular appkeyindex. If you follow our example you should see this.

  • I have already added an app key to the generic on off server model in the node's element. If I do a:

    mMeshManagerApi.getProvisionedNodes().get(5).getAddedAppKeys();

    I can get a Map of bound app keys. I've seen that the app key is correct. That means that the app key is bound to the node.

    I could not find a getMeshModels() like you mentioned above.

    mMeshManagerApi.getProvisionedNodes().get(5).getMeshModels();

    So how can I use getMeshModels()

    Can you tell me In your code, in which file are you binding app keys to models?

  • Sorry that was my bad, it should be mMeshManagerApi.getProvisionedNodes().get(5).getElements(elementaddress).getMeshModels.

    This because models belong to a certain element in a node. Look at ModelConfigurationActivity and you should see sendBindAppKey()

  • I was seeing that activity itself. I could see:

    final MeshModel model = mViewModel.getMeshModel().getValue();
            if(model != null){
                if(model instanceof GenericOnOffServerModel) {

    On line 326. But it uses ConfigurationModel

    But there is no sendBindAppKey() over there.

  • You can find it on line 261 in ModelConfigurationActivity.java

    sendBindAppKey(appKeyIndex)
Reply Children
Related