/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @addtogroup HdiHidDdk
* @{
*
* @brief Provides HID DDK APIs, including creating a device, sending an event, and destroying a device.
*
* @since 4.1
* @version 1.0
*/
/**
* @file IHidDdk.idl
*
* @brief Declares the HID DDK interfaces for the host to access an input device.
*
* @since 4.1
* @version 1.0
*/
package ohos.hdi.input.ddk.v1_0;
import ohos.hdi.input.ddk.v1_0.HidDdkTypes;
/**
* @brief Declares the HID DDK interfaces for the host to access an input device.
*/
interface IHidDdk {
/**
* @brief Creates a device.
*
* @param hidDevice Pointer to the basic information required for creating a device, including the device name,
* vendor ID, and product ID. For details, see {@link Hid_Device}.
* @param hidEventProperties Pointer to the events of the device to be observed, including the event type and
* properties of the key event, absolute coordinate event, and relative coordinate event. For details, see {@link Hid_EventProperties}.
* @param deviceId uint32_t number for storing newly created device ID if the operation is successful.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
*
* @since 4.1
* @version 1.0
*/
CreateDevice([in] struct Hid_Device hidDevice, [in] struct Hid_EventProperties hidEventProperties, [out] unsigned int deviceId);
/**
* @brief Sends an event list to a device.
*
* @param deviceId ID of the device, to which the event list is sent.
* @param items List of events to sent. The event information includes the event type (Hid_EventType),
* event code (Hid_SynEvent for a synchronization event code, Hid_KeyCode for a key code,
* Hid_AbsAxes for an absolute coordinate code, Hid_RelAxes for a relative coordinate event,
* and Hid_MscEvent for other input event code), and value input by the device.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
*
* @since 4.1
* @version 1.0
*/
EmitEvent([in] unsigned int deviceId, [in] struct Hid_EmitItem[] items);
/**
* @brief Destroys a device.
*
* @param deviceId ID of the device to destroy.
*
* @return Returns 0 if the operation is successful.
* @return Returns a negative value if the operation fails.
*
*
* @since 4.1
* @version 1.0
*/
DestroyDevice([in] unsigned int deviceId);
}
/** @} */