I haven't tried your code, but you can give a look at the following project, which uses something similar:
Thanks for the info.
That helped a bit. But maybe I misunderstand something: Is the bonding required to use direct advertising?
You do NOT need to be bonded to send directed advertising, but normally you are advertising to a bonded device, no? :)
It should always be possible to do directed advertising, as it just attaches an address of the device you are directing the advertising towards.