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

Error 0x3001 with pc-ble driver

I try to integrate the Nordic pc-ble driver (Version 4.1.2 API 5) into a Qt application. I use the heart rate collector example to check how I have to integrate the library, but my application returns error code 0x3001 when the application should start the scan:

#include "mainwindow.h"
#include "ui_mainwindow.h"

const char* Port = "COM5";

static const ble_gap_scan_params_t m_scan_param =
{
    0,                       // Set if active scanning.
    0,                       // Set if selective scanning.
    0,
    (uint16_t)0x00A0,
    (uint16_t)0x0050,
    (uint16_t)0x00
};

void MainWindow::StatusHandler(adapter_t* Adapter, sd_rpc_app_status_t Code, const char* Message)
{
    qDebug() << "Status: " << Code << "-" << Message;
}

void MainWindow::ble_evt_dispatch(adapter_t* Adapter, ble_evt_t * p_ble_evt)
{
    qDebug() << "Test";
}

void MainWindow::LogHandler(adapter_t* Adapter, sd_rpc_log_severity_t severity, const char* Message)
{
    qDebug() << "Log: " << severity << "-" << Message;
}

MainWindow::MainWindow(QWidget* parent) :   QMainWindow(parent),
                                            _mUi(new Ui::MainWindow)
{
    ble_cfg_t ble_cfg;
    this->_mUi->setupUi(this);

    this->_mPhy = sd_rpc_physical_layer_create_uart(Port, 1000000, SD_RPC_FLOW_CONTROL_NONE, SD_RPC_PARITY_NONE);
    this->_mData_link_layer = sd_rpc_data_link_layer_create_bt_three_wire(this->_mPhy, 250);
    this->_mTransport_layer = sd_rpc_transport_layer_create(this->_mData_link_layer, 1500);
    this->_mAdapter = sd_rpc_adapter_create(this->_mTransport_layer);
    sd_rpc_log_handler_severity_filter_set(this->_mAdapter, SD_RPC_LOG_INFO);

    qDebug() << "Open nRF BLE Driver...";
    this->_mErrorCode = sd_rpc_open(this->_mAdapter, StatusHandler, ble_evt_dispatch, LogHandler);
    if(this->_mErrorCode != NRF_SUCCESS)
    {
        qDebug() << "Failed to open nRF BLE Driver. Error code: 0x" << hex << this->_mErrorCode;
    }

    qDebug() << "Configure nRF BLE Driver...";
    memset(&ble_cfg, 0, sizeof(ble_cfg));
    ble_cfg.gap_cfg.role_count_cfg.periph_role_count    = 0;
    ble_cfg.gap_cfg.role_count_cfg.central_role_count   = 1;
    ble_cfg.gap_cfg.role_count_cfg.central_sec_count    = 0;
    this->_mErrorCode = sd_ble_cfg_set(this->_mAdapter, BLE_GAP_CFG_ROLE_COUNT, &ble_cfg, 0);
    if(this->_mErrorCode != NRF_SUCCESS)
    {
        qDebug() << "sd_ble_cfg_set() failed when attempting to set BLE_GAP_CFG_ROLE_COUNT. Error code: 0x" << hex << this->_mErrorCode;
    }

    memset(&ble_cfg, 0x00, sizeof(ble_cfg));
    ble_cfg.conn_cfg.conn_cfg_tag                 = m_config_id;
    ble_cfg.conn_cfg.params.gatt_conn_cfg.att_mtu = 150;
    this->_mErrorCode = sd_ble_cfg_set(this->_mAdapter, BLE_CONN_CFG_GATT, &ble_cfg, 0);
    if(this->_mErrorCode != NRF_SUCCESS)
    {
        qDebug() << "sd_ble_cfg_set() failed when attempting to set BLE_CONN_CFG_GATT. Error code: 0x" << hex << this->_mErrorCode;
    }

    qDebug() << "Start scanning...";
    this->_mErrorCode = sd_ble_gap_scan_start(this->_mAdapter, &m_scan_param);
    if(_mErrorCode != NRF_SUCCESS)
    {
        qDebug() << "Scan start failed with error code: 0x" << hex << _mErrorCode;
    }
    else
    {
        qDebug() << "Scan started\n";
    }
}

MainWindow::~MainWindow()
{
    delete this->_mUi;
}

I don´t understand which SVC handler is missing.

Related