From 65081dc320baa0e5493f49547abe4050988ebdc1 Mon Sep 17 00:00:00 2001 From: MisterE Date: Wed, 10 Sep 2025 17:08:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=BE=E4=BA=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MisterE --- ...s.distributedHardware.mechanicManager.d.ts | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/api/@ohos.distributedHardware.mechanicManager.d.ts b/api/@ohos.distributedHardware.mechanicManager.d.ts index 3937362248..5d7c730169 100644 --- a/api/@ohos.distributedHardware.mechanicManager.d.ts +++ b/api/@ohos.distributedHardware.mechanicManager.d.ts @@ -302,6 +302,23 @@ declare namespace mechanicManager { */ function off(type: 'rotationAxesStatusChange', callback?: Callback): void; + /** + * Searching for a specified target. + * + * @param { TargetInfo } target - Target infomation. + * @param { SearchParams } params - Parameters to use when searching. + * @returns { Promise } Promise that return the Search result. + * @throws { BusinessError } 202 - Not system application. + * @throws { BusinessError } 33300001 - Service exception. + * @throws { BusinessError } 33300002 - Device not connected. + * @throws { BusinessError } 33300003 - Feature not supported. + * @throws { BusinessError } 33300004 - Camera not opened. + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + function searchTarget(target: TargetInfo, params: SearchParams): Promise; + /** * Mechanical device information. * @typedef MechInfo @@ -693,6 +710,64 @@ declare namespace mechanicManager { mechInfo: MechInfo, } + /** + * Target information. + * + * @typedef TargetInfo + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + export interface TargetInfo { + /** + * Target type. + * @type { TargetType } + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + targetType: TargetType; + } + + /** + * Parameters for target searching. + * + * @typedef SearchParams + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + export interface SearchParams { + + /** + * Search direction. + * @type { SearchDirection } + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + direction: SearchDirection; + } + + /** + * Search result. + * + * @typedef SearchResult + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + export interface SearchResult { + /** + * Search result. Returns the number of targets found.0 means not found. + * @type { number } + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + targetCount: number; + } + /** * Enumerates the user operations. * @enum { number } @@ -875,6 +950,57 @@ declare namespace mechanicManager { RIGHT = 3 } + /** + * Target type. + * + * @enum { int } + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + export enum TargetType { + /** + * human Face type. + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + HUMAN_FACE = 0 + } + + /** + * Search direction. + * + * @enum { int } + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + export enum SearchDirection { + /** + * System Default Direction. + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + DEFAULT = 0, + + /** + * Leftward direction. Also indicates clockwise direction. + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + LEFTWARD = 1, + + /** + * Rightward direction. Also indicates the counterclockwise direction. + * @syscap SystemCapability.Mechanic.Core + * @systemapi + * @since 21 + */ + RIGHTWARD = 2, + } } export default mechanicManager; \ No newline at end of file -- Gitee