• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OH_NativeXComponent Native XComponent
18  * @{
19  *
20  * @brief Describes the surface and touch event held by the ArkUI XComponent, which can be used for the EGL/OpenGL ES\n
21  *        and media data input and displayed on the ArkUI XComponent.
22  *
23  * @since 8
24  * @version 1.0
25  */
26 
27 /**
28  * @file native_interface_xcomponent.h
29  *
30  * @brief Declares APIs for accessing a Native XComponent.
31  *
32  * @since 8
33  * @version 1.0
34  */
35 
36 #ifndef _NATIVE_INTERFACE_XCOMPONENT_H_
37 #define _NATIVE_INTERFACE_XCOMPONENT_H_
38 
39 #include <stdbool.h>
40 #include <stdint.h>
41 #include <vector>
42 
43 #include "native_xcomponent_key_event.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #define OH_NATIVE_XCOMPONENT_OBJ ("__NATIVE_XCOMPONENT_OBJ__")
50 
51 const uint32_t OH_XCOMPONENT_ID_LEN_MAX = 128;
52 const uint32_t OH_MAX_TOUCH_POINTS_NUMBER = 10;
53 
54 /**
55  * @brief Enumerates the API access states.
56  *
57  * @since 8
58  * @version 1.0
59  */
60 enum {
61     /** Successful. */
62     OH_NATIVEXCOMPONENT_RESULT_SUCCESS = 0,
63     /** Failed. */
64     OH_NATIVEXCOMPONENT_RESULT_FAILED = -1,
65     /** Invalid parameters. */
66     OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER = -2,
67 };
68 
69 typedef enum {
70     /** Trigger a touch event when a finger is pressed. */
71     OH_NATIVEXCOMPONENT_DOWN = 0,
72     /** Trigger a touch event when a finger is lifted. */
73     OH_NATIVEXCOMPONENT_UP,
74     /** Trigger a touch event when a finger moves on the screen in pressed state. */
75     OH_NATIVEXCOMPONENT_MOVE,
76     /** Trigger an event when a touch event is canceled. */
77     OH_NATIVEXCOMPONENT_CANCEL,
78     /** Invalid touch type. */
79     OH_NATIVEXCOMPONENT_UNKNOWN,
80 } OH_NativeXComponent_TouchEventType;
81 
82 /**
83  * @brief Represents the touch point tool type.
84  *
85  * @since 9
86  * @version 1.0
87  */
88 typedef enum {
89     /** Indicates invalid tool type. */
90     OH_NATIVEXCOMPONENT_TOOL_TYPE_UNKNOWN = 0,
91     /** Indicates a finger. */
92     OH_NATIVEXCOMPONENT_TOOL_TYPE_FINGER,
93     /** Indicates a stylus. */
94     OH_NATIVEXCOMPONENT_TOOL_TYPE_PEN,
95     /** Indicates a eraser. */
96     OH_NATIVEXCOMPONENT_TOOL_TYPE_RUBBER,
97     /** Indicates a brush. */
98     OH_NATIVEXCOMPONENT_TOOL_TYPE_BRUSH,
99     /** Indicates a pencil. */
100     OH_NATIVEXCOMPONENT_TOOL_TYPE_PENCIL,
101     /** Indicates a brush. */
102     OH_NATIVEXCOMPONENT_TOOL_TYPE_AIRBRUSH,
103     /** Indicates a mouse. */
104     OH_NATIVEXCOMPONENT_TOOL_TYPE_MOUSE,
105     /** Indicates a lens. */
106     OH_NATIVEXCOMPONENT_TOOL_TYPE_LENS,
107 } OH_NativeXComponent_TouchPointToolType;
108 
109 /**
110  * @brief Represents the touch event source type.
111  *
112  * @since 9
113  * @version 1.0
114  */
115 typedef enum {
116     /** Indicates an unknown input source type. */
117     OH_NATIVEXCOMPONENT_SOURCE_TYPE_UNKNOWN = 0,
118     /** Indicates that the input source generates a mouse multi-touch event. */
119     OH_NATIVEXCOMPONENT_SOURCE_TYPE_MOUSE,
120     /** Indicates that the input source generates a touchscreen multi-touch event. */
121     OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHSCREEN,
122     /** Indicates that the input source generates a touchpad multi-touch event. */
123     OH_NATIVEXCOMPONENT_SOURCE_TYPE_TOUCHPAD,
124     /** Indicates that the input source generates a joystick multi-touch event. */
125     OH_NATIVEXCOMPONENT_SOURCE_TYPE_JOYSTICK,
126     /**
127      * @brief Indicates that the input source generates a keyboard event.
128      *
129      * @since 10
130      * @version 1.0
131      */
132     OH_NATIVEXCOMPONENT_SOURCE_TYPE_KEYBOARD,
133 } OH_NativeXComponent_EventSourceType;
134 
135 /**
136  * @brief Represents the mouse event action.
137  *
138  * @since 9
139  * @version 1.0
140  */
141 typedef enum {
142     OH_NATIVEXCOMPONENT_MOUSE_NONE = 0,
143     OH_NATIVEXCOMPONENT_MOUSE_PRESS,
144     OH_NATIVEXCOMPONENT_MOUSE_RELEASE,
145     OH_NATIVEXCOMPONENT_MOUSE_MOVE,
146 } OH_NativeXComponent_MouseEventAction;
147 
148 /**
149  * @brief Represents the mouse event button.
150  *
151  * @since 9
152  * @version 1.0
153  */
154 typedef enum {
155     OH_NATIVEXCOMPONENT_NONE_BUTTON = 0,
156     OH_NATIVEXCOMPONENT_LEFT_BUTTON = 0x01,
157     OH_NATIVEXCOMPONENT_RIGHT_BUTTON = 0x02,
158     OH_NATIVEXCOMPONENT_MIDDLE_BUTTON = 0x04,
159     OH_NATIVEXCOMPONENT_BACK_BUTTON = 0x08,
160     OH_NATIVEXCOMPONENT_FORWARD_BUTTON = 0x10,
161 } OH_NativeXComponent_MouseEventButton;
162 
163 /**
164  * @brief Represents the source tool type of TouchEvent
165  *
166  * @since 10
167  * @version 1.0
168  */
169 typedef enum {
170     OH_NATIVEXCOMPONENT_SOURCETOOL_UNKNOWN = 0,
171     OH_NATIVEXCOMPONENT_SOURCETOOL_FINGER = 1,
172     OH_NATIVEXCOMPONENT_SOURCETOOL_PEN = 2,
173     OH_NATIVEXCOMPONENT_SOURCETOOL_RUBBER = 3,
174     OH_NATIVEXCOMPONENT_SOURCETOOL_BRUSH = 4,
175     OH_NATIVEXCOMPONENT_SOURCETOOL_PENCIL = 5,
176     OH_NATIVEXCOMPONENT_SOURCETOOL_AIRBRUSH = 6,
177     OH_NATIVEXCOMPONENT_SOURCETOOL_MOUSE = 7,
178     OH_NATIVEXCOMPONENT_SOURCETOOL_LENS = 8,
179     OH_NATIVEXCOMPONENT_SOURCETOOL_TOUCHPAD = 9,
180 } OH_NativeXComponent_TouchEvent_SourceTool;
181 
182 typedef struct {
183     /** Unique identifier of a finger. */
184     int32_t id;
185     /** X coordinate of the touch point relative to the left edge of the screen. */
186     float screenX;
187     /** Y coordinate of the touch point relative to the upper edge of the screen. */
188     float screenY;
189     /** X coordinate of the touch point relative to the left edge of the element to touch. */
190     float x;
191     /** Y coordinate of the touch point relative to the upper edge of the element to touch. */
192     float y;
193     /** Touch type of the touch event. */
194     OH_NativeXComponent_TouchEventType type;
195     /** Contact area between the finger pad and the screen. */
196     double size;
197     /** Pressure of the current touch event. */
198     float force;
199     /** Timestamp of the current touch event. */
200     int64_t timeStamp;
201     /** The angle betweenprojection on plane-X-Y and axis-Z of the current touch event. */
202     float titlX;
203     /** The angle betweenprojection on plane-Y-Z and axis-Z of the current touch event. */
204     float titlY;
205     /** The sourceTool of the current touch event. */
206     OH_NativeXComponent_TouchEvent_SourceTool sourceTool;
207 } OH_NativeXComponent_HistoricalPoint;
208 
209 typedef struct {
210     /** Unique identifier of a finger. */
211     int32_t id;
212     /** X coordinate of the touch point relative to the left edge of the screen. */
213     float screenX;
214     /** Y coordinate of the touch point relative to the upper edge of the screen. */
215     float screenY;
216     /** X coordinate of the touch point relative to the left edge of the element to touch. */
217     float x;
218     /** Y coordinate of the touch point relative to the upper edge of the element to touch. */
219     float y;
220     /** Touch type of the touch event. */
221     OH_NativeXComponent_TouchEventType type;
222     /** Contact area between the finger pad and the screen. */
223     double size;
224     /** Pressure of the current touch event. */
225     float force;
226     /** Timestamp of the current touch event. */
227     int64_t timeStamp;
228     /** Whether the current point is pressed. */
229     bool isPressed;
230 } OH_NativeXComponent_TouchPoint;
231 
232 // Represents the touch point information.
233 typedef struct {
234     /** Unique identifier of a finger. */
235     int32_t id;
236     /** X coordinate of the touch point relative to the left edge of the screen. */
237     float screenX;
238     /** Y coordinate of the touch point relative to the upper edge of the screen. */
239     float screenY;
240     /** X coordinate of the touch point relative to the left edge of the element to touch. */
241     float x;
242     /** Y coordinate of the touch point relative to the upper edge of the element to touch. */
243     float y;
244     /** Touch type of the touch event. */
245     OH_NativeXComponent_TouchEventType type;
246     /** Contact area between the finger pad and the screen. */
247     double size;
248     /** Pressure of the current touch event. */
249     float force;
250     /** ID of the device where the current touch event is generated. */
251     int64_t deviceId;
252     /** Timestamp of the current touch event. */
253     int64_t timeStamp;
254     /** Array of the current touch points. */
255     OH_NativeXComponent_TouchPoint touchPoints[OH_MAX_TOUCH_POINTS_NUMBER];
256     /** Number of current touch points. */
257     uint32_t numPoints;
258 } OH_NativeXComponent_TouchEvent;
259 
260 /**
261  * @brief Represents the mouse event information.
262  *
263  * @since 9
264  * @version 1.0
265  */
266 typedef struct {
267     /** X coordinate of the mouse point relative to the left edge of the element to mouse. */
268     float x;
269     /** Y coordinate of the mouse point relative to the upper edge of the element to mouse. */
270     float y;
271     /** X coordinate of the mouse point relative to the left edge of the screen. */
272     float screenX;
273     /** Y coordinate of the mouse point relative to the upper edge of the screen. */
274     float screenY;
275     /** Timestamp of the current mouse event. */
276     int64_t timestamp;
277     /** Mouse event action. */
278     OH_NativeXComponent_MouseEventAction action;
279     /** Mouse event button. */
280     OH_NativeXComponent_MouseEventButton button;
281 } OH_NativeXComponent_MouseEvent;
282 
283 /**
284  * @brief Provides an encapsulated <b>OH_NativeXComponent</b> instance.
285  *
286  * @since 8
287  * @version 1.0
288  */
289 typedef struct OH_NativeXComponent OH_NativeXComponent;
290 
291 /**
292  * @brief Registers the surface lifecycle and touch event callbacks.
293  *
294  * @since 8
295  * @version 1.0
296  */
297 typedef struct OH_NativeXComponent_Callback {
298     /** Called when the surface is created. */
299     void (*OnSurfaceCreated)(OH_NativeXComponent* component, void* window);
300     /** Called when the surface is changed. */
301     void (*OnSurfaceChanged)(OH_NativeXComponent* component, void* window);
302     /** Called when the surface is destroyed. */
303     void (*OnSurfaceDestroyed)(OH_NativeXComponent* component, void* window);
304     /** Called when a touch event is triggered. */
305     void (*DispatchTouchEvent)(OH_NativeXComponent* component, void* window);
306 } OH_NativeXComponent_Callback;
307 
308 /**
309  * @brief Registers the mouse event callbacks.
310  *
311  * @since 9
312  * @version 1.0
313  */
314 typedef struct OH_NativeXComponent_MouseEvent_Callback {
315     /** Called when a mouse event is triggered. */
316     void (*DispatchMouseEvent)(OH_NativeXComponent* component, void* window);
317     /** Called when a hover event is triggered. */
318     void (*DispatchHoverEvent)(OH_NativeXComponent* component, bool isHover);
319 } OH_NativeXComponent_MouseEvent_Callback;
320 
321 struct OH_NativeXComponent_KeyEvent;
322 /**
323  * @brief Provides an encapsulated <b>OH_NativeXComponent_KeyEvent</b> instance.
324  *
325  * @since 10
326  * @version 1.0
327  */
328 typedef struct OH_NativeXComponent_KeyEvent OH_NativeXComponent_KeyEvent;
329 
330 /**
331  * @brief Obtains the ID of the ArkUI XComponent.
332  *
333  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
334  * @param id Indicates the char buffer to keep the ID of this <b>OH_NativeXComponent</b> instance.\n
335  *        Notice that a null-terminator will be appended to the char buffer, so the size of the\n
336  *        char buffer should be at least as large as the size of the real id length plus 1.\n
337  *        It is recommended that the size of the char buffer be [OH_XCOMPONENT_ID_LEN_MAX + 1].
338  * @param size Indicates the pointer to the length of <b>id</b>, which you can set and receive.
339  * @return Returns the status code of the execution.
340  * @since 8
341  * @version 1.0
342  */
343 int32_t OH_NativeXComponent_GetXComponentId(OH_NativeXComponent* component, char* id, uint64_t* size);
344 
345 /**
346  * @brief Obtains the size of the surface held by the ArkUI XComponent.
347  *
348  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
349  * @param window Indicates the native window handler.
350  * @param width Indicates the pointer to the width of the current surface.
351  * @param height Indicates the pointer to the height of the current surface.
352  * @return Returns the status code of the execution.
353  * @since 8
354  * @version 1.0
355  */
356 int32_t OH_NativeXComponent_GetXComponentSize(
357     OH_NativeXComponent* component, const void* window, uint64_t* width, uint64_t* height);
358 
359 /**
360  * @brief Obtains the offset of the surface held by the ArkUI XComponent.
361  *
362  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
363  * @param window Indicates the native window handler.
364  * @param x Indicates the pointer to the x coordinate of the current surface.
365  * @param y Indicates the pointer to the y coordinate of the current surface.
366  * @return Returns the status code of the execution.
367  * @since 8
368  * @version 1.0
369  */
370 int32_t OH_NativeXComponent_GetXComponentOffset(
371     OH_NativeXComponent* component, const void* window, double* x, double* y);
372 
373 /**
374  * @brief Obtains the touch event dispatched by the ArkUI XComponent.
375  *
376  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
377  * @param window Indicates the native window handler.
378  * @param touchEvent Indicates the pointer to the current touch event.
379  * @return Returns the status code of the execution.
380  * @since 8
381  * @version 1.0
382  */
383 int32_t OH_NativeXComponent_GetTouchEvent(
384     OH_NativeXComponent* component, const void* window, OH_NativeXComponent_TouchEvent* touchEvent);
385 
386 /**
387  * @brief Obtains the touch pointer tool type by the ArkUI XComponent.
388  *
389  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
390  * @param pointIndex Indicates the pointer index in the touchPoints.
391  * @param toolType Indicates the tool Type of the pointer.
392  * @return Returns the status code of the execution.
393  * @since 9
394  * @version 1.0
395  */
396 int32_t OH_NativeXComponent_GetTouchPointToolType(
397     OH_NativeXComponent* component, uint32_t pointIndex, OH_NativeXComponent_TouchPointToolType* toolType);
398 
399 /**
400  * @brief Obtains the touch pointer tiltX by the ArkUI XComponent.
401  *
402  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
403  * @param pointIndex Indicates the pointer index in the touchPoints.
404  * @param tiltX Indicates the x tilt of the pointer.
405  * @return Returns the status code of the execution.
406  * @since 9
407  * @version 1.0
408  */
409 int32_t OH_NativeXComponent_GetTouchPointTiltX(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltX);
410 
411 /**
412  * @brief Obtains the touch pointer tiltX by the ArkUI XComponent.
413  *
414  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
415  * @param pointIndex Indicates the pointer index in the touchPoints.
416  * @param tiltY Indicates the y tilt of the pointer.
417  * @return Returns the status code of the execution.
418  * @since 9
419  * @version 1.0
420  */
421 int32_t OH_NativeXComponent_GetTouchPointTiltY(OH_NativeXComponent* component, uint32_t pointIndex, float* tiltY);
422 
423 /**
424  * @brief Obtains the touch event dispatched by the ArkUI XComponent.
425  *
426  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
427  * @param window Indicates the native window handler.
428  * @param historicalPoints Indicates the pointer to the current historicalPoints.
429  * @return Returns the status code of the execution.
430  * @since 10
431  * @version 1.0
432  */
433 int32_t OH_NativeXComponent_GetHistoricalPoints(OH_NativeXComponent* component, const void* window,
434     int32_t* size, OH_NativeXComponent_HistoricalPoint** historicalPoints);
435 
436 /**
437  * @brief Obtains the mouse event dispatched by the ArkUI XComponent.
438  *
439  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
440  * @param window Indicates the native window handler.
441  * @param mouseEvent Indicates the pointer to the current mouse event.
442  * @return Returns the status code of the execution.
443  * @since 9
444  * @version 1.0
445  */
446 int32_t OH_NativeXComponent_GetMouseEvent(
447     OH_NativeXComponent* component, const void* window, OH_NativeXComponent_MouseEvent* mouseEvent);
448 
449 /**
450  * @brief Registers a callback for this <b>OH_NativeXComponent</b> instance.
451  *
452  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
453  * @param callback Indicates the pointer to a surface lifecycle and touch event callback.
454  * @return Returns the status code of the execution.
455  * @since 8
456  * @version 1.0
457  */
458 int32_t OH_NativeXComponent_RegisterCallback(OH_NativeXComponent* component, OH_NativeXComponent_Callback* callback);
459 
460 /**
461  * @brief Registers a callback for this <b>OH_NativeXComponent</b> instance.
462  *
463  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
464  * @param callback Indicates the pointer to a mouse event callback.
465  * @return Returns the status code of the execution.
466  * @since 9
467  * @version 1.0
468  */
469 int32_t OH_NativeXComponent_RegisterMouseEventCallback(
470     OH_NativeXComponent* component, OH_NativeXComponent_MouseEvent_Callback* callback);
471 
472 /**
473  * @brief Registers a callback for this <b>OH_NativeXComponent</b> instance.
474  *
475  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
476  * @param callback Indicates the pointer to a focus event callback.
477  * @return Returns the status code of the execution.
478  * @since 10
479  * @version 1.0
480  */
481 int32_t OH_NativeXComponent_RegisterFocusEventCallback(
482     OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window));
483 
484 /**
485  * @brief Registers a callback for this <b>OH_NativeXComponent</b> instance.
486  *
487  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
488  * @param callback Indicates the pointer to a key event callback.
489  * @return Returns the status code of the execution.
490  * @since 10
491  * @version 1.0
492  */
493 int32_t OH_NativeXComponent_RegisterKeyEventCallback(
494     OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window));
495 
496 /**
497  * @brief Registers a callback for this <b>OH_NativeXComponent</b> instance.
498  *
499  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
500  * @param callback Indicates the pointer to a blur event callback.
501  * @return Returns the status code of the execution.
502  * @since 10
503  * @version 1.0
504  */
505 int32_t OH_NativeXComponent_RegisterBlurEventCallback(
506     OH_NativeXComponent* component, void (*callback)(OH_NativeXComponent* component, void* window));
507 
508 /**
509  * @brief Obtains the key event dispatched by the ArkUI XComponent.
510  *
511  * @param component Indicates the pointer to this <b>OH_NativeXComponent</b> instance.
512  * @param keyEvent Indicates the pointer to pointer of <b>OH_NativeXComponent_KeyEvent</b> instance.
513  * @return Returns the status code of the execution.
514  * @since 10
515  * @version 1.0
516  */
517 int32_t OH_NativeXComponent_GetKeyEvent(OH_NativeXComponent* component, OH_NativeXComponent_KeyEvent** keyEvent);
518 
519 /**
520  * @brief Obtains the action of the key event.
521  *
522  * @param keyEvent Indicates the pointer to this <b>OH_NativeXComponent_KeyEvent</b> instance.
523  * @param action Indicates the action of the <b>OH_NativeXComponent_KeyEvent</b> instance.
524  * @return Returns the status code of the execution.
525  * @since 10
526  * @version 1.0
527  */
528 int32_t OH_NativeXComponent_GetKeyEventAction(
529     OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyAction* action);
530 
531 /**
532  * @brief Obtains the keyCode of the key event.
533  *
534  * @param keyEvent Indicates the pointer to this <b>OH_NativeXComponent_KeyEvent</b> instance.
535  * @param code Indicates the keyCode of the <b>OH_NativeXComponent_KeyEvent</b> instance.
536  * @return Returns the status code of the execution.
537  * @since 10
538  * @version 1.0
539  */
540 int32_t OH_NativeXComponent_GetKeyEventCode(OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_KeyCode* code);
541 
542 /**
543  * @brief Obtains the sourceType of the key event.
544  *
545  * @param keyEvent Indicates the pointer to this <b>OH_NativeXComponent_KeyEvent</b> instance.
546  * @param sourceType Indicates the sourceType of the <b>OH_NativeXComponent_KeyEvent</b> instance.
547  * @return Returns the status code of the execution.
548  * @since 10
549  * @version 1.0
550  */
551 int32_t OH_NativeXComponent_GetKeyEventSourceType(
552     OH_NativeXComponent_KeyEvent* keyEvent, OH_NativeXComponent_EventSourceType* sourceType);
553 
554 /**
555  * @brief Obtains the deviceId of the key event.
556  *
557  * @param keyEvent Indicates the pointer to this <b>OH_NativeXComponent_KeyEvent</b> instance.
558  * @param deviceId Indicates the deviceId of the <b>OH_NativeXComponent_KeyEvent</b> instance.
559  * @return Returns the status code of the execution.
560  * @since 10
561  * @version 1.0
562  */
563 int32_t OH_NativeXComponent_GetKeyEventDeviceId(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* deviceId);
564 
565 /**
566  * @brief Obtains the timestamp of the key event.
567  *
568  * @param keyEvent Indicates the pointer to this <b>OH_NativeXComponent_KeyEvent</b> instance.
569  * @param timestamp Indicates the timestamp of the <b>OH_NativeXComponent_KeyEvent</b> instance.
570  * @return Returns the status code of the execution.
571  * @since 10
572  * @version 1.0
573  */
574 int32_t OH_NativeXComponent_GetKeyEventTimestamp(OH_NativeXComponent_KeyEvent* keyEvent, int64_t* timestamp);
575 
576 #ifdef __cplusplus
577 };
578 #endif
579 #endif // _NATIVE_INTERFACE_XCOMPONENT_H_
580