NordicSemiconductor / Android-nRF-Mesh-Library

The Bluetooth Mesh Provisioner and Configurator library.
https://www.nordicsemi.com/
BSD 3-Clause "New" or "Revised" License
414 stars 177 forks source link

networkIdMatches method with only one param of class MeshManagerApi is missing in 2.4.3 #468

Closed ZubairAkber closed 2 years ago

ZubairAkber commented 2 years ago

Describe the bug I just pull the latest code and build it successfully, but when i create my own project and included 'no.nordicsemi.android:mesh:2.4.3' as library and try to call networkIdMatches method, i found that the overloaded method is missing with one argument that is present in the project.

To Reproduce Simply add 'no.nordicsemi.android:mesh:2.4.3' in your project and try to call networkIdMatches method of MeshManagerApi class with one argument only

Expected behavior The overloaded method should be available

roshanrajaratnam commented 2 years ago

Hi is there a reason why you are not using 3.1.6? The sample app and the mesh library should be the same version.

ZubairAkber commented 2 years ago

Hi, i am just trying to build my own wrapper class that will only do the provisioning part, so for that i just include the library, if that method is missing, i will use the library code available in the project, i just want to confirm either it is not added or some other version contains that method

roshanrajaratnam commented 2 years ago

I don't see an issue with version 2.4.3 https://github.com/NordicSemiconductor/Android-nRF-Mesh-Library/blob/1677257b1b23661b7e85b22da2c7e7cbdedce25b/mesh/src/main/java/no/nordicsemi/android/mesh/MeshManagerApi.java#L757

https://github.com/NordicSemiconductor/Android-nRF-Mesh-Library/blob/1677257b1b23661b7e85b22da2c7e7cbdedce25b/app/src/main/java/no/nordicsemi/android/nrfmesh/viewmodels/ScannerRepository.java#L86

Also I would recommend upgrading to using the latest 3.1.6 version as it adds support to the official Mesh Configuration Database as well and you will avoid some migration issues that was reported in the pre 3.0.0 version of the library.

ZubairAkber commented 2 years ago

This is missing in the library but available in the project

@Override
public boolean networkIdMatches(@Nullable final byte[] serviceData) {
    final byte[] advertisedNetworkId = getAdvertisedNetworkId(serviceData);
    if (advertisedNetworkId != null) {
        for (NetworkKey key : mMeshNetwork.getNetKeys()) {
            if (Arrays.equals(key.getNetworkId(), advertisedNetworkId) || Arrays.equals(key.getOldNetworkId(), advertisedNetworkId))
                return true;
        }
    }
    return false;
}
roshanrajaratnam commented 2 years ago

Hi, check the source directory it is in the mesh library and has been since version 1.0. Check the following line, it's called from the app and the method is in the library.

https://github.com/NordicSemiconductor/Android-nRF-Mesh-Library/blob/1677257b1b23661b7e85b22da2c7e7cbdedce25b/app/src/main/java/no/nordicsemi/android/nrfmesh/viewmodels/ScannerRepository.java#L86

Also the included app is a sample app on how to use the library in your own project