1/*
2 * Copyright (c) 2023 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 * @addtogroup HdiHidDdk
18 * @{
19 *
20 * @brief Provides HID DDK APIs, including creating a device, sending an event, and destroying a device.
21 *
22 * @since 4.1
23 * @version 1.0
24 */
25
26 /**
27 * @file IHidDdk.idl
28 *
29 * @brief Declares the HID DDK interfaces for the host to access an input device.
30 *
31 * @since 4.1
32 * @version 1.0
33 */
34
35package ohos.hdi.input.ddk.v1_0;
36
37import ohos.hdi.input.ddk.v1_0.HidDdkTypes;
38
39/**
40 * @brief Declares the HID DDK interfaces for the host to access an input device.
41 */
42interface IHidDdk {
43    /**
44     * @brief Creates a device.
45     *
46     * @param hidDevice Pointer to the basic information required for creating a device, including the device name,
47     * vendor ID, and product ID. For details, see {@link Hid_Device}.
48     * @param hidEventProperties Pointer to the events of the device to be observed, including the event type and
49     * properties of the key event, absolute coordinate event, and relative coordinate event. For details, see {@link Hid_EventProperties}.
50     * @param deviceId uint32_t number for storing newly created device ID if the operation is successful.
51     *
52     * @return Returns <b>0</b> if the operation is successful.
53     * @return Returns a negative value if the operation fails.
54     *
55     *
56     * @since 4.1
57     * @version 1.0
58     */
59    CreateDevice([in] struct Hid_Device hidDevice, [in] struct Hid_EventProperties hidEventProperties, [out] unsigned int deviceId);
60
61    /**
62     * @brief Sends an event list to a device.
63     *
64     * @param deviceId ID of the device, to which the event list is sent.
65     * @param items List of events to sent. The event information includes the event type (<b>Hid_EventType</b>),
66     * event code (<b>Hid_SynEvent</b> for a synchronization event code, <b>Hid_KeyCode</b> for a key code,
67     * <b>Hid_AbsAxes</b> for an absolute coordinate code, <b>Hid_RelAxes</b> for a relative coordinate event,
68     * and <b>Hid_MscEvent</b> for other input event code), and value input by the device.
69     *
70     * @return Returns <b>0</b> if the operation is successful.
71     * @return Returns a negative value if the operation fails.
72     *
73     *
74     * @since 4.1
75     * @version 1.0
76     */
77    EmitEvent([in] unsigned int deviceId, [in] struct Hid_EmitItem[] items);
78
79    /**
80     * @brief Destroys a device.
81     *
82     * @param deviceId ID of the device to destroy.
83     *
84     * @return Returns <b>0</b> if the operation is successful.
85     * @return Returns a negative value if the operation fails.
86     *
87     *
88     * @since 4.1
89     * @version 1.0
90     */
91    DestroyDevice([in] unsigned int deviceId);
92}
93
94/** @} */