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

Can nou update Characteristic value

I've created read onle characteristic called "log". In  main.c i try to update it by calling : ulogd_characteristic_update(&m_ulog_service,Log_Data_arr)

But nothing happens, can you solve my issue (p.s. I am new to ble)


void ulogd_characteristic_update(ble_ulog_service_t *p_ulog_service, int32_t *log_data)
{
if (p_ulog_service->conn_handle != BLE_CONN_HANDLE_INVALID)
{
uint16_t len = 10;
ble_gatts_hvx_params_t hvx_params;
memset(&hvx_params, 0, sizeof(hvx_params));

hvx_params.handle = p_ulog_service->ulog_char_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = log_data;


sd_ble_gatts_hvx(p_ulog_service->conn_handle, &hvx_params);
}

}

Parents
  • Hi,

    • Are you already in a connection before you call sd_ble_gatts_hvx?
      • if you are in a connection, what does sd_ble_gatts_hvx() return? 
    • Do you only want to update the characteristic or do you also want to notify the central that the characteristic has changed? If you only want to update the characteristic then you should use sd_ble_gatts_value_set() instead. 
Reply
  • Hi,

    • Are you already in a connection before you call sd_ble_gatts_hvx?
      • if you are in a connection, what does sd_ble_gatts_hvx() return? 
    • Do you only want to update the characteristic or do you also want to notify the central that the characteristic has changed? If you only want to update the characteristic then you should use sd_ble_gatts_value_set() instead. 
Children
No Data
Related