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

connecting the peripherals using mac address by central

Hi.. i am using nRF52832  ... 15.2 sdk Version. i'm trying to communicate between a central device and a peripheral.so if multiple peripherals are present and all of their mac id is known.how can i select a particular peripheral to connect by using central not via mobile app. 

Parents
  • Hello,

    Look at any of the central examples from the SDK. E.g. The ble_app_uart_c will filter on UUID in the advertising packets. 

    If you look in sdk_config.h of this example, you can try to set NRF_BLE_SCAN_UUID_CNT to 0, and set NRF_BLE_SCAN_ADDRESS_CNT to 1.

    Then, in scan_init() in main.c, you need to change 

    nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_nus_uuid);

    to use the address instead of the UUID.

    BR,

    Edvin

  • I tried ... i changed .. but i want to add my bluetooth mac address  (DF:EF:CE:56:78:FD) This is the address i need to pass where should pass ?

      err_code = nrf_ble_scan_filter_set(&m_scan,  SCAN_ADDR_FILTER, m_target_address);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER , false);
        APP_ERROR_CHECK(err_code);

Reply
  • I tried ... i changed .. but i want to add my bluetooth mac address  (DF:EF:CE:56:78:FD) This is the address i need to pass where should pass ?

      err_code = nrf_ble_scan_filter_set(&m_scan,  SCAN_ADDR_FILTER, m_target_address);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER , false);
        APP_ERROR_CHECK(err_code);

Children
No Data
Related