/**@brief Function for passing any pending request from the buffer to the stack. */ static void tx_buffer_process(void) { if (m_tx_index != m_tx_insert_index) { uint32_t err_code; if (m_tx_buffer[m_tx_index].type == READ_REQ) { err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, m_tx_buffer[m_tx_index].req.read_handle, 0); } else { err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, &m_tx_buffer[m_tx_index].req.write_req.gattc_params); } if (err_code == NRF_SUCCESS) { LOG("[BAS_C]: SD Read/Write API returns Success..\r\n"); m_tx_index++; m_tx_index &= TX_BUFFER_MASK; } else { LOG("[BAS_C]: SD Read/Write API returns error. This message sending will be " "attempted again..\r\n"); } } }
uint32_t ble_pixwatch_c_local_time_read(ble_pixwatch_c_t const * p_pixwatch) { if (p_pixwatch->local_time_handle == BLE_GATT_HANDLE_INVALID) { return NRF_ERROR_NOT_FOUND; } return sd_ble_gattc_read(p_pixwatch->conn_handle, p_pixwatch->local_time_handle, 0); }
bool nRF51822::readRemoteCharacteristic(BLERemoteCharacteristic& characteristic) { bool success = false; for (int i = 0; i < this->_numRemoteCharacteristics; i++) { if (this->_remoteCharacteristicInfo[i].characteristic == &characteristic) { if (this->_remoteCharacteristicInfo[i].valueHandle && this->_remoteCharacteristicInfo[i].properties.read) { this->_remoteRequestInProgress = true; success = (sd_ble_gattc_read(this->_connectionHandle, this->_remoteCharacteristicInfo[i].valueHandle, 0) == NRF_SUCCESS); } break; } } return success; }
/**@brief Function for passing any pending request from the buffer to the stack. */ static void tx_buffer_process(void) { if (m_tx_index != m_tx_insert_index) { uint32_t err_code; if (m_tx_buffer[m_tx_index].type == READ_REQ) { err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle, m_tx_buffer[m_tx_index].req.read_handle, 0); } else { err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle, &m_tx_buffer[m_tx_index].req.write_req.gattc_params); } if (err_code == NRF_SUCCESS) { ++m_tx_index; m_tx_index &= TX_BUFFER_MASK; } } }