Get the Central Device's information on nrf52 peripheral (NCS)

I am trying to get the information of a couple different UUID's from the central device so that my peripheral device (nrf52840) can reflect the right name and other information of the central device. Is there an example or function I can use in NCS to look up those UUIDs?

  • Hello,

    It is not very common for peripherals to use services that a central owns. In fact, it is not very common that centrals have services at all, but if it is a phone, it may have some.

    The only sample that I can think of is the ncs\nrf\samples\bluetooth\peripheral_cts, which uses the current time service in that most phones have, and read out the current time. 

    But please note that phones may have different services, so the one you are looking for may not be present for all phones. Are you sure this is really the method you want to go with? Usually it is the Central that decides whether to be connected or not. 

    What will you do depending on who that connects? Will the peripheral behave any differently? I suspect we are looking at an XY problem here.

    Best regards,

    Edvin

  • I'm trying to find out what phone I am connecting to (iPhone vs Android) because there is a slight behavior difference between the two os's that my peripheral has to account for

  • Ok.

    This is a request that we rarely get, so keep that in mind. Therefore we also don't have any samples doing this.

    What difference is it that you need to account for? Perhaps there is an easier way of doing this.

    If you need to, however, then you need to find out what service you are looking for. You can connect your phone to nRF Connect for Desktop, using a DK as a peripheral/advertiser inside nRF Connect for Desktop, and you can connect to it from your phone, and see what services your phone has.

    Then you can check out the CTS sample from my previous reply, and see if you can modify it to read out the service that you are looking for instead of the CTS service.

    BR,
    Edvin

Related