• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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 #include <hi_stdlib.h>
17 #include <at.h>
18 #include <hi_at.h>
19 #include <at_cmd.h>
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 HI_PRV at_cmd_func_list g_at_cmd_list = { 0 };
28 
at_get_list(hi_void)29 at_cmd_func_list* at_get_list(hi_void)
30 {
31     return (at_cmd_func_list*)&g_at_cmd_list;
32 }
33 
at_find_proc_func(const at_cmd_attr * cmd_parsed)34 at_cmd_func *at_find_proc_func(const at_cmd_attr *cmd_parsed)
35 {
36     at_cmd_func_list *cmd_list = at_get_list();
37     hi_u32 i;
38 
39     for (i = 0; i < AT_CMD_LIST_NUM; i++) {
40         hi_u16 j;
41 
42         for (j = 0; j < cmd_list->at_cmd_num[i]; j++) {
43             at_cmd_func *cmd_func = (at_cmd_func *) ((cmd_list->at_cmd_list[i] + j));
44             if ((cmd_parsed->at_cmd_len == cmd_func->at_cmd_len) &&
45                 (strcmp(cmd_parsed->cmd_name, cmd_func->at_cmd_name) == 0)) {
46                 return cmd_func;
47             }
48         }
49     }
50 
51     return HI_NULL;
52 }
53 
54 #ifdef __cplusplus
55 #if __cplusplus
56     }
57 #endif
58 #endif
59