ANT+ with NCS BLE scanning

Hello, 

I'm currently working on NCS2.6.0 and ANT sdk v1.3.0, 

I would like to know is it possible to do BLE scanning(without connection) and ANT+ heart rate searching at the same time?

Now I'm able to scan BLE manufacturer data and ANT+ heart rate pages saparately, but I need to combine it on my nRF52832 custom board with NCS platfrom.

Could you provide some suggestions? Thank you.

Here's something in my main.c code for more information:

int ant_stack_setup(void)
{
	int err = ant_init();
	if (err)
	{
		LOG_ERR("ant_init failed: %d", err);
		return err;
	}
	LOG_INF("ANT Version %s", ANT_VERSION_STRING);

	err = ant_cb_register(&ant_evt_handler);
	if (err)
	{
		LOG_ERR("ant_cb_register failed: %d", err);
		return err;
	}

	err = ant_plus_key_set(CONFIG_HRM_RX_NETWORK_NUM);
	if (err)
	{
		LOG_ERR("ant_plus_key_set failed: %d", err);
	}
	return err;
}

static int start_scan(void) {
  uint8_t channel_number = 0;  

  ant_channel_config_t channel_config = {
    .channel_number = channel_number,
    .channel_type = CHANNEL_TYPE_SLAVE_RX_ONLY, 
    .ext_assign = EXT_PARAM_ALWAYS_SEARCH,  
    .rf_freq = 57,  
    .transmission_type = 0,  
    .device_type = 120,  
    .device_number = 0,  
    .channel_period = 8070,  
    .network_number = CONFIG_HRM_RX_NETWORK_NUM
  };

  int err = ant_channel_init(&channel_config);
  if (err) {
    LOG_ERR("ant_channel_init failed: %d", err);
    return err;
  }

  err = ant_channel_open(channel_number);
  if (err) {
    LOG_ERR("ant_channel_open failed: %d", err);
    return err;
  }

  LOG_INF("ANT+ scanning started on channel %d", channel_number);

  return 0;
}

int main(void)
{

	uint32_t baudrate, dtr = 0U;
	int ret;
	int err;
	
	err = ant_stack_setup();
	if (err)
	{
		goto ERROR_EXIT;
	}
	
	err = start_scan();
	if (err) {
		goto ERROR_EXIT;
	}
	
	ret = bt_enable(NULL);
	if (ret)
	{
		printk("Bluetooth init failed (err %d)\n", ret);
		return;
	}

	if (IS_ENABLED(CONFIG_SETTINGS))
	{
		settings_load();
	}

	printk("Bluetooth initialized\n");

	struct bt_le_scan_param scan_param = {
		.type = BT_LE_SCAN_TYPE_ACTIVE,
		.options = BT_LE_SCAN_OPT_CODED,
		.interval = BT_GAP_SCAN_FAST_INTERVAL,
		.window = BT_GAP_SCAN_FAST_WINDOW,
	};

	ret = bt_le_scan_start(&scan_param, scan_cb);
	if (ret)
	{
		printk("Starting scanning failed (err %d)\n", ret);
		return;
	}

	printk("Scanning successfully started\n");
	return 0;
	
ERROR_EXIT:
	ant_state_indicator_fatal_error();
	k_oops();
	
	return 0;
}

Related