blob: f903b263d12ab45caf1dd63bc8b3800e3f7af312 [file] [log] [blame]
b.liuae2dce52024-08-15 11:09:58 +08001#include <stdio.h>
2#include <sys/types.h>
3#include <sys/stat.h>
4#include <fcntl.h>
b.liu9e8584b2024-11-06 19:21:28 +08005#include <stdlib.h>
6#include <unistd.h>
b.liuae2dce52024-08-15 11:09:58 +08007
8#include "mbtk_utils.h"
9#include "mbtk_log.h"
10
11#define KMSG "/dev/kmsg"
12
13static int fd = -1;
14
15void timer_alrm_cb(int signo)
16{
17 char *str = "----------------------Timeout---------------------------\n";
18 if(fd > 0) {
b.liu9e8584b2024-11-06 19:21:28 +080019 mbtk_write(fd, str, strlen(str));
b.liuae2dce52024-08-15 11:09:58 +080020 }
21
22 printf("%s", str);
23 LOGI("%s", str);
24}
25
26
27int main(int argc, char *argv[])
28{
29 if(argc != 2) {
30 printf("mbtk_timer_test <time>\n");
31 return -1;
32 }
33 mbtk_log_init("radio", "MBTK");
34
35 int time = atoi(argv[1]);
36 if(time > 0) {
37 mbtk_timer_set(timer_alrm_cb, time * 1000);
38 }
39
40 fd = open(KMSG, O_WRONLY);
41 if(fd > 0) {
42 printf("Open kmsg success.");
43 }
44
45 while(1) {
46 sleep(24 * 60 * 60);
47 }
48
49 return 0;
50}
51