fastmmi module模块

 

//各模块UI共有部分

module.cpp

 

int module_exec_ui(module_info * mod) {

    int ret = -1;

    sem_init(&g_data_print_sem, 0, 0);
		
    if(is_key_module(mod)){
    	 ret = pthread_create(&g_fg_tid, NULL, active_fingerprint_homekey, (void *) mod);
	 if(ret < 0){
	 	 is_fg_runing = false;
	       usleep(500 * 1000);
	 }else{
		is_fg_runing = true;
	 }
    }else{
       is_fg_runing = false;
    }

    MMI_ALOGI("module_exec_ui g_fg_tid  :[%d]", g_fg_tid); 	
   
    ret = pthread_create(&g_module_tid, NULL, launch_module, (void *) mod);
    if(ret < 0) {
        MMI_ALOGE("create thread fail, error=%s", strerror(errno));
        return -1;
    }

    MMI_ALOGD("create thread(thread id=%lu) for module:[%s] test", g_module_tid, mod->module);

    return 0;
}



static void *launch_module(void *module) {
    signal(SIGUSR1, signal_handler);
       。。。。。

    }else if(is_otg_module(mod)){
    launch_module_otg(mod);
    }else if(is_ir_module(mod)){
    launch_module_ir(mod);
    }else if(!strcmp(LOCAL_AUDIOCOMB, mod->config_list[KEY_LIB_NAME].c_str())) {
        launch_local_module(mod);
        audio_monitor(mod);
    }
    return NULL;
}


static void launch_module_otg(module_info * mod) {
    button *fb_btn = NULL;
    button *pass_btn = NULL;
    
    bool ispass=false;

    layout *lay = get_layout(mod);

    if(lay == NULL) {
        ALOGE("[%s] No layout\n", mod->module);
        return;
    }

    fb_btn = lay->find_button_by_name(KEY_STR_INDICATION);
    pass_btn = lay->find_button_by_name(KEY_PASS);

    if(fb_btn != NULL) {
        fb_btn->set_text("Testing...");
        fb_btn->set_color(COLOR_BLUE);
    }    

   if(pass_btn != NULL) {
     pass_btn->set_visibility(false);
   }

    sem_wait(&g_data_print_sem);

    //if( strstr(mod->data,"pass") != NULL ){
                 ispass = true;   
    //}

    if(ispass) {    
      if(fb_btn != NULL) {    
                fb_btn->set_text("Test pass");
                fb_btn->set_color(COLOR_GREEN);
      }
       if(pass_btn != NULL) {
         pass_btn->set_visibility(true);
       }
    } else {
          if(fb_btn != NULL) {    
            fb_btn->set_text("Test fail");
            fb_btn->set_color(COLOR_RED);
          } 
    }
    
}


g_data_print_sem, 0, 0);
		
    if(is_key_module(mod)){
    	 ret = pthread_create(&g_fg_tid, NULL, active_fingerprint_homekey, (void *) mod);
	 if(ret < 0){
	 	 is_fg_runing = false;
	       usleep(500 * 1000);
	 }else{
		is_fg_runing = true;
	 }
    }else{
       is_fg_runing = false;
    }

    MMI_ALOGI("module_exec_ui g_fg_tid  :[%d]", g_fg_tid); 	
   
    ret = pthread_create(&g_module_tid, NULL,
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值