blob: cbc2e68ef46cb4a840aefb456b9e55bede4be753 [file] [log] [blame]
b.liu047a21c2024-06-07 17:54:41 +08001/*
2* mbtk_version.c
3*
4* mbtk_source compilation informations.
5*
6*/
7/******************************************************************************
8
9 EDIT HISTORY FOR FILE
10
11 WHEN WHO WHAT,WHERE,WHY
12-------- -------- -------------------------------------------------------
132024/6/7 LiuBin Initial version
14
15******************************************************************************/
16#include "mbtk_version.h"
17
18#define STR_GET(str) (#str)
19
20static mbtk_build_def_info_t def_infos[MBTK_BUILD_DEF_NUM];
21static bool inited = FALSE;
22
23static void def_item_set(mbtk_build_define_enum def_id, char *name, char *value)
24{
25 switch(def_id)
26 {
27 case MBTK_BUILD_DEF_AF_SUPPORT:
28 {
29 strcpy(name, STR_GET(MBTK_BUILD_DEF_AF_SUPPORT));
30#ifdef MBTK_AF_SUPPORT
31 strcpy(value, "Y");
32#else
33 strcpy(value, "N");
34#endif
35 break;
36 }
37 case MBTK_BUILD_DEF_YX_SUPPORT:
38 {
39 strcpy(name, STR_GET(MBTK_BUILD_DEF_YX_SUPPORT));
40#ifdef MBTK_YX_SUPPORT
41 strcpy(value, "Y");
42#else
43 strcpy(value, "N");
44#endif
45 break;
46 }
47 case MBTK_BUILD_DEF_SG_SUPPORT:
48 {
49 strcpy(name, STR_GET(MBTK_BUILD_DEF_SG_SUPPORT));
50#ifdef MBTK_SG_SUPPORT
51 strcpy(value, "Y");
52#else
53 strcpy(value, "N");
54#endif
55 break;
56 }
57 case MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT:
58 {
59 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT));
60#ifdef MBTK_ALL_CID_SUPPORT
61 strcpy(value, "Y");
62#else
63 strcpy(value, "N");
64#endif
65 break;
66 }
67 case MBTK_BUILD_DEF_MBTK_GNSS_MODE:
68 {
69 strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_GNSS_MODE));
70#if defined(MBTK_GNSS_6228)
71 strcpy(value, "6228");
72#elif defined(MBTK_GNSS_5311)
73 strcpy(value, "5311");
74#else
75 strcpy(value, "Unknown");
76#endif
77 break;
78 }
79 default:
80 {
81 strcpy(name, "Unknown");
82 strcpy(value, "Unknown");
83 break;
84 }
85 }
86}
87
88static void def_info_reset()
89{
90 if(!inited) {
91 int index = 0;
92 while(index < MBTK_BUILD_DEF_NUM) {
93 memset(&(def_infos[index]), 0, sizeof(mbtk_build_def_info_t));
94 def_item_set(index, def_infos[index].name, def_infos[index].value);
95 index++;
96 }
97 inited = TRUE;
98 }
99}
100
101void mbtk_build_def_get(char *buff, int buff_len)
102{
103 if(buff && buff_len > 0) {
104 def_info_reset();
105
106 int len = 0;
107 int index = 0;
108 while(index < MBTK_BUILD_DEF_NUM) {
109 len += snprintf(buff + len, buff_len - len, "%s:%s\n", def_infos[index].name, def_infos[index].value);
110 index++;
111 }
112 }
113}
114