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

How to do the services discovery with a bonded device

Hi , 

I have a project there wtih 2 devices , which is 1 slave and 1 master for Immediate alert service. the master will scan the slave for connection , but I don't know when to call the service discovery. once I try to call the discovery function. it will return with "NRF_ERROR_NO_MEM" . 

the central device is modification with example "ble_app_ias" in example/ble_central .

all device develop base on nRF5_SDK_17.0.0_9d13099. 

Parents
  • Hi Kawing,

    Please be aware that on the ias profile the client is located on the peripheral and the server is located on the central. 
    So usually you would do service discovery on the peripheral. That's what you can find in the ble_app_ias_c example. Inside ble_evt_handler() in main.c you can find ble_db_discovery_start() is called after the device is connected (BLE_GAP_EVT_CONNECTED event). 

    If you want you can do service discovery from the central side, but only if you need to do so. You can refer to either the ble_app_ias_c example or other central example, for example ble_app_uart_c. 

Reply
  • Hi Kawing,

    Please be aware that on the ias profile the client is located on the peripheral and the server is located on the central. 
    So usually you would do service discovery on the peripheral. That's what you can find in the ble_app_ias_c example. Inside ble_evt_handler() in main.c you can find ble_db_discovery_start() is called after the device is connected (BLE_GAP_EVT_CONNECTED event). 

    If you want you can do service discovery from the central side, but only if you need to do so. You can refer to either the ble_app_ias_c example or other central example, for example ble_app_uart_c. 

Children
  • Thank for reply. I used other example to develop the central device.

    Now, I can scan and connect the peripherial with bonding ,and then start to do discovery the services uuid 

    but I had a issue now. I added the IAS client module in code. it can do the discovery. but not work for write the alert level to peripherial. it cannot received the write action. Do you have any idea on it ? Thanks.

  • Hi Kawing, 


    Could you explain what exactly the application you are building ? 
    Would it connect to any phone ? 
    If not, I would suggest to test with the ble_app_uart and ble_app_uart_c example. It's the better example if you want to do proprietary protocol. 

    If you need to stick to the IAS profile. I assume now you have the IAS server on the peripheral and the IAS client on the central? 

    Please check if the handle you are writing to is correct. You can verify the behavior with a sniffer trace. With the sniffer you can check if the central actually send any write command. So we know if the issue is only the central or on the peripheral. 

  • Thanks for reply. everything work now. my problem is forget adding the handler for the secure connection pm_handler_secure_on_connection(). 

    Thanks again.

Related