• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 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 #include "ohos_main.h"
17 #include <hi_at.h>
18 #include <hi_errno.h>
19 
20 #if defined(CONFIG_AT_COMMAND) || defined(CONFIG_FACTORY_TEST_MODE)
QuerySysparaCmd()21 int __attribute__((weak)) QuerySysparaCmd()
22 {
23     return;
24 }
25 
26 static const  at_cmd_func G_OHOS_AT_FUNC_TBL[] = {
27     {"+SYSPARA", 8, 0, 0, 0, (at_call_back_func)QuerySysparaCmd},
28 };
29 #define OHOS_AT_FUNC_NUM  (sizeof(G_OHOS_AT_FUNC_TBL) / sizeof(G_OHOS_AT_FUNC_TBL[0]))
30 #endif
31 
OHOS_SystemInit(void)32 void __attribute__((weak)) OHOS_SystemInit(void)
33 {
34     return;
35 }
36 
OHOS_Main()37 void OHOS_Main()
38 {
39 #if defined(CONFIG_AT_COMMAND) || defined(CONFIG_FACTORY_TEST_MODE)
40     hi_u32 ret;
41     ret = hi_at_init();
42     if (ret == HI_ERR_SUCCESS) {
43         hi_u32 ret2 = hi_at_register_cmd(G_OHOS_AT_FUNC_TBL, OHOS_AT_FUNC_NUM);
44         if (ret2 != HI_ERR_SUCCESS) {
45             printf("Register ohos failed!\n");
46         }
47     }
48 #endif
49     OHOS_SystemInit();
50 }
51