blob: 2f6aa93c4dafb490e2367987b726d1e308200d96 [file] [log] [blame]
b.liud440f9f2025-04-18 10:44:31 +08001/*-----------------------------------------------------------------------------------------------*/
2/**
3 @file ql_test_utils.h
4 @brief Test related interface definition
5*/
6/*-----------------------------------------------------------------------------------------------*/
7
8/*-------------------------------------------------------------------------------------------------
9 Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
10 Quectel Wireless Solution Proprietary and Confidential.
11-------------------------------------------------------------------------------------------------*/
12
13/*-------------------------------------------------------------------------------------------------
14 EDIT HISTORY
15 This section contains comments describing changes made to the file.
16 Notice that changes are listed in reverse chronological order.
17 $Header: $
18 when who what, where, why
19 -------- --- ----------------------------------------------------------
20 20190508 tyler.kuang Created .
21-------------------------------------------------------------------------------------------------*/
22
23#ifndef __TEST_UTILS_H__
24#define __TEST_UTILS_H__
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include <stdint.h>
31
32typedef void (*item_handler_f)(void);
33typedef int (*init_handler_f)(void);
34typedef int (*deinit_handler_f)(void);
35
36
37#define T_ARRAY_SIZE(items) (sizeof(items)/sizeof(items[0]))
38
39typedef struct
40{
41 const char *name;
42 item_handler_f handle;
43} t_item_t;
44
45typedef struct
46{
47 const char *name;
48 int item_len;
49 t_item_t *item_list;
50} t_module_t;
51
52typedef struct
53{
54 const char *name;
55 init_handler_f init_handle;
56 deinit_handler_f deinit_handle;
57} t_init_t;
58
59
60/*-----------------------------------------------------------------------------------------------*/
61/**
62 @brief Read a int value from stdin
63 @param[out] val, Return read data
64 @return
65 0 - successful
66 1 - read an enter
67 -1 - invalid input
68 */
69/*-----------------------------------------------------------------------------------------------*/
70int t_get_int(int *val);
71
72/*-----------------------------------------------------------------------------------------------*/
73/**
74 @brief Read a uint32 value from stdin
75 @param[out] val, Return read data
76 @return
77 0 - successful
78 1 - read an enter
79 -1 - invalid input
80 */
81/*-----------------------------------------------------------------------------------------------*/
82//int t_get_hex(uint32_t *val);
83
84/*-----------------------------------------------------------------------------------------------*/
85/**
86 @brief Read a char value from stdin
87 @param[out] val, Return read data
88 @return
89 0 - successful
90 1 - read an enter
91 -1 - invalid input
92 */
93/*-----------------------------------------------------------------------------------------------*/
94//int t_get_char(int *val);
95
96/*-----------------------------------------------------------------------------------------------*/
97/**
98 @brief Read a string value from stdin
99 @param[out] val, Return read data
100 @return
101 0 - successful
102 1 - read an enter
103 -1 - invalid input
104 */
105/*-----------------------------------------------------------------------------------------------*/
106//int t_get_string(char *str_buf, int str_len);
107
108/*-----------------------------------------------------------------------------------------------*/
109/**
110 @brief Read a list of int values from stdin
111 @param[out] val, Return read datas
112 @param[out&in] val, Input buffer length, output the number of read
113 @return
114 0 - successful
115 1 - read an enter
116 -1 - invalid input
117 */
118/*-----------------------------------------------------------------------------------------------*/
119//int t_get_int_list(int *dat_buf, int *dat_len);
120
121/*-----------------------------------------------------------------------------------------------*/
122/**
123 @brief Read a list of float values from stdin
124 @param[out] val, Return read datas
125 @param[out&in] val, Input buffer length, output the number of read
126 @return
127 0 - successful
128 1 - read an enter
129 -1 - invalid input
130 */
131/*-----------------------------------------------------------------------------------------------*/
132//int t_get_float_list(float *dat_buf, int *dat_len);
133
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif
140