35edd163创建于 2025年10月21日历史提交

@ohos.bluetooth.map (Bluetooth MAP Module)

The map module provides Bluetooth message access capability based on Message Access Profile (MAP), and supports functions such as obtaining the connection status.

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

import { map } from '@kit.ConnectivityKit';

BaseProfile

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

Type Description
baseProfile.BaseProfile BaseProfile API definition.

map.createMapMseProfile

createMapMseProfile(): MapMseProfile

Creates a Message Server Equipment (MSE) instance. Through this instance, you can use the local device as the MSE and implement functions such as obtaining the Bluetooth message service connection status of the local device.

System capability: SystemCapability.Communication.Bluetooth.Core

Return value

Type Description
MapMseProfile MapMseProfile instance created.

Error codes

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

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

import { BusinessError } from '@kit.BasicServicesKit';

try {
    let mapMseProfile = map.createMapMseProfile();
    console.info('MapMse success');
} catch (err) {
    console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
}

MapMseProfile

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.