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

How to retrieve Value from multiple Characteristics based Service Handler p_ble_evt->header.evt_id.?

Hi,

 I have one service UUID ffe0 that has two characteristics: one of has UUID ffe4 use for "notify" and other one has UUID ffe5 use for "write and read".

Now i want to get the data from the FFE5 and reply accordingly as per the data that I received from FFE5 suppose I write send data from mobile App to board is "SEND=1" as string to characteristic  UUID FFE5 now according to the message received from the FFE5 service i.e. SEND=1 I want to reflect the characteristic UUID FFE4 as "OK" if the string matches as SEND=1. Now My main Question is How i know when the data is being received from FFE5 characteristic UUID. If I get that as an interrupt or anything I will send a reply as "OK" over the characteristic  UUID FFE4.

I have also created NRF_SDH_BLE_OBSERVER for that service.

But how to get value from the different characteristics UUID like 0xFFE5 and so forth if any .

	switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                p_our_service->conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                break;
            case BLE_GAP_EVT_DISCONNECTED:
                p_our_service->conn_handle = BLE_CONN_HANDLE_INVALID;
                break;
            default:
                // No implementation needed.
                break;
        }
        
        


Thanks in advance.

Parents
  • Hello,

    I suggest that you check out the ble_app_uart example, which works pretty much the way that you describe. There is one characteristic for notifications, and one with write (not read).

    Check out how ble_nus.c generates the event BLE_NUS_EVT_RX_DATA from the BLE_GATTS_EVT_WRITE event in ble_nus_on_ble_evt()

    ble_nus_on_ble_evt() is assigned through NRF_SDH_BLE_OBSERVER(), probably like you have done.

    BR,

    Edvin

  • Thank you @Edvin for your prompt reply,

    I will surely look into the example code ble_app_uart  and will let you know over here about how it will fit and work it out in my application.



  • As a pointer, it will be all about using the BLE_GATTS_EVT_WRITE and check what is written (whether it is CCCD change, which would be to enable notifications or a write to the RX characteristic), and passing it on to the BLE_NUS_EVT_RX_DATA event in main. 

    I did a small course once, which followed this tutorial. This one forwards the notification enabled and notification disabled events to main.c, but the method is pretty much the same. Check out "Step 8" from the guide if you need more input than the ble_app_uart example gives.

    BR,

    Edvin

Reply
  • As a pointer, it will be all about using the BLE_GATTS_EVT_WRITE and check what is written (whether it is CCCD change, which would be to enable notifications or a write to the RX characteristic), and passing it on to the BLE_NUS_EVT_RX_DATA event in main. 

    I did a small course once, which followed this tutorial. This one forwards the notification enabled and notification disabled events to main.c, but the method is pretty much the same. Check out "Step 8" from the guide if you need more input than the ble_app_uart example gives.

    BR,

    Edvin

Children
Related