boolean LGPRSClass::gprsCheckSIM(void *userData) { LGPRSClass *pThis =(LGPRSClass*)userData; vm_log_info("Has SIM? %d", vm_has_sim_card()); vm_log_info("SIM count? %d", vm_sim_card_count()); vm_log_info("IMEI=%s", vm_get_imei()); // Is there SIM card ready? VMINT simCardCount = vm_sim_card_count(); if (simCardCount > 0) { pThis->m_simCardReady = 1; } vm_set_active_sim_card(VM_SIM_SIM1); VMINT simStatus = vm_get_sim_card_status(VM_SIM_SIM1); vm_log_info("SIM card state=%d", simStatus); // Let's enable GPRS VMINT32 result = vm_setting_srv_command(VM_SETTING_CELLULAR_GPRS_SERVICE, VM_OPERATION_GPRS_SERVICE_ON, NULL, NULL, NULL, NULL); if (result == VM_SETTING_RESULT_OK) { vm_log_info("vm_setting_srv_command OK"); } else if (result == VM_SETTING_RESULT_INVALID) { vm_log_info("vm_setting_srv_command INVALID"); } else { vm_log_info("vm_setting_srv_command failed."); } // Is there GSM? VMINT protocol = vm_srv_nw_info_get_protocol(VM_SIM_SIM1); vm_log_info("SIM protocol=%d", protocol); // get APN info vm_apn_info_ext apnInfo; VMINT apnRet = vm_get_apn_info(&apnInfo); vm_log_info("vm_get_apn_info = %d", apnRet); vm_log_info("operator ID= %s", apnInfo.operator_id); vm_log_info("operator Name= %s", apnInfo.operator_name); return true; }
VMINT vm_callout_ex(VMWSTR phnum, VM_CALLOUT_RESPONSE_T callback) { VM_P_HANDLE phandle = vm_pmng_get_current_handle(); // VMINT resid = -1; mmi_ucm_make_call_para_struct make_call_para; VMUINT16 gid = 0; if (vm_pmng_state(phandle) != VM_PMNG_FOREGROUND) { vm_log_debug("vm_callout: state is not foreground"); return VM_CALLOUT_ERR_STATE; } #ifdef __MRE_SAL_SIM__ if (vm_sim_card_count() <= 0) { vm_log_debug("vm_callout: no sim card"); return VM_CALLOUT_ERR_NO_SIM; } #endif if (!srv_mode_switch_is_network_service_available()) { vm_log_debug("vm_callout: flight mode"); return VM_CALLOUT_ERR_FLIGHT; } if (vm_callout_status != VM_CALLOUT_IDEL) { vm_log_debug("vm_callout: device is busy now"); return VM_CALLOUT_ERR_BUSY; } if (phnum == NULL) { vm_log_debug("vm_callout : the ptr of phnum is NULL"); return VM_CALLOUT_ERR_PHONE_NUM; } if ((vm_wstrlen(phnum) <= 0) || (vm_wstrlen(phnum) >= 40)) { vm_log_debug("vm_callout : the len of phnum is error"); return VM_CALLOUT_ERR_PHONE_NUM; } if (vm_available_phnum(phnum) == FALSE) { vm_log_debug("vm_callout : the content of phnum is error"); return VM_CALLOUT_ERR_PHONE_NUM; } if (phandle < 0) { vm_log_debug("vm_callout : phandle is error"); return VM_CALLOUT_ERR_PROCESS; } if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0) { VMINT resid = -1; if ((resid = vm_res_findfirst(-1, VM_RES_TYPE_CALLOUT)) != VM_RES_NOT_FIND) { vm_res_release_data(VM_RES_TYPE_CALLOUT, resid); vm_res_findclose(VM_RES_TYPE_CALLOUT); } if ((vm_res_save_data(VM_RES_TYPE_CALLOUT, phnum, (vm_wstrlen(phnum) * 2), (void*)callback, phandle)) < 0) { vm_log_debug("vm_callout: res save error"); return VM_CALLOUT_ERR_NO_RES; } } vm_log_debug("vm_callout : before mmi_ucm_init_call_para"); mmi_ucm_init_call_para(&make_call_para); vm_log_debug("vm_callout : after mmi_ucm_init_call_para"); switch (vm_sim_get_active_sim_card()) { case 1: make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE; break; case 2: make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM2; break; case 3: make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM3; break; case 4: make_call_para.dial_type = SRV_UCM_VOICE_CALL_TYPE_SIM4; break; default: return VM_CALLOUT_ERR_NO_SIM; } make_call_para.ucs2_num_uri = (U16*)phnum; vm_log_debug("vm_callout : before mmi_ucm_call_launch"); mmi_ucm_call_launch(gid, &make_call_para); vm_log_debug("vm_callout : after mmi_ucm_call_launch"); return VM_CALLOUT_NO_ERR; }