I have a codebase that takes from many different sample applications and uses S140. I am interested in using a Characteristic from an iOS Swift Central that sends String data as 8-bit uint8_t data arrays. I can send ASCII characters correctly via sd_ble_gatts_hvx(), but I cannot send data with values > 127. My array is uint8_t, so I should have 0-255 available to me and when debugging or writing to the console I can see values higher than 128. This might make sense if the variable was a signed char, but it's not.
Whenever I send data via sd_ble_gatts_hvx() that has any values > 127, it does not work. An Error Code of 0 is reported, but nothing happens. "Extended ASCII" or ISO-8859-1 should be allowable in uint8_t and I see uint8_t variable types in the code / samples, not signed chars. Can someone help me send full 8-bit data? Thanks!
// Get the 8-bit Data
uint8_t output[ BLE_MAX_DATA_LEN ] = { '\0' }; // 244 with iOS
output[ 0 ] = 'E';
output[ 1 ] = 128; // This is enough to break everything uint16_t status = getData( output, BLE_MAX_DATA_LEN );
// Send BLE uint16_t output_length = strlen( output );
ret_code_t err_code = ble_send_data( output, &output_length );
// Function Definition
uint32_t ble_send_data(uint8_t *p_data, uint16_t *p_length) { hvx_ready = false; return val_update(&m_sem, p_data, p_length, m_conn_handle); }
// Function Definition
uint32_t val_update( ble_sem_t * p_sem, uint8_t * p_data, uint16_t * p_length, uint16_t conn_handle) { ret_code_t err_code; ble_gatts_hvx_params_t hvx_params; ble_sem_client_context_t * p_client; VERIFY_PARAM_NOT_NULL(p_sem); err_code = blcm_link_ctx_get(p_sem->p_link_ctx_storage, conn_handle, (void *) &p_client); VERIFY_SUCCESS(err_code); if (token != BLE_TOKEN_OP) return NRF_ERROR_NOT_SUPPORTED; if ((conn_handle == BLE_CONN_HANDLE_INVALID) || (p_client == NULL)) { return NRF_ERROR_NOT_FOUND; } if (*p_length > BLE_MAX_DATA_LEN) { return NRF_ERROR_INVALID_PARAM; } memset(&hvx_params, 0, sizeof(hvx_params)); hvx_params.handle = p_sem->char_handles.value_handle; hvx_params.p_data = p_data; hvx_params.p_len = p_length; hvx_params.type = BLE_GATT_HVX_NOTIFICATION; return sd_ble_gatts_hvx(conn_handle, &hvx_params); }