1# @ohos.bluetooth.hfp (Bluetooth HFP Module) 2 3The **hfp** module provides APIs for using the Bluetooth Hands-Free Profile (HFP). 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9 10 11## Modules to Import 12 13```js 14import { hfp } from '@kit.ConnectivityKit'; 15``` 16 17 18## hfp.createHfpAgProfile 19 20createHfpAgProfile(): HandsFreeAudioGatewayProfile 21 22Creates an **HfpAgProfile** instance. 23 24**System capability**: SystemCapability.Communication.Bluetooth.Core 25 26**Return value** 27 28| Type | Description | 29| ----------------------------- | ---------- | 30| HandsFreeAudioGatewayProfile | **HfpAgProfile** instance created.| 31 32**Error codes** 33 34For details about the error codes, see [Bluetooth Error Codes](errorcode-bluetoothManager.md). 35 36| ID| Error Message| 37| -------- | ---------------------------- | 38|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | 39|801 | Capability not supported. | 40 41**Example** 42 43```js 44import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; 45try { 46 let hfpAgProfile = hfp.createHfpAgProfile(); 47 console.info('hfpAg success'); 48} catch (err) { 49 console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); 50} 51``` 52 53 54## HandsFreeAudioGatewayProfile 55 56Before using any API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **createHfpAgProfile()**. 57