Is there a way to pair and connect programmatically to a remote device in Hands-Free-Profile (HFP) mode?
So far I am able to just connect to the remote device in the normal way through code. I require to connect to the remote device in the HFP profile mode.
I don't really understand what you are trying to do here. HFP is a profile, once you have a BT pairing and connection, you can then connect the HFP profile.
HFP itself is not used for pairning.
This is where HFP fits in to the whole of things (from official BT specification HFP_1.6)
There is more information on how to initiate the Service Level Connection in the official documentation Check page 19