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

Read custom characteristics value in multilink example [central]

Hello!

I have a problem with getting a value (uint8_t) from a characteristics.

I am using 2 nrf51422 boards, where one is a central and the other is a peripheral. I have modified the multilink example (peripheral) to make an additional characteristic that holds a value that I would like to read at the central unit. How do I do this?

From several posts here at the forum I found something about BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP... but I am not quite sure if that is the right way, and if so where and how to use it.

Help would be much appreciated.

/Christian

Parents
  • Please have a look at this question.

    If you have the attribute handle of the characteristic value that you want to read you should use sd_ble_gattc_read().

  • @Petter ,

    i wanted to read my char value i tried this but it is returning same value even if the char is changed .

    ble_gatts_hvx_params_t hvx_params;
        memset(&hvx_params, 0, sizeof(hvx_params));
        
    
           hvx_params.handle = p_our_service->mycharHandler.value_handle;
            hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
            hvx_params.offset = 0;
            hvx_params.p_len = &len;
            //hvx_params.p_data = (uint8_t *)temperature_value;
            sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);
          
              printf(" new char:  %d\r\n", *hvx_params.p_data);
    

    i wanted to use this function to read my char but not sure how using sd_ble_gattc_read is it possible to use sd_ble_gattc_read by passing "mycharHandler" ? can you provide me a sudo code for this ?

    thanks

Reply
  • @Petter ,

    i wanted to read my char value i tried this but it is returning same value even if the char is changed .

    ble_gatts_hvx_params_t hvx_params;
        memset(&hvx_params, 0, sizeof(hvx_params));
        
    
           hvx_params.handle = p_our_service->mycharHandler.value_handle;
            hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
            hvx_params.offset = 0;
            hvx_params.p_len = &len;
            //hvx_params.p_data = (uint8_t *)temperature_value;
            sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);
          
              printf(" new char:  %d\r\n", *hvx_params.p_data);
    

    i wanted to use this function to read my char but not sure how using sd_ble_gattc_read is it possible to use sd_ble_gattc_read by passing "mycharHandler" ? can you provide me a sudo code for this ?

    thanks

Children
No Data
Related