b.liu | 047a21c | 2024-06-07 17:54:41 +0800 | [diff] [blame] | 1 | /* |
| 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 | -------- -------- ------------------------------------------------------- |
| 13 | 2024/6/7 LiuBin Initial version |
| 14 | |
| 15 | ******************************************************************************/ |
| 16 | #include "mbtk_version.h" |
| 17 | |
| 18 | #define STR_GET(str) (#str) |
| 19 | |
| 20 | static mbtk_build_def_info_t def_infos[MBTK_BUILD_DEF_NUM]; |
| 21 | static bool inited = FALSE; |
| 22 | |
| 23 | static 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 | } |
b.liu | bb59049 | 2024-06-13 16:42:08 +0800 | [diff] [blame^] | 79 | case MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT: |
| 80 | { |
| 81 | strcpy(name, STR_GET(MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT)); |
| 82 | #ifdef MBTK_DUMP_SUPPORT |
| 83 | strcpy(value, "Y"); |
| 84 | #else |
| 85 | strcpy(value, "N"); |
| 86 | #endif |
| 87 | } |
b.liu | 047a21c | 2024-06-07 17:54:41 +0800 | [diff] [blame] | 88 | default: |
| 89 | { |
| 90 | strcpy(name, "Unknown"); |
| 91 | strcpy(value, "Unknown"); |
| 92 | break; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | static void def_info_reset() |
| 98 | { |
| 99 | if(!inited) { |
| 100 | int index = 0; |
| 101 | while(index < MBTK_BUILD_DEF_NUM) { |
| 102 | memset(&(def_infos[index]), 0, sizeof(mbtk_build_def_info_t)); |
| 103 | def_item_set(index, def_infos[index].name, def_infos[index].value); |
| 104 | index++; |
| 105 | } |
| 106 | inited = TRUE; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | void mbtk_build_def_get(char *buff, int buff_len) |
| 111 | { |
| 112 | if(buff && buff_len > 0) { |
| 113 | def_info_reset(); |
| 114 | |
| 115 | int len = 0; |
| 116 | int index = 0; |
| 117 | while(index < MBTK_BUILD_DEF_NUM) { |
| 118 | len += snprintf(buff + len, buff_len - len, "%s:%s\n", def_infos[index].name, def_infos[index].value); |
| 119 | index++; |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |