lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * °æ±¾ËùÓÐ (C)ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾ |
| 3 | * Ä£¿éÃû £ºMMI |
| 4 | * ÎļþÃû £ºmmi.c |
| 5 | * Îļþ±êʶ £º |
| 6 | * Ïà¹ØÎļþ £º |
| 7 | * ʵÏÖ¹¦ÄÜ £º |
| 8 | * ×÷Õß £º |
| 9 | * °æ±¾ £ºV1.0 |
| 10 | * Íê³ÉÈÕÆÚ £º2014-6-20 |
| 11 | * ÆäËü˵Ã÷ £º |
| 12 | * |
| 13 | ******************************************************************************/ |
| 14 | |
| 15 | /***************************************************************************** |
| 16 | Í·Îļþ |
| 17 | ******************************************************************************/ |
| 18 | #include "mmi_common.h" |
| 19 | #include "mmi_lcd.h" |
| 20 | |
| 21 | //ÏÂÃæ¶¼ÊÇdebug¶¨Î»ÎÊÌâʱÓõ½µÄÈ«¾Ö±äÁ¿ |
| 22 | #define MMI_DEBUG_MAINCONTROL |
| 23 | #ifdef MMI_DEBUG_MAINCONTROL |
| 24 | SINT32 g_mmi_MainContrlIndex = -1; |
| 25 | SINT32 g_mmi_MainContrlProcess = -1;//0, get content;1 gelceinfo; 2 show |
| 26 | SINT32 g_mmi_MainContrl = -1; |
| 27 | |
| 28 | |
| 29 | int g_debug[20] = {0}; |
| 30 | int g_debug_index = 0; |
| 31 | #endif |
| 32 | /******************************************************************************** |
| 33 | È«¾Ö±äÁ¿ÒýÓà |
| 34 | **********************************************************************************/ |
| 35 | extern E_zMmiShowMode g_showMode; |
| 36 | |
| 37 | /******************************************************************************** |
| 38 | È«¾Ö±äÁ¿¶¨Òå |
| 39 | **********************************************************************************/ |
| 40 | int g_mmi_msgQue_Id = 0; |
| 41 | pthread_mutex_t g_mmi_lcdmode_mutex ; |
| 42 | pthread_mutex_t g_mmi_ledmode_mutex ; |
| 43 | pthread_mutex_t g_mmi_update_flag_mutex; |
| 44 | pthread_mutex_t g_mmi_refresh_lcd_mutex; |
| 45 | pthread_mutex_t g_mmi_poweron_mutex; |
| 46 | |
| 47 | sem_t g_mmi_update_sem_id; |
| 48 | sem_t g_mmi_init_sem_id; |
| 49 | sem_t g_mmi_traffic_warn_sem_id; |
| 50 | sem_t g_mmi_poweroff_sem_id ; |
| 51 | sem_t g_mmi_gui_init_sem_id; |
| 52 | |
| 53 | |
| 54 | UINT32 g_mmi_poweroff_turnon_flag = FALSE ; |
| 55 | UINT32 g_mmi_led_status_flag = 0; |
| 56 | T_zMMITaskInfoItem g_zMMITaskInfoTab[MMI_TASK_MAX] = {0}; |
| 57 | |
| 58 | UINT32 g_smstask_enable = 0; |
| 59 | UINT32 g_voicetask_enable = 0; |
| 60 | UINT32 g_temp_protect = 0; |
| 61 | UINT32 g_discharge_protect = 0; |
| 62 | UINT32 g_charge_protect = 0; |
| 63 | |
| 64 | UINT32 g_fast_poweron = 0; |
| 65 | UINT32 g_led_standby_mode = 0; |
| 66 | UINT32 g_led_sleep_mode = 0; |
| 67 | UINT32 g_use_wifi_usernum = 0; |
| 68 | |
| 69 | UINT32 g_show_pagefirst = 0; |
| 70 | UINT32 g_show_pagesecond = 0; |
| 71 | UINT32 g_show_pagethird = 0; |
| 72 | /* |
| 73 | SINT32 g_mmi_hightempvol = 0; |
| 74 | SINT32 g_mmi_superhightempvol = 0; |
| 75 | SINT32 g_mmi_lowtempvol = 0; |
| 76 | SINT32 g_mmi_superlowtempvol = 0; |
| 77 | */ |
| 78 | SINT32 g_mmi_batvoltageline[21] = {0}; |
| 79 | |
| 80 | SINT32 g_mmi_power_mode = 0;//0:charge;1:poweron |
| 81 | |
| 82 | //int g_customer_type = CUSTOMER_SDK; // Õë¶Ô²»Í¬¿Í»§µÄ¶¨ÖÆÐèÇó |
| 83 | extern int g_customer_type; |
| 84 | |
| 85 | //ÉèÖô¥·¢¸üбêÖ¾ |
| 86 | VOID mmi_set_update_flag(E_zMmi_Task task) |
| 87 | { |
| 88 | mmi_getMutex(&g_mmi_update_flag_mutex); |
| 89 | g_zMMITaskInfoTab[task].is_update = 1; |
| 90 | mmi_putMutex(&g_mmi_update_flag_mutex); |
| 91 | |
| 92 | mmi_PutSemaphore(&g_mmi_update_sem_id); |
| 93 | } |
| 94 | |
| 95 | VOID mmi_clean_update_flag(E_zMmi_Task task) |
| 96 | { |
| 97 | mmi_getMutex(&g_mmi_update_flag_mutex); |
| 98 | g_zMMITaskInfoTab[task].is_update = 0; |
| 99 | mmi_putMutex(&g_mmi_update_flag_mutex); |
| 100 | } |
| 101 | SINT32 mmi_get_update_flag(E_zMmi_Task task) |
| 102 | { |
| 103 | SINT32 ret = 0; |
| 104 | if (task >= MMI_TASK_MAX)//cov kw 3 |
| 105 | return ret; |
| 106 | mmi_getMutex(&g_mmi_update_flag_mutex); |
| 107 | ret = g_zMMITaskInfoTab[task].is_update; |
| 108 | g_zMMITaskInfoTab[task].is_update = 0; |
| 109 | mmi_putMutex(&g_mmi_update_flag_mutex); |
| 110 | return ret; |
| 111 | } |
| 112 | |
| 113 | //ÏÔʾledµÆ |
| 114 | static VOID mmi_show_led_item(T_zMMITaskInfoItem* taskInfoItem) |
| 115 | { |
| 116 | if (taskInfoItem->get_taskinfo_fun == NULL || taskInfoItem->taskinfo == NULL || |
| 117 | taskInfoItem->get_ledinfo_fun == NULL || taskInfoItem->ledinfo == NULL) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 118 | //slog(MMI_PRINT,SLOG_DEBUG,"MMI mmi_show_led parameter null!!!\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 119 | return; |
| 120 | } |
| 121 | if (taskInfoItem->get_taskinfo_fun((UINT32)taskInfoItem->taskinfo) == MMI_SUCCESS) { //e64 |
| 122 | if (taskInfoItem->get_ledinfo_fun((UINT32)taskInfoItem->taskinfo, (UINT32)taskInfoItem->ledinfo) == MMI_SUCCESS) { |
| 123 | mmi_showLed((UINT32)taskInfoItem->ledinfo); |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | //ÏÔʾlcdµÆ |
| 128 | static VOID mmi_show_lcd_item(T_zMMITaskInfoItem* taskInfoItem) |
| 129 | { |
| 130 | if (taskInfoItem->get_taskinfo_fun == NULL || taskInfoItem->taskinfo == NULL || |
| 131 | taskInfoItem->get_lcdinfo_fun == NULL) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 132 | slog(MMI_PRINT, SLOG_ERR, "MMI mmi_show_lcd parameter null!!!"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 133 | return; |
| 134 | } |
| 135 | #ifdef MMI_DEBUG_MAINCONTROL |
| 136 | g_mmi_MainContrlProcess = 0;//0, get content;1 gelceinfo; 2 show |
| 137 | #endif |
| 138 | if (taskInfoItem->get_taskinfo_fun((UINT32)taskInfoItem->taskinfo) == MMI_SUCCESS) { |
| 139 | #ifdef MMI_DEBUG_MAINCONTROL |
| 140 | g_mmi_MainContrlProcess = 1;//0, get content;1 gelceinfo; 2 show |
| 141 | #endif |
| 142 | if (taskInfoItem->get_lcdinfo_fun((UINT32)taskInfoItem->taskinfo) == MMI_SUCCESS) { |
| 143 | #ifdef MMI_DEBUG_MAINCONTROL |
| 144 | g_mmi_MainContrlProcess = 2;//0, get content;1 gelceinfo; 2 show |
| 145 | #endif |
| 146 | //mmi_showLcd(appInfoItem->lcdinfo); |
| 147 | mmi_invalidateLcd(taskInfoItem->taskinfo); |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | //MMIÖ÷¿Ø |
| 152 | static VOID *mmi_mainControllerEntry(VOID *arg) |
| 153 | { |
| 154 | UINT32 i = 0; |
| 155 | int ret = 0; |
| 156 | |
| 157 | #ifdef MMI_DEBUG_MAINCONTROL |
| 158 | g_mmi_MainContrl = 1; |
| 159 | #endif |
| 160 | |
| 161 | #ifndef DISABLE_LCD |
| 162 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 163 | while ((ret = mmi_GetSemaphore(&g_mmi_init_sem_id, MMI_WAIT_FOREVER)) != MMI_SUCCESS) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 164 | slog(MMI_PRINT, SLOG_DEBUG, "mmi g_mmi_update_sem_id get failed ret = %d,errno=%d\n", ret, errno); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 165 | continue; |
| 166 | } |
| 167 | mmi_DeleteSemaphore(&g_mmi_init_sem_id); |
| 168 | } |
| 169 | #endif |
| 170 | |
| 171 | while (1) { |
| 172 | if ((ret = mmi_GetSemaphore(&g_mmi_update_sem_id, MMI_WAIT_FOREVER)) != MMI_SUCCESS) {//kw 3 |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 173 | slog(MMI_PRINT, SLOG_DEBUG, "mmi mmi_mainControllerEntry failed ret = %d,errno=%d\n", ret, errno); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 174 | continue; |
| 175 | } |
| 176 | for (i = 0; i < sizeof(g_zMMITaskInfoTab) / sizeof(T_zMMITaskInfoItem); ++ i) { //warning539 |
| 177 | #ifdef MMI_DEBUG_MAINCONTROL |
| 178 | g_mmi_MainContrlIndex = i; |
| 179 | #endif |
| 180 | if (mmi_get_update_flag(g_zMMITaskInfoTab[i].task) == 1) { //ÓиüР|
| 181 | if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) { //led |
| 182 | mmi_show_led_item(&(g_zMMITaskInfoTab[i])); |
| 183 | } |
| 184 | #ifndef DISABLE_LCD |
| 185 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { //lcd |
| 186 | mmi_show_lcd_item(&(g_zMMITaskInfoTab[i])); |
| 187 | } |
| 188 | #endif |
| 189 | } |
| 190 | } |
| 191 | #ifdef MMI_DEBUG_MAINCONTROL |
| 192 | g_mmi_MainContrlIndex = -1; |
| 193 | g_mmi_MainContrlProcess = -1;//0, get content;1 gelceinfo; 2 show |
| 194 | #endif |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | |
| 199 | //×¢²áMMIÒµÎñÐÅÏ¢ |
| 200 | VOID mmi_register_taskinfo_item(T_zMMITaskInfoItem* taskInfoItem) |
| 201 | { |
| 202 | if (taskInfoItem != NULL) { |
| 203 | E_zMmi_Task task = taskInfoItem->task;//ÒµÎñ |
| 204 | g_zMMITaskInfoTab[task].task = taskInfoItem->task; |
| 205 | mmi_getMutex(&g_mmi_update_flag_mutex); //cov m |
| 206 | g_zMMITaskInfoTab[task].is_update = taskInfoItem->is_update; |
| 207 | mmi_putMutex(&g_mmi_update_flag_mutex); |
| 208 | //g_zMMIFrameInfoTab[appInfoItem->flag].show_mode= appInfoItem->show_mode; |
| 209 | g_zMMITaskInfoTab[task].taskinfo = taskInfoItem->taskinfo; |
| 210 | g_zMMITaskInfoTab[task].ledinfo = taskInfoItem->ledinfo; |
| 211 | g_zMMITaskInfoTab[task].get_taskinfo_fun = taskInfoItem->get_taskinfo_fun; |
| 212 | g_zMMITaskInfoTab[task].get_ledinfo_fun = taskInfoItem->get_ledinfo_fun; |
| 213 | g_zMMITaskInfoTab[task].get_lcdinfo_fun = taskInfoItem->get_lcdinfo_fun; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | /******************************************************************************** |
| 218 | MMI LOG´æÈëÎļþ |
| 219 | **********************************************************************************/ |
| 220 | static char * mmi_get_time(void) |
| 221 | { |
| 222 | time_t timep; |
| 223 | struct tm *p; |
| 224 | static char buf[22]; |
| 225 | memset(buf, 0, 22); |
| 226 | time(&timep); |
| 227 | p = (struct tm *)localtime(&timep); |
| 228 | if (NULL == p) { |
| 229 | return NULL; |
| 230 | } |
| 231 | snprintf(buf, 21, "%4d/%02d/%02d %02d:%02d:%02d ", 1900 + p->tm_year, 1 + p->tm_mon, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec); |
| 232 | return buf; |
| 233 | } |
| 234 | |
| 235 | void mmi_log_save(const char *fmt, ...) |
| 236 | { |
| 237 | time_t timep; |
| 238 | struct tm p = {0}; |
| 239 | va_list ap; |
| 240 | FILE *fp = NULL; |
| 241 | struct stat statbuff; |
| 242 | |
| 243 | time(&timep); |
| 244 | localtime_r(&timep, &p); |
| 245 | #if MMI_SERIAL_DEBUG |
| 246 | //printf("%4d/%02d/%02d %02d:%02d:%02d ",1900 + p.tm_year,1 + p.tm_mon,p.tm_mday,p.tm_hour,p.tm_min,p.tm_sec); |
| 247 | va_start(ap, fmt); |
| 248 | vprintf(fmt, ap); |
| 249 | va_end(ap); |
| 250 | #endif |
| 251 | |
| 252 | #if MMI_FILE_DEBUG |
| 253 | fp = fopen(MMI_LOG_FILE_PATH, "a+"); |
| 254 | |
| 255 | if (fp) { |
| 256 | fprintf(fp, "%4d/%02d/%02d %02d:%02d:%02d ", 1900 + p.tm_year, 1 + p.tm_mon, p.tm_mday, p.tm_hour, p.tm_min, p.tm_sec); |
| 257 | va_start(ap, fmt); |
| 258 | vfprintf(fp, fmt, ap); |
| 259 | va_end(ap); |
| 260 | fclose(fp); |
| 261 | if (stat(MMI_LOG_FILE_PATH, &statbuff) == 0) { |
| 262 | if (statbuff.st_size >= MMI_MAX_LOG_LENGTH) { |
| 263 | remove(MMI_LOG_OLD_FILE_PATH); |
| 264 | rename(MMI_LOG_FILE_PATH, MMI_LOG_OLD_FILE_PATH); |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | #endif |
| 269 | } |
| 270 | |
| 271 | |
| 272 | /********************************************************************************** |
| 273 | º¯Êý×÷ÓÃ:´¦Àí·¢¸øMMI½ø³ÌµÄÏûÏ¢ |
| 274 | ***********************************************************************************/ |
| 275 | //zdm ½«mmiÄܹ»´¦ÀíµÄËùÓÐÏûÏ¢¾ù½øÐд¦Àí£¬º¯ÊýÄÚ²¿Í¨¹ýnvÀ´¾ö¶¨ÊÇ·ñÕæÕý½øÐд¦Àí |
| 276 | //Èç¹ûµ±Ç°»·¾³ÎÞ·¨´¦Àí¸ÃÏûÏ¢£¬Ö±½Ó·µ»Ø¼´¿É |
| 277 | static int mmi_ProcMsg(MSG_BUF *pstMsg) |
| 278 | { |
| 279 | int i = 0; |
| 280 | if (NULL == pstMsg) { |
| 281 | return -1; |
| 282 | } |
| 283 | //kw 3, kw bug??? |
| 284 | //if ((pstMsg->usMsgCmd != MSG_CMD_MMICHECK_TIP_INFO) && (pstMsg->usMsgCmd != MSG_CMD_MMIGET_WIFI_DATA)) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 285 | slog(MMI_PRINT, SLOG_DEBUG, "MMI Mmi_ProcMsg msg:src_id = 0x%04x,lMsgType = %d,usMsgCmd = 0x%08x,usDataLen = %d,data = %s\n", pstMsg->src_id, pstMsg->lMsgType, pstMsg->usMsgCmd, pstMsg->usDataLen, pstMsg->aucDataBuf); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 286 | //} |
| 287 | switch (pstMsg->usMsgCmd) { |
| 288 | case MSG_CMD_CHANNEL_NETWORK_MODE: |
| 289 | zMMI_Handle_Msg_Network_Mode((VOID *)pstMsg->aucDataBuf); |
| 290 | break; |
| 291 | case MSG_CMD_MULTI_CONNECT_STATUS: |
| 292 | zMMI_Handle_Msg_MultiConnect_Status((VOID *)pstMsg->aucDataBuf, pstMsg->src_id); |
| 293 | break; |
| 294 | case MSG_CMD_CHANNEL_CONNECT_STATUS: |
| 295 | zMMI_Handle_Msg_Connect_Status((VOID *)pstMsg->aucDataBuf); |
| 296 | break; |
| 297 | case MSG_CMD_OUT_REG_GET_SIGNAL_NUM: |
| 298 | zMMI_Handle_Msg_Signal_Num((VOID *)pstMsg->aucDataBuf); |
| 299 | break; |
| 300 | case MSG_CMD_SMS_STATUS_INFO_IND: |
| 301 | zMMI_Handle_Msg_SmsBox_Sattus((VOID *)pstMsg->aucDataBuf); |
| 302 | break; |
| 303 | case MSG_CMD_VOIP_STATUS_INFO: |
| 304 | zMMI_Handle_Msg_Voip_Status((VOID *)pstMsg->aucDataBuf); |
| 305 | break; //cov m |
| 306 | case MSG_CMD_RJ11_STATUS_INFO: |
| 307 | zMMI_Handle_Msg_Rj11_Status((VOID *)pstMsg->aucDataBuf); |
| 308 | break; |
| 309 | case MSG_CMD_MODIFY_SSID_KEY: |
| 310 | zMMI_Handle_Msg_Get_SSID_Key((VOID *)pstMsg->aucDataBuf); |
| 311 | break; |
| 312 | case MSG_CMD_MMIGET_WIFI_STANUM: |
| 313 | case MSG_CMD_STA_COUNT_CHANGE: |
| 314 | zMMI_Handle_Msg_Get_Wifi_StaNum((VOID *)pstMsg->aucDataBuf); |
| 315 | break; |
| 316 | case MSG_CMD_MMISTART_BACKLIGHTOFF_TIMER: |
| 317 | zMMI_Handle_Msg_BacklightOff((VOID *)pstMsg->aucDataBuf); |
| 318 | break; |
| 319 | case MSG_CMD_RESET_NOTIFY: |
| 320 | zMMI_Handle_Msg_Factory_Reset((VOID *)pstMsg->aucDataBuf); |
| 321 | break; |
| 322 | case MSG_CMD_POWEROFF_NOTIFY: |
| 323 | zMMI_Handle_Msg_Poweroff((VOID *)pstMsg->aucDataBuf); |
| 324 | break; |
| 325 | case MSG_CMD_RESTART_NOTIFY: |
| 326 | zMMI_Handle_Msg_Restart((VOID *)pstMsg->aucDataBuf); |
| 327 | break; |
| 328 | case MSG_CMD_GET_NET_PROVIDER: |
| 329 | zMMI_Handle_Msg_Get_Provider((VOID *)pstMsg->aucDataBuf); |
| 330 | break; |
| 331 | case MSG_CMD_GET_TRAFFIC_INFO_START: |
| 332 | zMMI_Handle_Msg_Get_TafficInfo_Start((VOID *)pstMsg->aucDataBuf); |
| 333 | break; |
| 334 | case MSG_CMD_GET_TRAFFIC_INFO_END: |
| 335 | zMMI_Handle_Msg_Get_TafficInfo_End((VOID *)pstMsg->aucDataBuf); |
| 336 | break; |
| 337 | case MSG_CMD_TRAFFIC_INFO_RESET: |
| 338 | zMMI_Handle_Msg_TafficInfo_Reset((VOID *)pstMsg->aucDataBuf); |
| 339 | break; |
| 340 | case MSG_CMD_MMICHECK_TIP_INFO: |
| 341 | zMMI_Handle_Msg_Check_Tip_Info((VOID *)pstMsg->aucDataBuf); |
| 342 | break; |
| 343 | case MSG_CMD_MMISHOW_SSID_INFO: |
| 344 | zMMI_Handle_Msg_SSID_Show_Info((VOID *)pstMsg->aucDataBuf); |
| 345 | break; |
| 346 | case MSG_CMD_MMIGET_WIFI_DATA: |
| 347 | zMMI_Handle_Msg_Get_Wifi_Data((VOID *)pstMsg->aucDataBuf); |
| 348 | break; |
| 349 | case MSG_CMD_POWEROFF_RSP: |
| 350 | zMMI_Handle_Msg_Plugout((VOID *)pstMsg->aucDataBuf); |
| 351 | break; |
| 352 | case MSG_CMD_SIM_ABNORMAL_IND: |
| 353 | zMMI_Handle_Msg_Simcard_Info((VOID *)pstMsg->aucDataBuf); |
| 354 | break; |
| 355 | case MSG_CMD_SOCKET_STATE_CHANGE: |
| 356 | zMMI_Handle_Msg_Socket_Status((VOID *)pstMsg->aucDataBuf, pstMsg->src_id); |
| 357 | break; |
| 358 | case MSG_CMD_MCUSOCKET_STATE_CHANGE: |
| 359 | zMMI_Handle_Msg_MCUSocket_Status((VOID *)pstMsg->aucDataBuf); |
| 360 | break; |
| 361 | #if 0 |
| 362 | case MSG_CMD_AUTOTEST_KEY_REQ: |
| 363 | if (g_mmi_power_mode == 1) |
| 364 | zMMI_Handle_Msg_Atest_Key((VOID *)pstMsg->aucDataBuf); |
| 365 | else |
| 366 | zMMI_Handle_Msg_Atest_Chg((VOID *)pstMsg->aucDataBuf); |
| 367 | break; |
| 368 | #endif |
| 369 | } |
| 370 | return 0; |
| 371 | #if 0 |
| 372 | for (i = 0; i < (SINT32)(sizeof(scmp_info) / sizeof(scmp_info[0])); i++) { |
| 373 | if (pstMsg->usMsgCmd == scmp_info[i].id) { |
| 374 | if (scmp_info[i].func_ptr != NULL) { |
| 375 | scmp_info[i].func_ptr((VOID *)pstMsg->aucDataBuf); |
| 376 | } |
| 377 | return 0; |
| 378 | } |
| 379 | } |
| 380 | #endif |
| 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | |
| 386 | static void *mmi_handleMsgEntry(void *arg) |
| 387 | { |
| 388 | long MsgType = 0; |
| 389 | MSG_BUF MmiMsg; |
| 390 | prctl(PR_SET_NAME, "mmihandlemsg", 0, 0, 0); |
| 391 | while (1) { |
| 392 | memset((VOID *)(&MmiMsg), 0, sizeof(MSG_BUF));//warning516 |
| 393 | if (-1 != mmi_RecvMsgFromQueue(g_mmi_msgQue_Id, &MmiMsg, MsgType)) { |
| 394 | mmi_ProcMsg(&MmiMsg); |
| 395 | } |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | /********************************************************************************** |
| 400 | º¯Êý×÷ÓÃ:¿ª»úʱÆÁ»òµÆµÄ¶¯×÷ |
| 401 | LCD ÏÔʾ¿ª»ú¶¯» |
| 402 | LED Á÷Á¿µÆÏÈÈ«²¿Ï¨Ãð ÆäÓàËĸöµÆÍ¬Ê±ÉÁһϠÔÙ¸ù¾Ýʵ¼Ê״̬ÁÁÆð |
| 403 | ***********************************************************************************/ |
| 404 | static VOID mmi_set_poweron_show(VOID) |
| 405 | { |
| 406 | mmi_set_led_mode(MMI_POWERON_MODE); |
| 407 | mmi_set_update_flag(MMI_TASK_CTRL);//¿ª»úģʽ ÏÔʾ¿ª»ú¶¯» |
| 408 | } |
| 409 | |
| 410 | /********************************************************************************** |
| 411 | º¯Êý×÷ÓÃ:mmi ÒµÎñ×¢²á |
| 412 | ***********************************************************************************/ |
| 413 | |
| 414 | //zdm ʹÓÃnv¿ØÖÆÒµÎñµÄ×¢²áºÍ³õʼ»¯£¬ÔÝʱµÄʵÏÖÊǶÔÓÚ¿ª»úÉϵçµÄÿ¸öÒµÎñ£¬¾ùÌṩһ¸önv¿ØÖÆ |
| 415 | //ºóÆÚÒª¸ù¾ÝÐèÇó£¬ÌáÈ¡³ö±ØÐëʹÓõÄnv¿ØÖÆÏ¶ÔÓÚÈκÎÇé¿öÏ£¬¾ùÐèÒªµÄÒµÎñ£¬Ö±½Ó×¢²á¾Í¿ÉÒÔ |
| 416 | //²»ÔÙʹÓÃnv¿ØÖÆ£¬±ÈÈçMMI_TASK_CTRL£¬°´ÕÕÀí½âÓ¦¸ÃËùÓеij¡¾°Ï¾ùÐèҪע²áºÍ³õʼ»¯ |
| 417 | |
| 418 | |
| 419 | static int mmi_task_register() |
| 420 | { |
| 421 | UINT32 i = 0; |
| 422 | char *nv_task_tab[NV_CONTENT_LEN] = {0}; |
| 423 | |
| 424 | //zdm ÔÚ×¢²áºÍ³õʼ»¯ÒµÎñ֮ǰ£¬ÏȽ«ÒµÎñĿ¼ÖеÄÿ¸öÒµÎñÏîÖÃΪÎÞЧ |
| 425 | for (i = 0; i < sizeof(g_zMMITaskInfoTab) / sizeof(T_zMMITaskInfoItem); ++ i) { |
| 426 | g_zMMITaskInfoTab[i].task = MMI_TASK_INVALID; |
| 427 | } |
| 428 | |
| 429 | //Èç¹ûÓÐÓëled/lcd¾ùÐèҪʹÓõÄÒµÎñ£¬ÔÚÕâÀïÍê³É×¢²á£¬×¢²áºÍ³õʼ»¯º¯ÊýÄÚ²¿½øÐÐÇø·ÖlcdºÍled |
| 430 | |
| 431 | sc_cfg_get("mmi_task_tab", nv_task_tab, sizeof(nv_task_tab)); |
| 432 | |
| 433 | if (strstr(nv_task_tab, "net_task")) { |
| 434 | mmi_RegisterNetTaskInfoItem(); |
| 435 | } |
| 436 | |
| 437 | //Ó²¼þÏÞÖÆ£¬Á½¸öÒµÎñ¸´ÓÃͬһ¸öÓ²¼þµÆ,Òò´ËnvʹÓÃsmsºÍvoice½øÐÐÇø·Ö |
| 438 | |
| 439 | if (strstr(nv_task_tab, "sms_task") && strstr(nv_task_tab, "voice_task")) { |
| 440 | assert(0); |
| 441 | } |
| 442 | |
| 443 | if (strstr(nv_task_tab, "sms_task")) { |
| 444 | mmi_RegisterSmsTaskInfoItem(); |
| 445 | g_smstask_enable = 1; |
| 446 | } else if (strstr(nv_task_tab, "voice_task")) { |
| 447 | mmi_RegisterVoipTaskInfoItem(); |
| 448 | g_voicetask_enable = 1; |
| 449 | } |
| 450 | |
| 451 | //ÊÇ·ñÓÐµç³ØÌõ¼þ¿ØÖÆ |
| 452 | if (strstr(nv_task_tab, "battery_task")) { |
| 453 | mmi_RegisterBatteryTaskInfoItem(); |
| 454 | |
| 455 | } |
| 456 | |
| 457 | if (strstr(nv_task_tab, "ctrl_task")) { |
| 458 | mmi_RegisterCtrlTaskInfoItem(); |
| 459 | } |
| 460 | |
| 461 | |
| 462 | if (strstr(nv_task_tab, "wifi_task")) { |
| 463 | mmi_RegisterWifiTaskInfoItem(); |
| 464 | } |
| 465 | |
| 466 | |
| 467 | if (strstr(nv_task_tab, "traffic_task")) { |
| 468 | mmi_RegisterTrafficTaskInfoItem(); |
| 469 | } |
| 470 | |
| 471 | if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) { |
| 472 | //×¢²áÓëledÏà¹ØµÄÒµÎñ £¬ÇëÎâºìʵÏÖ |
| 473 | if (strstr(nv_task_tab, "netsignal_task")) { |
| 474 | mmi_RegisterNetSigTaskInfoItem(); |
| 475 | } |
| 476 | if (strstr(nv_task_tab, "ledwps_task")) { |
| 477 | mmi_RegisterWpsTaskInfoItem(); |
| 478 | } |
| 479 | if (strstr(nv_task_tab, "rj11_task")) { |
| 480 | mmi_RegisterRj11TaskInfoItem(); |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | #ifndef DISABLE_LCD |
| 485 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 486 | //×¢²áÓëlcdÏà¹ØµÄÒµÎñ£¬ÇëÎâºìʵÏÖ |
| 487 | if (strstr(nv_task_tab, "tip_task")) { |
| 488 | mmi_RegisterTipTaskInfoItem(); |
| 489 | } |
| 490 | //Ó²¼þÓеçÁ¿¼ÆµÄÌõ¼þÏ£¬²ÅÄÜ´ò¿ª |
| 491 | |
| 492 | if (strstr(nv_task_tab, "power_task")) { |
| 493 | mmi_RegisterPowerTaskInfoItem(); |
| 494 | } |
| 495 | //Ö§³ÖwifiµÄÇé¿öϲÅÄÜÖ§³Ö |
| 496 | if (strstr(nv_task_tab, "ssid_task")) { |
| 497 | mmi_RegisterSSIDInfoTaskInfoItem(); |
| 498 | } |
| 499 | if (strstr(nv_task_tab, "wificode_task")) { |
| 500 | mmi_RegisterWifiCodeTaskInfoItem(); |
| 501 | } |
| 502 | if (strstr(nv_task_tab, "tipnetconnect_task")) { |
| 503 | mmi_RegisterTipNetConnectTaskInfoItem(); |
| 504 | } |
| 505 | |
| 506 | if (strstr(nv_task_tab, "tipwps_task")) { |
| 507 | mmi_RegisterTipWpsTaskInfoItem(); |
| 508 | } |
| 509 | if (strstr(nv_task_tab, "tipfota_task")) { |
| 510 | mmi_RegisterTipFotaTaskInfoItem(); |
| 511 | |
| 512 | } |
| 513 | if (strstr(nv_task_tab, "tipwifistation_task")) { |
| 514 | mmi_RegisterTipWifiStationConnectTaskInfoItem(); |
| 515 | } |
| 516 | } |
| 517 | #endif |
| 518 | return 0; |
| 519 | } |
| 520 | |
| 521 | /********************************************************************************** |
| 522 | º¯Êý×÷ÓÃ:mmi ÒµÎñ³õʼ»¯ |
| 523 | ***********************************************************************************/ |
| 524 | |
| 525 | //¶ÔÓÚÓÐÐèÇó¿ØÖƵÄijЩҵÎñ£¬ÌáÈ¡³Énv¿ØÖÆ£¬¸ù¾ÝÐèÇó½øÐдò¿ªºÍ¹Ø±ÕÅäÖà |
| 526 | static int mmi_task_init() |
| 527 | { |
| 528 | char *nv_task_tab[NV_CONTENT_LEN] = {0}; |
| 529 | |
| 530 | |
| 531 | //Èç¹ûÓÐÓëled/lcd¾ùÐèҪʹÓõÄÒµÎñ£¬ÔÚÕâÀïÍê³É³õʼ»¯ |
| 532 | |
| 533 | sc_cfg_get("mmi_task_tab", nv_task_tab, sizeof(nv_task_tab)); |
| 534 | |
| 535 | |
| 536 | if (strstr(nv_task_tab, "net_task")) { |
| 537 | mmi_net_init(); |
| 538 | } |
| 539 | |
| 540 | //Ó²¼þÏÞÖÆ£¬Á½¸öÒµÎñ¸´ÓÃͬһ¸öÓ²¼þµÆ,Òò´ËnvʹÓÃsmsºÍvoice½øÐÐÇø·Ö |
| 541 | if (strstr(nv_task_tab, "sms_task")) { |
| 542 | mmi_sms_init(); |
| 543 | |
| 544 | } else if (strstr(nv_task_tab, "voice_task")) { |
| 545 | mmi_voip_init(); |
| 546 | |
| 547 | } |
| 548 | |
| 549 | //ÊÇ·ñÓÐµç³ØÌõ¼þ¿ØÖÆ |
| 550 | if (strstr(nv_task_tab, "battery_task")) { |
| 551 | mmi_battery_init(); |
| 552 | |
| 553 | } |
| 554 | |
| 555 | if (strstr(nv_task_tab, "ctrl_task")) { |
| 556 | mmi_init_idle_control(); |
| 557 | } |
| 558 | |
| 559 | if (strstr(nv_task_tab, "wifi_task")) { |
| 560 | mmi_wifi_init(); |
| 561 | } |
| 562 | |
| 563 | if (strstr(nv_task_tab, "traffic_task")) { |
| 564 | mmi_traffic_init(); |
| 565 | } |
| 566 | |
| 567 | if (strstr(nv_task_tab, "key_task")) { |
| 568 | mmi_keyStrokes_init(); |
| 569 | } |
| 570 | |
| 571 | |
| 572 | //³õʼ»¯½öÓëledÏà¹ØµÄÒµÎñ £¬ÇëÎâºìʵÏÖ |
| 573 | if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) { |
| 574 | } |
| 575 | |
| 576 | #ifndef DISABLE_LCD |
| 577 | //³õʼ»¯½öÓëlcdÏà¹ØµÄÒµÎñ£¬ÇëÎâºìʵÏÖ |
| 578 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 579 | if (strstr(nv_task_tab, "tip_task")) { |
| 580 | mmi_init_lcd_tip(); |
| 581 | } |
| 582 | } |
| 583 | #endif |
| 584 | return 0; |
| 585 | } |
| 586 | |
| 587 | /********************************************************************************** |
| 588 | º¯Êý×÷ÓÃ:mmi ÏÔʾģʽ³õʼ»¯ |
| 589 | ***********************************************************************************/ |
| 590 | static int mmi_showmode_init() |
| 591 | { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 592 | slog(MMI_PRINT, SLOG_DEBUG, "MMI mmi_showmode_init \n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 593 | if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) { |
| 594 | mmi_initLed(); |
| 595 | } |
| 596 | |
| 597 | #ifndef DISABLE_LCD |
| 598 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 599 | mmi_set_lcd_page_index(MMI_SHOW_PAGE_FIRST); |
| 600 | mmi_initLcd(FALSE); |
| 601 | } |
| 602 | #endif |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | /********************************************************************************** |
| 607 | º¯Êý×÷ÓÃ:MMIÈë¿Úº¯Êý ´´½¨ÏûÏ¢¶ÓÁÐ ¸÷¸öµÆ³õʼ»¯ ½ÓÊÕÏûÏ¢ |
| 608 | ***********************************************************************************/ |
| 609 | VOID mmi_powerOnLcdEntry() |
| 610 | { |
| 611 | pthread_t mmi_handlemsg_thread; |
| 612 | //´´½¨MMIÏûÏ¢¶ÓÁÐ |
| 613 | if ((g_mmi_msgQue_Id = mmi_create_msg_queue()) == -1) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 614 | slog(MMI_PRINT, SLOG_ERR, "MMI create g_mmi_msgQue_Id failed!!!\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 615 | MMI_ASSERT(0); |
| 616 | } |
| 617 | pthread_mutex_init(&g_mmi_lcdmode_mutex, NULL); |
| 618 | pthread_mutex_init(&g_mmi_ledmode_mutex, NULL); |
| 619 | pthread_mutex_init(&g_mmi_update_flag_mutex, NULL); |
| 620 | pthread_mutex_init(&g_mmi_refresh_lcd_mutex, NULL); |
| 621 | sem_init(&g_mmi_update_sem_id, 0, 0); |
| 622 | sem_init(&g_mmi_init_sem_id, 0, 0); |
| 623 | sem_init(&g_mmi_traffic_warn_sem_id, 0, 0); |
| 624 | sem_init(&g_mmi_poweroff_sem_id, 0, 0); //ÓÃÓڹػúʱ±£Ö¤LCDÆÁ²¥Íê¹Ø»ú¶¯»ºóÃðÆ½»òLEDµÆ¶¼ÁÁÖ®ºóÔÙÃðµÆ |
| 625 | |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 626 | slog(MMI_PRINT, SLOG_DEBUG, "MMI start set_mmi_active\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 627 | set_wake_lock(MMI_MAIN_LOCK_ID); |
| 628 | |
| 629 | //´´½¨MMI ´¦ÀíÏûÏ¢Ïß³Ì |
| 630 | if (pthread_create(&mmi_handlemsg_thread, NULL, &mmi_handleMsgEntry, NULL) == -1) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 631 | slog(MMI_PRINT, SLOG_ERR, "MMI pthread_create handle msg error\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 632 | return ; |
| 633 | } |
| 634 | mmi_showmode_init(); |
| 635 | |
| 636 | mmi_task_register(); |
| 637 | mmi_task_init(); |
| 638 | |
| 639 | mmi_set_poweron_show(); |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 640 | slog(MMI_PRINT, SLOG_NORMAL, "MMI main Register finish!!\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 641 | |
| 642 | //´´½¨MMIÖ÷¿ØÏß³Ì |
| 643 | mmi_mainControllerEntry(NULL); |
| 644 | } |
| 645 | |
| 646 | /********************************************************************************** |
| 647 | º¯Êý×÷ÓÃ:¹Ø»ú³äµç |
| 648 | ***********************************************************************************/ |
| 649 | VOID mmi_poweroffcharger_init() |
| 650 | { |
| 651 | |
| 652 | UINT32 i = 0; |
| 653 | pthread_t mmi_handlemsg_thread; |
| 654 | //´´½¨MMIÏûÏ¢¶ÓÁÐ |
| 655 | if ((g_mmi_msgQue_Id = mmi_create_msg_queue()) == -1) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 656 | slog(MMI_PRINT, SLOG_ERR, "MMI create g_mmi_msgQue_Id failed!!!\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 657 | MMI_ASSERT(0); |
| 658 | } |
| 659 | |
| 660 | pthread_t mmi_offchg_mainctrl_thread; |
| 661 | pthread_mutex_init(&g_mmi_update_flag_mutex, NULL); |
| 662 | pthread_mutex_init(&g_mmi_poweron_mutex, NULL); |
| 663 | sem_init(&g_mmi_update_sem_id, 0, 0); |
| 664 | sem_init(&g_mmi_init_sem_id, 0, 0); |
| 665 | |
| 666 | #ifndef DISABLE_LCD |
| 667 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 668 | sem_init(&g_mmi_gui_init_sem_id, 0, 0); |
| 669 | } |
| 670 | #endif |
| 671 | |
| 672 | //´´½¨MMI ´¦ÀíÏûÏ¢Ïß³Ì |
| 673 | if (pthread_create(&mmi_handlemsg_thread, NULL, &mmi_handleMsgEntry, NULL) == -1) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 674 | slog(MMI_PRINT, SLOG_ERR, "MMI pthread_create handle msg error\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 675 | return ; |
| 676 | } |
| 677 | |
| 678 | for (i = 0; i < sizeof(g_zMMITaskInfoTab) / sizeof(T_zMMITaskInfoItem); ++ i) { |
| 679 | g_zMMITaskInfoTab[i].task = MMI_TASK_INVALID; |
| 680 | } |
| 681 | |
| 682 | offchg_RegisterPocTaskInfoItem(); |
| 683 | if (g_showMode == MMI_MODE_LED || g_showMode == MMI_MODE_ALL) { |
| 684 | mmi_initLed(); |
| 685 | } |
| 686 | #ifndef DISABLE_LCD |
| 687 | if (g_showMode == MMI_MODE_LCD || g_showMode == MMI_MODE_ALL) { |
| 688 | mmi_initLcd(TRUE); |
| 689 | } |
| 690 | #endif |
| 691 | |
| 692 | int res = pthread_create(&mmi_offchg_mainctrl_thread, NULL, &mmi_mainControllerEntry, NULL); |
| 693 | if (res != 0) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 694 | slog(MMI_PRINT, SLOG_ERR, "MMI pthread_create main control error\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 695 | assert(0); |
| 696 | } |
| 697 | } |
| 698 | |
| 699 | static int get_nv() |
| 700 | { |
| 701 | char mmi_nv_value[NV_CONTENT_LEN] = {0}; |
| 702 | SINT32 ret_fd = -1; |
| 703 | int state = 0; |
| 704 | |
| 705 | //ÉèÖÃmmiÏÔʾģʽȫ¾Ö±äÁ¿ |
| 706 | sc_cfg_get("mmi_showmode", mmi_nv_value, sizeof(mmi_nv_value)); |
| 707 | if (0 == strcmp(mmi_nv_value, "led")) { |
| 708 | g_showMode = MMI_MODE_LED; |
| 709 | ret_fd = open(LCD_PATH, O_RDWR); |
| 710 | if (ret_fd == -1) |
| 711 | { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 712 | slog(MMI_PRINT, SLOG_ERR,"MMI mmi_file_operate open file fail: %s!\n", LCD_PATH); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 713 | } |
| 714 | else |
| 715 | { |
| 716 | if(ioctl(ret_fd, LEADT15DS26_SET_BACKLIGHT, &state) < 0) |
| 717 | { |
| 718 | slog(MMI_PRINT, SLOG_ERR,"get_nv ioctl fail!\n"); |
| 719 | } |
| 720 | } |
| 721 | } else if (0 == strcmp(mmi_nv_value, "lcd")) { |
| 722 | g_showMode = MMI_MODE_LCD; |
| 723 | } else if (0 == strcmp(mmi_nv_value, "all")) { |
| 724 | g_showMode = MMI_MODE_ALL; |
| 725 | } else { |
| 726 | assert(0); |
| 727 | } |
| 728 | |
| 729 | sc_cfg_get("customer_type",mmi_nv_value,sizeof(mmi_nv_value)); |
| 730 | if(0 == strcmp(mmi_nv_value, "sdk_min")) |
| 731 | { |
| 732 | g_customer_type = CUSTOMER_SDK_MIN; |
| 733 | } |
| 734 | else if(0 == strcmp(mmi_nv_value, "guodian")) |
| 735 | { |
| 736 | g_customer_type = CUSTOMER_GUODIAN; |
| 737 | } |
| 738 | else if(0 == strcmp(mmi_nv_value, "nandian")) |
| 739 | { |
| 740 | g_customer_type = CUSTOMER_NANDIAN; |
| 741 | } |
| 742 | |
| 743 | sc_cfg_get("mmi_use_protect", mmi_nv_value, sizeof(mmi_nv_value)); |
| 744 | |
| 745 | if (strstr(mmi_nv_value, "discharge_protect")) { |
| 746 | g_discharge_protect = 1; |
| 747 | } |
| 748 | |
| 749 | if (strstr(mmi_nv_value, "temp_protect")) { |
| 750 | g_temp_protect = 1; |
| 751 | |
| 752 | if (strstr(mmi_nv_value, "charge_protect")) { |
| 753 | g_charge_protect = 1; |
| 754 | } |
| 755 | } |
| 756 | |
| 757 | sc_cfg_get("mmi_fast_poweron", mmi_nv_value, sizeof(mmi_nv_value)); |
| 758 | |
| 759 | if (0 == strcmp(mmi_nv_value, "1")) { |
| 760 | g_fast_poweron = 1; |
| 761 | |
| 762 | } |
| 763 | |
| 764 | sc_cfg_get("mmi_led_mode", mmi_nv_value, sizeof(mmi_nv_value)); |
| 765 | |
| 766 | if (strstr(mmi_nv_value, "standby_mode")) { |
| 767 | g_led_standby_mode = 1; |
| 768 | |
| 769 | } |
| 770 | |
| 771 | if (strstr(mmi_nv_value, "sleep_mode")) { |
| 772 | g_led_sleep_mode = 1; |
| 773 | } |
| 774 | |
| 775 | |
| 776 | sc_cfg_get("mmi_use_wifi_usernum", mmi_nv_value, sizeof(mmi_nv_value)); |
| 777 | |
| 778 | if (0 == strcmp(mmi_nv_value, "1")) { |
| 779 | g_use_wifi_usernum = 1; |
| 780 | } |
| 781 | |
| 782 | sc_cfg_get("mmi_show_pagetab", mmi_nv_value, sizeof(mmi_nv_value)); |
| 783 | |
| 784 | if (strstr(mmi_nv_value, "page1")) { |
| 785 | g_show_pagefirst = 1; |
| 786 | } |
| 787 | if (strstr(mmi_nv_value, "page2")) { |
| 788 | g_show_pagesecond = 1; |
| 789 | } |
| 790 | if (strstr(mmi_nv_value, "page3")) { |
| 791 | g_show_pagethird = 1; |
| 792 | } |
| 793 | /* |
| 794 | sc_cfg_get("mmi_temp_voltage_line", mmi_nv_value, sizeof(mmi_nv_value)); |
| 795 | { |
| 796 | char *tmp = NULL; |
| 797 | char *substr = strtok_r(mmi_nv_value, "+",&tmp); |
| 798 | int temp[4] = {0}; |
| 799 | int i = 0; |
| 800 | while (substr != NULL) { |
| 801 | temp[i] = atoi(substr); |
| 802 | i++; |
| 803 | substr = strtok_r(NULL, "+",&tmp); |
| 804 | } |
| 805 | g_mmi_superhightempvol = temp[0]; |
| 806 | g_mmi_hightempvol = temp[1]; |
| 807 | g_mmi_lowtempvol = temp[2]; |
| 808 | g_mmi_superlowtempvol = temp[3]; |
| 809 | } |
| 810 | */ |
| 811 | sc_cfg_get("mmi_battery_voltage_line", mmi_nv_value, sizeof(mmi_nv_value)); |
| 812 | { |
| 813 | char *tmp = NULL; |
| 814 | char *substr = strtok_r(mmi_nv_value, "+",&tmp); |
| 815 | int i = 0; |
| 816 | while (substr != NULL) { |
| 817 | g_mmi_batvoltageline[i] = atoi(substr); |
| 818 | slog(MMI_PRINT, SLOG_DEBUG, "g_mmi_batvoltageline[%d] = %d\n", i, g_mmi_batvoltageline[i]); |
| 819 | i++; |
| 820 | substr = strtok_r(NULL, "+",&tmp); |
| 821 | } |
| 822 | } |
| 823 | if(ret_fd >= 0) |
| 824 | close(ret_fd); |
| 825 | return 0; |
| 826 | } |
| 827 | |
| 828 | /********************************************************************************** |
| 829 | º¯Êý×÷ÓÃ:MMIÈë¿Úº¯Êý ´´½¨ÏûÏ¢¶ÓÁÐ ¸÷¸öµÆ³õʼ»¯ ½ÓÊÕÏûÏ¢ |
| 830 | ***********************************************************************************/ |
| 831 | int zte_mmi_main(int argc, char * argv[]) |
| 832 | { |
| 833 | prctl(PR_SET_NAME, "mmi", 0, 0, 0); |
| 834 | //¸ù¾ÝNV³õʼ»¯´òÓ¡¼¶±ð£¬²¢×¢²á¶¯Ì¬µ÷Õû´òÓ¡¼¶±ðÐźÅÁ¿ |
| 835 | loglevel_init(); |
| 836 | |
| 837 | //zdm½«nvÉèÖÃת»»³ÉÈ«¾Ö±äÁ¿½øÐй¦ÄÜ¿ØÖÆ |
| 838 | get_nv(); |
| 839 | mmi_BatLedOffOpt();//¹ØbootµãµÄµÆ |
| 840 | #ifdef DISABLE_LCD |
| 841 | if (g_showMode != MMI_MODE_LED) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 842 | slog(MMI_PRINT, SLOG_ERR, "MMI MIN only support LED \n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 843 | return -1; |
| 844 | } |
| 845 | #endif |
| 846 | |
| 847 | if (argc >= 2) { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 848 | slog(MMI_PRINT, SLOG_DEBUG, "MMI ###POWER OFF CHARGER START####\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 849 | g_mmi_power_mode = 0; |
| 850 | zMmi_PowerOffChargerEntry(); |
| 851 | } else { |
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 852 | slog(MMI_PRINT, SLOG_DEBUG, "MMI ######START######\n"); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 853 | g_mmi_power_mode = 1; |
| 854 | mmi_powerOnLcdEntry(); |
| 855 | } |
| 856 | return 0; |
| 857 | } |
| 858 | |