This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to work with direct advetisement mode?

Hi, How to work with the connectable directed advertisement (BLE_GAP_ADV_TYPE_ADV_DIRECT_IND) event? I modified the ble_app_template application to support direct advertisement as below,

ble_gap_addr_t           peer_address;
		uint8_t address[6];          // 0xC95C7529746C
            address[0] =   0x6c;
	    address[1] =   0x74;
	    address[2] =   0x29;
	    address[3] =   0x75;
	    address[4] =   0x5c;
	    address[5] =   0xc9;
    peer_address.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
    memcpy(peer_address.addr,address,6);

    // Start advertising
    memset(&adv_params, 0, sizeof(adv_params));
                             
    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
    adv_params.p_peer_addr = &peer_address;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;  
    adv_params.interval    = 0;   
    adv_params.timeout     = 0;

I can see the device advertise (MCP) but i couldn't able to connect with it (advertising_start at BLE_GAP_EVT_TIMEOUT), So please suggest me how to use the direct advertisement mode, so that i can avoid unwanted connection request's.

Regards, Balaji

  • Your modifications to the template looks correct, except that you should have:

    address[0] = 0xC9; address[1] = 0x5C; address[2] = 0x75; address[3] = 0x29; address[4] = 0x74; address[5] = 0x6C;

  • Hi Balaji,

    The address here is the address of the peer, in this case the MCP, and the address should be in little endian as you have written.

    When you use directed advertising, then you have only 1.25s to make a connection. So you need to do this quickly in the MCP. You could put the device in advertising when you receive the timeout, but this could block other advertising packets, and use a lot of power.

    BR Pål

Related