• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 <stdio.h>
17 #include <unistd.h>
18 #include <samgr_lite.h>
19 
20 #include "devattest_log.h"
21 #include "attest_utils_timer.h"
22 
23 #define ATTEST_SLEEP_TIME 100
24 
25 static ATTEST_TIMER_ID g_AttestSaTimerId = NULL;
26 
ATTEST_SystemInit(void * argv)27 static void ATTEST_SystemInit(void *argv)
28 {
29     (void)argv;
30     HILOGI("devattest-start");
31     SAMGR_Bootstrap();
32     return;
33 }
34 
main(void)35 int main(void)
36 {
37     // delay start to make sure register success
38     int32_t ret = AttestStartTimerTask(ATTEST_TIMER_TYPE_ONCE, ATTEST_SLEEP_TIME,
39         &ATTEST_SystemInit, NULL, &g_AttestSaTimerId);
40     if (ret != 0) {
41         HILOGE("[ATTEST SERVICE]Create TimerTask err");
42     }
43     while (1) {
44         pause();
45     }
46     return 0;
47 }
48