diff --git a/api/@ohos.distributedHardware.mechanicManager.d.ts b/api/@ohos.distributedHardware.mechanicManager.d.ts index 393736224823c1c8f5ed080689502e1b2ec84403..5d7c7301693ae5d33292e9ccaa1149bada27d8ad 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 diff --git a/api/device-define/default.json b/api/device-define/default.json index 5cd750e6f2a4187df68c7595f855dcf9780279f0..643653f37368beecafca0e04bdfa3fbe45bedfdb 100644 --- a/api/device-define/default.json +++ b/api/device-define/default.json @@ -234,6 +234,7 @@ "SystemCapability.Ability.AppExtension.PhotoEditorExtension", "SystemCapability.Resourceschedule.BackgroundProcessManager", "SystemCapability.Test.PerfTest", - "SystemCapability.ResourceSchedule.SystemLoad" + "SystemCapability.ResourceSchedule.SystemLoad", + "SystemCapability.Mechanic.Core" ] } diff --git a/api/device-define/tablet.json b/api/device-define/tablet.json index d14d531849b7ae870b273c9ca1d33b477a8cd65b..551ead7491490cb43b365289b2da82c6e39199f4 100644 --- a/api/device-define/tablet.json +++ b/api/device-define/tablet.json @@ -226,6 +226,7 @@ "SystemCapability.Resourceschedule.BackgroundProcessManager", "SystemCapability.Test.PerfTest", "SystemCapability.DistributedHardware.DistributedHardwareFWK", - "SystemCapability.ResourceSchedule.SystemLoad" + "SystemCapability.ResourceSchedule.SystemLoad", + "SystemCapability.Mechanic.Core" ] }