• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit MultimodalAwarenessKit
19 */
20
21import type { Callback } from "./@ohos.base";
22
23/**
24 * This module provides the capability to subscribe to report the action or motion.
25 *
26 * @namespace motion
27 * @syscap SystemCapability.MultimodalAwarness.Motion
28 * @since 15
29 */
30
31declare namespace motion {
32  /**
33   * Enum for operating hand status.
34   *
35   * @enum { number } OperatingHandStatus
36   * @syscap SystemCapability.MultimodalAwarness.Motion
37   * @since 15
38   */
39  export enum OperatingHandStatus {
40    /**
41     * indicates nothing has been detected.
42     *
43     * @syscap SystemCapability.MultimodalAwarness.Motion
44     * @since 15
45     */
46    UNKNOWN_STATUS = 0,
47    /**
48     * indicates the operating hand is left hand.
49     *
50     * @syscap SystemCapability.MultimodalAwarness.Motion
51     * @since 15
52     */
53    LEFT_HAND_OPERATED = 1,
54    /**
55     * indicates the operating hand is right hand.
56     *
57     * @syscap SystemCapability.MultimodalAwarness.Motion
58     * @since 15
59     */
60    RIGHT_HAND_OPERATED = 2
61  }
62
63  /**
64   * Subscribe to detect the operating hand changed event.
65   * @permission ohos.permission.ACTIVITY_MOTION
66   * @param { 'operatingHandChanged' } type - Indicates the event type.
67   * @param { Callback<OperatingHandStatus> } callback - Indicates the callback for getting the event data.
68   * @throws { BusinessError } 201 - Permission denied. An attempt was made to subscribe operatingHandChanged
69   * <br> event forbidden by permission: ohos.permission.ACTIVITY_MOTION.
70   * @throws { BusinessError } 401 - Parameter error. Parameter verification failed.
71   * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited
72   * <br> device capabilities.
73   * @throws { BusinessError } 31500001 - Service exception.
74   * @throws { BusinessError } 31500002 - Subscribe Failed.
75   * @syscap SystemCapability.MultimodalAwarness.Motion
76   * @since 15
77   */
78  function on(type: 'operatingHandChanged', callback: Callback<OperatingHandStatus>): void;
79
80  /**
81   * Unsubscribe to detect the operating hand changed event.
82   * @permission ohos.permission.ACTIVITY_MOTION
83   * @param { 'operatingHandChanged' } type - Indicates the event type.
84   * @param { Callback<OperatingHandStatus> } callback - Indicates the callback for getting the event data.
85   * @throws { BusinessError } 201 - Permission denied. An attempt was made to unsubscribe operatingHandChanged
86   * <br> event forbidden by permission: ohos.permission.ACTIVITY_MOTION.
87   * @throws { BusinessError } 401 - Parameter error. Parameter verification failed.
88   * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited
89   * <br> device capabilities.
90   * @throws { BusinessError } 31500001 - Service exception.
91   * @throws { BusinessError } 31500003 - Unsubscribe Failed.
92   * @syscap SystemCapability.MultimodalAwarness.Motion
93   * @since 15
94   */
95  function off(type: 'operatingHandChanged', callback?: Callback<OperatingHandStatus>): void;
96
97  /**
98   * Get the recent operating hand status.
99   * @permission ohos.permission.ACTIVITY_MOTION
100   * @returns { OperatingHandStatus } The result of operating hand status.
101   * @throws { BusinessError } 201 - Permission denied. An attempt was made to get the recent operating hand
102   * <br> status forbidden by permission: ohos.permission.ACTIVITY_MOTION.
103   * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited
104   * <br> device capabilities.
105   * @throws { BusinessError } 31500001 - Service exception.
106   * @syscap SystemCapability.MultimodalAwarness.Motion
107   * @since 15
108   */
109  function getRecentOperatingHandStatus(): OperatingHandStatus;
110}
111export default motion;
112