Refer to this post,I did the same job to change simple_on_off model into generic OnOff Model, and I could control the LED state with nRF Mesh application as well.
I have saw the source code for “nRF Mesh”(Android-nRF-Mesh-Library), and I got the code like that ModelConfigurationActivity.java
//Line 346 try { final ProvisionedMeshNode node = mViewModel.getExtendedMeshNode().getMeshNode(); if(mActionOnOff.getText().toString().equals(getString(R.string.action_generic_on))){ /*mActionOnOff.setText(R.string.action_generic_off); onOffState.setText(R.string.generic_state_on);*/ //TODO wait for sdk implementation to test for transition state mViewModel.sendGenericOnOff(node, mTransitionStep, mTransitionStepResolution, delaySeekBar.getProgress(), true); } else { /*mActionOnOff.setText(R.string.action_generic_on); onOffState.setText(R.string.generic_state_off);*/ //TODO wait for sdk implementation to test for transition state mViewModel.sendGenericOnOff(node, mTransitionStep, mTransitionStepResolution, delaySeekBar.getProgress(), false); } mActionOnOff.setEnabled(false); showProgressbar(); } catch (IllegalArgumentException ex) { Toast.makeText(this, ex.getMessage(), Toast.LENGTH_SHORT).show(); }
Can you help me explain the API used above?
Does the current version of the library support other SIG Models?
I want to know if I can use the same method to control a custom model, is there any related posts or tutorials?
Best Regards,
Bomin