# @ohos.bluetooth.pan (è“牙pan模å—)(系统接å£ï¼‰ panæ¨¡å—æä¾›äº†è®¿é—®è“牙个人区域网相关功能的方法。 > **说明:** > > 本模å—首批接å£ä»ŽAPI version 10开始支æŒã€‚åŽç»ç‰ˆæœ¬çš„æ–°å¢žæŽ¥å£ï¼Œé‡‡ç”¨ä¸Šè§’æ ‡å•ç‹¬æ ‡è®°æŽ¥å£çš„起始版本。 > 当å‰é¡µé¢ä»…åŒ…å«æœ¬æ¨¡å—的系统接å£ï¼Œå…¶ä»–公开接å£å‚è§[@ohos.bluetooth.pan (è“牙pan模å—)](js-apis-bluetooth-pan.md) ## å¯¼å…¥æ¨¡å— ```js import { pan } from '@kit.ConnectivityKit'; ``` ## PanProfile 使用PanProfile方法之å‰éœ€è¦åˆ›å»ºè¯¥ç±»çš„实例进行æ“作,通过createPanProfile()æ–¹æ³•æž„é€ æ¤å®žä¾‹ã€‚ ### disconnect disconnect(deviceId: string): void æ–开连接设备的PanæœåŠ¡ã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**: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 panProfile: pan.PanProfile = pan.createPanProfile(); panProfile.disconnect('XX:XX:XX:XX:XX:XX'); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ``` ### setTethering setTethering(enable: boolean): void 设置网络共享状æ€ã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**:ohos.permission.ACCESS_BLUETOOTH å’Œ ohos.permission.MANAGE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **傿•°ï¼š** | 傿•°å | 类型 | å¿…å¡« | 说明 | | ------ | ------ | ---- | ------- | | value | boolean | 是 | 是å¦è®¾ç½®è“牙共享。true表示设置è“牙共享,false表示ä¸è®¾ç½®è“牙共享。 | **错误ç **: 以下错误ç 的详细介ç»è¯·å‚è§[è“牙æœåŠ¡å系统错误ç ](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 panProfile: pan.PanProfile = pan.createPanProfile(); panProfile.setTethering(false); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ``` ### isTetheringOn isTetheringOn(): boolean 获å–网络共享状æ€ã€‚ **系统接å£**ï¼šæ¤æŽ¥å£ä¸ºç³»ç»ŸæŽ¥å£ã€‚ **éœ€è¦æƒé™**:ohos.permission.ACCESS_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **返回值:** | 类型 | 说明 | | --------------------- | --------------------------------- | | boolean | 网络共享开å¯è¿”回true,网络共享关é—返回false。 | **错误ç **: 以下错误ç 的详细介ç»è¯·å‚è§[è“牙æœåŠ¡å系统错误ç ](errorcode-bluetoothManager.md)。 | 错误ç ID | é”™è¯¯ä¿¡æ¯ | | -------- | ---------------------------- | |201 | Permission denied. | |202 | Non-system applications are not allowed to use system APIs. | |801 | Capability not supported. | **示例:** ```js import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit'; try { let panProfile: pan.PanProfile = pan.createPanProfile(); panProfile.isTetheringOn(); } catch (err) { console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message); } ```