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 Reply Children
  • I have the source code for the most initial version of Android where Generic on off was not implemented. Does this version allow un-provisioning? If so which Java file does it and how to call these structure in my Activity? Or can I just click on a mesh node and there is a un-provision button?

  • You'll have to clone the latest version from github and use that, there is an example in it where you can call resetNode. If you follow the latest implementation on github you could see what's available.

  • There is one more thing which many other developers might need. The pain point of this library is the documentation. My firmware counterpart gets a lot of documentation from the Nordic website. He gets explanations of each and every statement of the firmware SDK up to the point where the input and output parameters of each function, structure, object, etc. He even easily gets any getting started examples, intermediate examples .etc. The Android library, however, doesn't explain anything. Absolutely nothing. We desperately need documentation for the Android nRF Mesh library. Along with documentation of using examples and getting started guides .etc. I'm understanding your code in bits and pieces but I need concrete documentation on how to use it and what can be achieved with which statements to go ahead and start changing it for my use.

    Like if I want to send a certain msg byte array to a certain 2-byte element address then how do I send it? Where to get started? Which structures to use? I need to be sure what the answers are and not spend many hours implementing something that may be wrong.

  • Hey, If you look at each and every message that is implemented, there is a class for every message. In MeshConfigurationhandler.java  there is bindAppKey method. youll see that there is a class with ConfigModelAppBind. In this class there is createAccessMessage() method whcih creates a message and executeSend() that sends a message. Once you send a message, a received corresponding notification is handled in the MeshConfigurationHandler in the parseConfigurationNotifications method. This is as simple as it can be and can't that difficult to follow the same principle. This will be common for all messages that you will implement. If you just follow the same principle you can implement any message you want.

    Please note that this is not a production ready library yet and we have not implemented the whole mesh specification.

  • I can see in ModelConfigurationActivity.java where you have implemented 

    mViewModel.getExtendedMeshNode().getMeshNode();

    and

    mViewModel.sendGenericOnOff(node, .... );

    at lines 347 and 352 respectively. This gets me to the first question:

    1) Does that mean that I can get the mesh node reference I'm connected to using this piece of code from any of my Activities?

    Now, mViewModel is of type ModelConfigurationViewModel which in turn relates to ModelConfigurationRepository. This ModelConfigurationRepository, in turn, sends control messages to a mBinder which is declared in the extended class of BaseMeshRepository. Over here, mBinder is declared as MeshService.MeshServiceBinder. In the service, it looks like the Binder connects to a device and uses BleMeshManagerApi.

    2) So basically, my idea was that you can directly cut through all of the other structures and just use the mBleMeshManagerApi or MeshServiceBinder from the service to connect and send messages. Is this possible and is it the right way of doing it?

    3) Also, regarding the MeshService. I want to have control over the when the service starts and stops. How do I do that?

    4) I have an activity which connects to your MainActivity which does scanning and connection to the network in the respective fragments. Also, somewhere, (I don't know where) your MainActivity starts the MeshService. But after connecting to a Proxy node, if I press Back on MainActivity which goes to my activity, the service stops and disconnects from the proxy. I don't want it to stop and disconnect from the proxy. How do I achieve this?

    5) Now if that is solved, I want to use the mBleMeshManagerApi that the service is using. I will have to use either Binder or something of the service from my activity to send data to the mesh. How do I get the MeshService Context such that I can get the context of:

    mMeshManagerApi = new MeshManagerApi(this);

    at line 221 in the service. I guess that is only how I can use the service BleMeshManagerApi. How do I do it?

Related