• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.bluetooth.pbap (Bluetooth PBAP Module)
2
3The **pbap** module provides APIs for accessing the phone book of a device using the Bluetooth Phone Book Access Profile (PBAP).
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 11. 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 { pbap } from '@kit.ConnectivityKit';
15```
16
17
18## BaseProfile
19
20type BaseProfile = baseProfile.BaseProfile
21
22**BaseProfile** API definition.
23
24**System capability**: SystemCapability.Communication.Bluetooth.Core
25
26| Type                           | Description        |
27| ----------------------------- | ---------- |
28| [baseProfile.BaseProfile](js-apis-bluetooth-baseProfile.md)| **BaseProfile** API definition.|
29
30
31## pbap.createPbapServerProfile
32
33createPbapServerProfile(): PbapServerProfile
34
35Create a **PbapServerProfile** instance.
36
37**System capability**: SystemCapability.Communication.Bluetooth.Core
38
39**Return value**
40
41| Type                           | Description        |
42| ----------------------------- | ---------- |
43|PbapServerProfile | **PbapServerProfile** instance created.|
44
45**Error codes**
46
47For details about the error codes, see [Bluetooth Error Codes](errorcode-bluetoothManager.md).
48
49| ID| Error Message|
50| -------- | ---------------------------- |
51|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.                 |
52|801 | Capability not supported.          |
53
54
55**Example**
56
57```js
58import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
59try {
60    let pbapServerProfile = pbap.createPbapServerProfile();
61    console.info('pbapServer success');
62} catch (err) {
63    console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
64}
65```
66