diff --git a/api/@ohos.bluetooth.d.ts b/api/@ohos.bluetooth.d.ts index f6a50ad9b5d88a0e7f4e4410c4039006808c5248..8da9a3597a63adba33b23b85dccad644d0259810 100644 --- a/api/@ohos.bluetooth.d.ts +++ b/api/@ohos.bluetooth.d.ts @@ -356,6 +356,15 @@ declare namespace bluetooth { */ function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile; + /** + * Obtains the instance of profile. + * + * @param profileId The profile id.. + * @return Returns instance of profile. + * @since 9 + */ + function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile; + /** * Base interface of profile. */ @@ -476,6 +485,51 @@ declare namespace bluetooth { off(type: "connectionStateChange", callback?: Callback): void; } + /** + * Manager hid host profile. + */ + interface HidHostProfile extends BaseProfile { + /** + * Connect to device with hid host. + * + * @param device The address of the remote device to connect. + * @return Returns {@code true} if the connect is in process; returns {@code false} otherwise. + * @since 9 + * @permission permission ohos.permission.DISCOVER_BLUETOOTH + * @systemapi Hide this for inner system use. + */ + connect(device: string): boolean; + + /** + * Disconnect to device with hid host. + * + * @param device The address of the remote device to disconnect. + * @return Returns {@code true} if the disconnect is in process; returns {@code false} otherwise. + * @since 9 + * @permission permission ohos.permission.DISCOVER_BLUETOOTH + * @systemapi Hide this for inner system use. + */ + disconnect(device: string): boolean; + + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param type Type of the profile connection state changes event to listen for . + * @param callback Callback used to listen for event. + * @since 9 + */ + on(type: "connectionStateChange", callback: Callback): void; + + /** + * Unsubscribe the event reported when the profile connection state changes. + * + * @param type Type of the profile connection state changes event to listen for. + * @param callback Callback used to listen for event. + * @since 9 + */ + off(type: "connectionStateChange", callback?: Callback): void; + } + namespace BLE { /** * create a JavaScript Gatt server instance. @@ -1471,12 +1525,22 @@ declare namespace bluetooth { /** * The enum of profile id. - * - * @since 8 */ enum ProfileId { + /** + * @since 8 + */ PROFILE_A2DP_SOURCE = 1, + + /** + * @since 8 + */ PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4, + + /** + * @since 9 + */ + PROFILE_HID_HOST = 6, } }