1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   HID Remote Control Class                                            */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_host_class_hid_remote_control.h                  PORTABLE C      */
29 /*                                                           6.1.11       */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX HID remote control class.                                      */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
44 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            resulting in version 6.1    */
46 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
47 /*                                            added extern "C" keyword    */
48 /*                                            for compatibility with C++, */
49 /*                                            resulting in version 6.1.8  */
50 /*  04-25-2022     Chaoqiong Xiao           Modified comment(s),          */
51 /*                                            fixed clients management,   */
52 /*                                            resulting in version 6.1.11 */
53 /*                                                                        */
54 /**************************************************************************/
55 
56 #ifndef UX_HOST_CLASS_HID_REMOTE_CONTROL_H
57 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_H
58 
59 /* Determine if a C++ compiler is being used.  If so, ensure that standard
60    C is used to process the API information.  */
61 
62 #ifdef   __cplusplus
63 
64 /* Yes, C++ compiler is present.  Use standard C.  */
65 extern   "C" {
66 
67 #endif
68 
69 
70 /* Define HID Remote Control Class constants.  */
71 
72 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_BUFFER_LENGTH          128
73 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH     64
74 
75 /* Each item in usage array takes 4 bytes. Check memory bytes calculation overflow here.  */
76 #if UX_OVERFLOW_CHECK_MULC_ULONG(UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH, 4)
77 #error UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH is too large for memory allocation, please check
78 #endif
79 
80 /* Define HID Remote Control Class structure.  */
81 
82 typedef struct UX_HOST_CLASS_HID_REMOTE_CONTROL_STRUCT
83 {
84 
85     ULONG           ux_host_class_hid_remote_control_state;
86     UX_HOST_CLASS_HID   *ux_host_class_hid_remote_control_hid;
87     ULONG           *ux_host_class_hid_remote_control_usage_array;
88     ULONG           *ux_host_class_hid_remote_control_usage_array_head;
89     ULONG           *ux_host_class_hid_remote_control_usage_array_tail;
90 } UX_HOST_CLASS_HID_REMOTE_CONTROL;
91 
92 typedef struct UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL_STRUCT
93 {
94     UX_HOST_CLASS_HID_REMOTE_CONTROL
95                     ux_host_class_hid_client_remote_control_remote_control;
96     UX_HOST_CLASS_HID_CLIENT
97                     ux_host_class_hid_client_remote_control_client;
98 } UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL;
99 
100 /* Define HID Remote Control Class function prototypes.  */
101 
102 VOID    _ux_host_class_hid_remote_control_callback(UX_HOST_CLASS_HID_REPORT_CALLBACK *callback);
103 UINT    _ux_host_class_hid_remote_control_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command);
104 UINT    _ux_host_class_hid_remote_control_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command);
105 UINT    _ux_host_class_hid_remote_control_entry(UX_HOST_CLASS_HID_CLIENT_COMMAND *command);
106 UINT    _ux_host_class_hid_remote_control_usage_get(UX_HOST_CLASS_HID_REMOTE_CONTROL *remote_control_instance, ULONG *usage, ULONG *value);
107 
108 /* Define HID Keyboard Class API prototypes.  */
109 
110 #define ux_host_class_hid_remote_control_entry                   _ux_host_class_hid_remote_control_entry
111 #define ux_host_class_hid_remote_control_usage_get               _ux_host_class_hid_remote_control_usage_get
112 
113 /* Determine if a C++ compiler is being used.  If so, complete the standard
114    C conditional started above.  */
115 #ifdef __cplusplus
116 }
117 #endif
118 
119 #endif
120 
121