Hi @tanghui,
Please look at the next parameters for the Directed Advertisement.
const gapAdvertisingParameters_t gAppAdvParams = {
/* minInterval */ 800 /* 20 ms= 16*1.25ms */, \
/* maxInterval */ 1600 /* 40 ms = 32*1.25ms */, \
/* advertisingType */ gAdvDirectedLowDutyCycle_c, \
/* addressType */ gBleAddrTypePublic_c, \
/* directedAddressType */ gBleAddrTypeRandom_c, \
/* directedAddress */ {0x11,0x22,0x33,0x44,0x55,0x66}, \
/* channelMap */ (gapAdvertisingChannelMapFlags_t) (gAdvChanMapFlag37_c | gAdvChanMapFlag38_c | gAdvChanMapFlag39_c), \
/* filterPolicy */ gProcessAll_c \
};
Regarding the parameters, you need to set in the directed advertising. You need to be careful about configuring direct advertising. Remember that using the High Duty Cycle parameter would require to have a small advertising interval per the specification.
Please refer to the Bluetooth Specification v5.0 -> Vol 6 -> Part B -> 4.4.2.4.3 High Duty Cycle Connectable Directed Advertising.
However, the phone is not capturing the advertisement because of the random address that the phone is using. This is possible but you would need to get the identity key from the phone. In other words, when you are using a random address, this means that you are enabling privacy in your devices. Hence, in order to have a connection with a device using a random address, you would require to bond with such a device and share the identity key (IRK) to be able to resolve the addresses.
Once devices are bonded, you would need to identify what random address is being used by the phone and set such an address in the directed advertising address.
Another way to do it is by knowing the phone's random address in advance and set the random address into the direct advertising parameters. Just had in mind that phone random address is changing periodically, thus, at some point, the phone random address will be different, thus, you would need to update advertising parameters accordingly.
Regards,
Mario