# @ohos.bluetooth.map (è“牙map模å—)(系统接å£ï¼‰ mapæ¨¡å—æä¾›äº†è®¿é—®ä¿¡æ¯ç›¸å…³åŠŸèƒ½çš„æ–¹æ³•ã€‚ > **说明:** > > 本模å—首批接å£ä»ŽAPI version 11开始支æŒã€‚åŽç»ç‰ˆæœ¬çš„æ–°å¢žæŽ¥å£ï¼Œé‡‡ç”¨ä¸Šè§’æ ‡å•ç‹¬æ ‡è®°æŽ¥å£çš„起始版本。 > 当å‰é¡µé¢ä»…åŒ…å«æœ¬æ¨¡å—的系统接å£ï¼Œå…¶ä»–公开接å£å‚è§[@ohos.bluetooth.map (è“牙map模å—)](js-apis-bluetooth-map.md) ## å¯¼å…¥æ¨¡å— ```js import { map } from '@kit.ConnectivityKit'; ``` ### disconnect disconnect(deviceId: string): void æ–开连接设备的mapæœåŠ¡ã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**:ohos.permission.ACCESS_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **傿•°ï¼š** | 傿•°å | 类型 | å¿…å¡« | 说明 | | ------ | ------ | ---- | ------- | | deviceId | string | 是 | 远端设备地å€ã€‚ | **错误ç **: 以下错误ç 的详细介ç»è¯·å‚è§[è“牙æœåŠ¡å系统错误ç ](errorcode-bluetoothManager.md)。 | 错误ç ID | é”™è¯¯ä¿¡æ¯ | | -------- | ---------------------------- | |201 | Permission denied. | |202 | Non-system applications are not allowed to use system APIs. | |401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | |801 | Capability not supported. | |2900001 | Service stopped. | |2900003 | Bluetooth disabled. | |2900004 | Profile not supported. | |2900099 | Operation failed. | **示例:** ```js import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; try { let mapMseProfile = map.createMapMseProfile(); mapMseProfile.disconnect('XX:XX:XX:XX:XX:XX'); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ``` ### setMessageAccessAuthorization setMessageAccessAuthorization(deviceId: string, authorization: AccessAuthorization): Promise<void> 设置信æ¯çš„访问æƒé™ã€‚使用Promise异æ¥å›žè°ƒã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**:ohos.permission.ACCESS_BLUETOOTH å’Œ ohos.permission.MANAGE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **傿•°ï¼š** | 傿•°å | 类型 | å¿…å¡« | 说明 | | -------- | ------ | ---- | ----------------------------------- | | deviceId | string | 是 | 表示远端设备地å€ï¼Œä¾‹å¦‚:"XX:XX:XX:XX:XX:XX"。 | | authorization | [AccessAuthorization](js-apis-bluetooth-constant-sys.md#AccessAuthorization) | 是 | 表示访问æƒé™æžšä¸¾å€¼ã€‚ | **返回值:** | 类型 | 说明 | | ------------------------------------------------- | ------------------- | | Promise<void> | 以Promise的形å¼è¿”回结果。如果æˆåŠŸï¼Œerr为undefined的,å¦åˆ™ä¸ºé”™è¯¯å¯¹è±¡ã€‚ | **错误ç **: 以下错误ç 的详细介ç»è¯·å‚è§[è“牙æœåŠ¡å系统错误ç ](errorcode-bluetoothManager.md)。 | 错误ç ID | é”™è¯¯ä¿¡æ¯ | | -------- | ---------------------------- | |201 | Permission denied. | |202 | Non-system applications are not allowed to use system APIs. | |401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | |801 | Capability not supported. | |2900001 | Service stopped. | |2900003 | Bluetooth disabled. | |2900004 | Profile not supported. | |2900099 | Operation failed. | **示例:** ```js import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; try { let mapMseProfile = map.createMapMseProfile(); mapMseProfile.setMessageAccessAuthorization('XX:XX:XX:XX:XX:XX', 0).then(() => { console.info('setMessageAccessAuthorization'); }); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ``` ### getMessageAccessAuthorization getMessageAccessAuthorization(deviceId: string): Promise<AccessAuthorization> 获å–ä¿¡æ¯çš„访问æƒé™ã€‚使用Promise异æ¥å›žè°ƒã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**:ohos.permission.ACCESS_BLUETOOTH å’Œ ohos.permission.MANAGE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **傿•°ï¼š** | 傿•°å | 类型 | å¿…å¡« | 说明 | | -------- | ------ | ---- | ----------------------------------- | | deviceId | string | 是 | 表示远端设备地å€ï¼Œä¾‹å¦‚:"XX:XX:XX:XX:XX:XX"。 | **返回值:** | 类型 | 说明 | | ------------------------------------------------- | ------------------- | | Promise<[AccessAuthorization](js-apis-bluetooth-constant-sys.md#AccessAuthorization)> | 以Promise的形å¼è¿”回结果。如果æˆåŠŸï¼Œerr为undefined的,å¦åˆ™ä¸ºé”™è¯¯å¯¹è±¡ã€‚ | **错误ç **: 以下错误ç 的详细介ç»è¯·å‚è§[è“牙æœåŠ¡å系统错误ç ](errorcode-bluetoothManager.md)。 | 错误ç ID | é”™è¯¯ä¿¡æ¯ | | -------- | ---------------------------- | |201 | Permission denied. | |202 | Non-system applications are not allowed to use system APIs. | |401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed. | |801 | Capability not supported. | |2900001 | Service stopped. | |2900003 | Bluetooth disabled. | |2900004 | Profile not supported. | |2900099 | Operation failed. | **示例:** ```js import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; try { let mapMseProfile = map.createMapMseProfile(); mapMseProfile.getMessageAccessAuthorization('XX:XX:XX:XX:XX:XX').then((authorization) => { console.info('authorization ' + authorization); }); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ```