We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesSystemNetworkConnectivity KitArkTS APIs@ohos.bluetooth.map (Bluetooth MAP Module)

@ohos.bluetooth.map (Bluetooth MAP Module)

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

This module provides Bluetooth message access capability based on Message Access Profile (MAP), and supports functions such as creating MSE instances and obtaining and subscribing to the Bluetooth message service connection status between devices. This module is applicable to scenarios where the Bluetooth protocol is used for message access and connection management.

NOTE

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.

Modules to Import

Collapse
Word wrap
Dark theme
Copy code
  1. import { map } from '@kit.ConnectivityKit';

BaseProfile

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

type BaseProfile = baseProfile.BaseProfile

BaseProfile class, which provides public capabilities such as obtaining the connection status and listening for connection status changes.

System capability: SystemCapability.Communication.Bluetooth.Core

Expand
Type Description
baseProfile.BaseProfile BaseProfile API definition.

map.createMapMseProfile

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

createMapMseProfile(): MapMseProfile

Creates a Message Server Equipment (MSE) instance. Through this instance, you can use API provided when the local device is used as the MSE and implement functions such as obtaining the Bluetooth message service connection status of the local device. This API is applicable to scenarios such as Bluetooth message synchronization and viewing messages of the Bluetooth car kit.

System capability: SystemCapability.Communication.Bluetooth.Core

Return value

Expand
Type Description
MapMseProfile MapMseProfile instance. This instance can be used by the local device as an MSE to access Bluetooth messages.

Error codes

For details about the error codes, see Universal Error Codes.

Expand
ID Error Message
401 Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.
801 Capability not supported.

Example

Collapse
Word wrap
Dark theme
Copy code
  1. import { BusinessError } from '@kit.BasicServicesKit';
  2. try {
  3. let mapMseProfile = map.createMapMseProfile();
  4. console.info('MapMse success');
  5. } catch (err) {
  6. console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
  7. }

MapMseProfile

Phone12+PC/2in113+Tablet12+TV19+Wearable18+

Represents the MSE role in MAP.

  • The MapMseProfile class is inherited from BaseProfile. Therefore, you can use the APIs in its parent class.
  • Before using the APIs of this class, you need to construct an MSE instance by calling createMapMseProfile.
  • The counterpart of the MSE role is the MCE role.