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

How to read URI hash on Un-provisioned Device Beacon with Android app

Hi,

I am trying to modify the Android nRF Mesh app to filter un-provisioned devices with URI hash contained on un-provisioned device beacon.

My question is how I can read the URI hash (4 bytes) in Android app.

I tried to check URI hash in onScanResult callback of ScannerRepository in ScannerRepository.java.

But, I can't find where the URI hash is stored.
I investigated the ScanResult passed as "result", but could not find anything related to URI hash.

It would be great if someone could advise me on how to get the URI hash on Android, using Android-nRF-Mesh-Library.



The mesh node I use is a nRF52840DK with Light Switch Client sample in nRF5 SDK for Mesh ver5.0.0. 
And, the phone which runs nRF Mesh app is Google Pixel 3a with Android ver.11.
I cloned nRF Mesh app from the repo below, and build it on Android Studio 4.2.1.

Also, I am sure that the URI hash does exist on un-provisioned device beacon from the node.
I checked the content of the un-provisioned device beacon with nRF Sniffer for Bluetooth.

I am not an expert of Bluetooth mesh and Android.
This is my first time to post something here.
I would really appreciate any advice.
  • Hi, thanks for the detailed explanation. So I think you have misunderstood me here. You don't need to connect to a device to filter it. You can filter the unprovisioned devices based on the service the device is advertising with. Once you provision the device it will start advertising with a Mesh Proxy Service with which you can filter provisioned devices from unprovisioned devices. If you refer to our sample we use the mesh provisioning service to filter the unprovisioning service to filter the unprovisioned  mesh devices and also Mesh Proxy Service to filter the provisioned mesh devices. You don't need to use the beacons here at all in my opinion. Please check here this should let you understand what's happenning. We set the Mesh Provisioning Service UUID and this filters out and returns only the unprovisioned mesh devices allowing you to connect and provision them etc.

  • Hi Roshan-san,

    Thank you again for your kind reply.

    Now I understand what you said. You are trying to explain the way to select provisioned nodes from many devices using service UUID. I know it is not so difficult. Unprovisioned devices have the Mesh Provisioning Service, and provisioned nodes usually have the Mesh Proxy Service. This is what you are explaining, isn't it?
    Again, please let me know if I have misunderstood something.

    But, unfortunately, it is not what we want to do.
    Probably, I wrote something ambiguous or misleading. I am sorry for my poor English or explanation.

    Please let me explain what we want to do, using the use case I wrote above.
    At the beginning, all devices are unprovisioned.
    And, a provisioner needs to find the unprovisioned devices in the same room.

    To achieve this, we want to use the URI hash carried on unprovisioned device beacon.
    In this case, we assign a URI to the devices and the provisioner in the same room.
    (Of course, we use different URIs for different rooms.)

    I hope this clarifies what we want to do.
    Please ask me anything, if you need.


    Also, I found a similar Q&A in DevZone.
    Identifying unprovisioned mesh device
    In the Q&A, they also use URI to select a particular set of unprovisioned devices.
    They use a provisioner on iOS, but the issue is very close to my question.
    Please refer the Q&A, if something I wrote is unclear.


    Anyway, I investigated the code you mentioned. The ScanFilter uses service UUIDs, device name, device address, and something related to the service. I am afraid I can't use this to achieve what we want to do.

    It would be great if someone could tell me how I can read URI hash on unprovisioned device beacon in Android app using Android nRF Mesh Library.

    Best regards,
    Toshi

Related