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

Expand services, characteristics and descriptors from nRF Connect desktop

Hello Team,

I am trying to develop an app with BLE example as the base and modifying it.

Hardware setup:

PC - Windows 10, nRF Connect launcher v3.6.1, BLE example app,  nRF52840 Dongle connected to PC
Peripheral - A small device with a sensor and a nRF52840 SoC transmitting sensor data

After I connect my device as shown in the picture below. the services are discovered and shown automatically.


When I click on a service , it expands and shows the characteristics normally after being connected.
I tried to do this manually via the clicking on UI, as I wanted to discover the characteristics of a service to start using it.

I have tried writing functions to extract characteristics and descriptors in the modified BLE app.
Below is a function to extract Characteristics

        extractChar(service, uuid) {
            const { device, deviceDetails } = this.props;
            const { instanceId } = device;
            let retval;

            if (service) {
                const deviceDetail = deviceDetails.devices.get(instanceId);

                if (!deviceDetail.discoveringChildren) {
                    const chars = service.get('children');

                    if (chars) {
                        chars.forEach(char => {
                            if (char.uuid === uuid) {
                                retval = char;
                            }// if (char.uuid === uuid)
                        });
                    }// if (chars)
                }// if (!deviceDetail.discoveringChildren)
            }// if (service)

            return retval;
        }

Below is a function to extract descriptors

       extractDescriptor(char, uuid) {
            const { device, deviceDetails } = this.props;
            const { instanceId } = device;
            let retval;

            if (char) {
                const deviceDetail = deviceDetails.devices.get(instanceId);

                if (!deviceDetail.discoveringChildren) {
                    const descs = char.get('children');

                    if (descs) {
                        descs.forEach(desc => {
                            if (desc.uuid === uuid) {
                                retval = desc;
                            }// if (desc.uuid === uuid)
                        });
                    }// if (descs)
                }// if (!deviceDetail.discoveringChildren)
            }// if (char)

            return retval;
        }

I have written 4 custom services and they are call using the functions above in an identical way for all the services.
While the above functions do work, but for some reason they always only expand one service and the rest of the services using the same method have 'children' : undefined.

I have tried several times and using several methods. The first custom service expands and the rest are stuck in an endless loop as shown below. They never load and are stuck as such.

Can anyone help or suggest what might be wrong or if there is any other way for me to expand the characteristics and descriptors for my custom services ?

Thanks and regards,
Avi

Parents Reply Children
  • Hello Joakim Jakobsen,

    Thanks for your reply.

    I can see the characteristics and descriptors in nRF Connect mobile.

    I can see the them on the desktop nRF Connect as well, but it is quite unreliable. It does not always load.
    When I try to expand the service by clicking the Services UI elements using mouse, it loads in 90% cases.

    But I am unable to expand the services via the custom desktop app, I have created by modifying the Nordic's BLE application.

    My end goal is to initialize and expand the services so that they are ready before I start pairing as the next step.

    Hope you can understand the problem, in case there is something which isn't clear or you want me to share some specifics which I might've missed, I will be happy to.

    Thanks for your time.

    Regards,
    Avi

  • Thanks for the additional information.

    So this is actually regarding a custom application that you have developed?

    Did you take a look at the developer documentation:
    https://nordicsemiconductor.github.io/pc-nrfconnect-docs/

    Br,
    Joakim

  • Hello Mr. Joakim Jekobsen,

    Thanks for your response.
    I have gone though the complete documentaion.

    But I have also noticed this behavior with the official Nordic BLE app.
    When I click on the services quickly, it shows the same behavior as our custom modified app.

    From my initial findings, everything works in the official Nordic BLE app when I take small delay between expanding the services by clicking on them in the UI. If I click on multiple services in a row, one after the other, it loads characteristics from 2/4 service and the other two are stuck in forever loop and the only way to get out of it is to disconnect the device and reconnect again.

    Maybe a small delay between expanding the services might me needed, I am trying that approach for now. Nordic devs know it in depth, so I wanted to ask if this can be a feasible solution or is there any other workaround that you can suggest.

    Thanks and regards,
    Avi



  • Thank you!

    Then I'll forward this to our developers, so that they can take a closer look at this and hopefully get back with some useful information.

    Note that they might not be able to look at this until next week. But I'll get back to you as soon as I hear back from them.

    Br,
    Joakim

Related