2 * @copyright Copyright (c) 2018-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef INC_INPUT_UTIL_H_
18 #define INC_INPUT_UTIL_H_
20 #include <native_service/frameworkunified_types.h>
22 struct InputUtilList {
23 struct InputUtilList *next;
24 struct InputUtilList *prev;
27 #define INPUT_INIT_LIST_HEAD(ptr) \
28 (ptr)->next = (ptr); (ptr)->prev = (ptr);
30 #define input_list_entry(ptr, type, member) \
31 (reinterpret_cast<type *>( \
32 reinterpret_cast<char *>(ptr) - (size_t)(&(reinterpret_cast<type *>(0))->member)))
34 #define input_list_for_each(pos, head) \
35 for (pos = (head)->next; pos != (head); pos = pos->next)
37 #define input_list_for_each_safe(pos, n, head) \
38 for (pos = (head)->next, n = pos->next; pos != (head); \
39 pos = n, n = pos->next)
41 void InputUtilListAdd(struct InputUtilList *node_new, struct InputUtilList *node_head);
42 void InputUtilListDelete(struct InputUtilList *node);
43 int InputUtilMCSend(HANDLE h_message, PCSTR source, UI_32 cmd, UI_32 length, PCVOID data);
44 int InputUtilSleep(int usec);
46 #endif // INC_INPUT_UTIL_H_