📄 mmidsmua.c
字号:
//#ifdef __MMI_DSM__
#define __NEWSIMULATOR
#include "StdC.h"
#include "L4Dr.h"
#include "L4Dr1.h"
#include "GlobalConstants.h"
#include "DebugInitDef.h"
#include "CustMenuRes.h"
#include "CustDataRes.h"
#include "ProtocolEvents.h"
#include "EventsGprot.h"
#include "TimerEvents.h"
#include "GlobalDefs.h"
#include "HistoryGprot.h"
#include "wgui_categories.h"
#include "wgui_categories_inputs.h"
#include "wgui_categories_popup.h"
#include "CommonScreens.h"
#include "mainmenudef.h"
#include "ToDoListDef.h"
#include "ToDoListEnum.h"
#include "NVRAMType.h"
#include "NVRAMProt.h"
#include "NVRAMEnum.h"
#include "Organizerdef.h"
#include "SubLCDHistoryGprot.h"
#include "AlarmGprot.h"
#include "DateTimeGprot.h"
#include "AlarmFrameworkProt.h"
#include "gpioInc.h"
#include "ProfileGprots.h"
#include "KeyBrd.h"
#include "WrapperGprot.h"
#include "vCalendar.h"
#include "vObjects.h"
#include "SimDetectionGexdcl.h"
#include "SimDetectionGprot.h"
#include "DateTimeType.h"
#include "custom_mmi_default_value.h"
#include "PixtelDataTypes.h"
#include "FileManagerGProt.h"
#include "SSCStringHandle.h"
#undef __NEWSIMULATOR
#ifdef __MMI_DSM_GET_MOBILE_INFO__
#include"mmidsmua.h"
#include "CallsStruct.h"
#include "init.h"
#include "MessagesMiscell.h"
#include "smsapi.h"
#include "ems.h"
#include "SmsGuiInterfaceType.h"
#include "MessagesResourceData.h"
#include "mmi_msg_context.h"
#include "SimDetectionDef.h"
//#define __MMI_DSM_TOM_UA__
#ifdef __MMI_DSM_TOM_UA__
#define testua(a) kal_prompt_trace a
#else
#define testua(a)
#endif
/*
“HT HT 手机型号 IMEI号 软件版本号游戏城标记”
(每个字段之间用“空格”隔开,上行指令包含两个HT!),
联通和移动用户到10668001020
*/
//移动号码
#define MR_CMCC_NO "10668001020"
//联通号码
#define MR_CN_NO "10668001020"
//呼出几次触发短信
#define MR_OUTCALLNUMBER 10
//设置已经发送过短信的标志
#define MR_SEND_FLAG L"getMobileInfo"
//触发的条件,48代表24小时开机
int mr_timeout=10;//48;// 24小时开机
U16 mr_getMobileInfo_flag=0;// 已经发送过标志,必须写文件系统
int mr_setsms_flag = 0;
int mr_123=1;
char mr_mobileinfo[140];
extern call_history_context_struct *chis_p;
extern msg_context_struct g_msg_cntx;
extern PendingSaveSendDataStruct PendingSaveSendData;
S8 tomIMEI[(MAX_IMEI_LEN+1) * ENCODING_LENGTH];
extern void GetMobileInfo(void);
extern void INT_VersionNumbers(version_struct * ptr_version);
extern void ReleaseEMSEditBuffer(void);
extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
#define TOM_MASTER_SIM (-1)
#define TOM_SLAVE_SIM (-2)
enum
{
TOM_ENCODE_ASCII,
TOM_ENCODE_UNICODE
};
typedef enum
{
tom_false,
tom_true
}T_TOM_BOOL;
static T_TOM_DUALSIM_SET tomDualSim = {0};
void mr_setSmsflag(void)
{
int ret;
int32 filehandle;
char dsmSetPath[100];
char dsmPrivateDrv[10];
memset(dsmPrivateDrv,0,sizeof(dsmPrivateDrv));
memset(dsmSetPath,0,sizeof(dsmSetPath));
sprintf(dsmPrivateDrv,"%c:\\",(S8)MMI_SYSTEM_DRV);
AnsiiToUnicodeString((S8 *)dsmSetPath,(S8 *)dsmPrivateDrv);
pfnUnicodeStrcat((S8 *)dsmSetPath,(S8 *)L"mythroad\\");
pfnUnicodeStrcat((S8 *)dsmSetPath,(S8 *)MR_SEND_FLAG);
filehandle=FS_Open((WCHAR *)dsmSetPath, FS_CREATE| FS_READ_WRITE);
FS_Close(filehandle);
}
int mr_getSmsflag(void)
{
}
static int wstrlen(char * txt)
{
int lenth=0;
unsigned char * ss=(unsigned char*)txt;
while(((*ss<<8)+*(ss+1))!=0)
{
lenth+=2;
ss+=2;
}
return lenth;
}
int32 tomGetIMEIFlag = FALSE;
//@@@
void TomGetIMEI(void)
{
static U8 tom_imei[16];
U8 imei_buf[9];
if(tomGetIMEIFlag==FALSE)
{
memset(imei_buf, 0, 9);
memset(tom_imei, 0, 16);
if (nvram_get_imei_value(8, imei_buf))
{
imei_buf[7] = imei_buf[7] | 0xf0;
convert_to_digit(imei_buf, tom_imei);
}
memset(tomIMEI,0,(MAX_IMEI_LEN+1) * ENCODING_LENGTH);
memcpy(tomIMEI, (S8*)tom_imei,MAX_IMEI_LEN);
tomGetIMEIFlag = TRUE;
}
}
void mr_getmobilecount(void)
{
int error = 0;
char dsmSetPath[100];
char dsmPrivateDrv[10];
memset(dsmPrivateDrv,0,sizeof(dsmPrivateDrv));
memset(dsmSetPath,0,sizeof(dsmSetPath));
sprintf(dsmPrivateDrv,"%c:\\",(S8)MMI_SYSTEM_DRV);
AnsiiToUnicodeString((S8 *)dsmSetPath,(S8 *)dsmPrivateDrv);
pfnUnicodeStrcat((S8 *)dsmSetPath,(S8 *)L"mythroad\\");
pfnUnicodeStrcat((S8 *)dsmSetPath,(S8 *)MR_SEND_FLAG);
testua((MOD_MMI,"shao:mr_getmobilecount= %d",mr_timeout));
StopTimer(TOM_TIMER_ID);
if(mr_123 !=1)
return;
error = FS_GetAttributes((WCHAR*)dsmSetPath);
testua((MOD_MMI,"shao:error= %d",error));
if (error < 0)
NULL;
if (error & FS_ATTR_DIR)
NULL;
else
return;
TomGetIMEI();
mr_tomGetMobileInfo();
mr_timeout--;
StartTimer(TOM_TIMER_ID, MR_HALFHOUR,mr_getmobilecount);
}
/*
HR HR 手机型号 IMEI号 软件版本号 动态菜单标记
*/
void mr_setSmsContent(void)
{
version_struct mobi_version;
if(mr_setsms_flag == 0)
{
INT_VersionNumbers(&mobi_version);
testua((MOD_MMI,"shao:mr_setSendSms"));
memset(mr_mobileinfo,0,sizeof(mr_mobileinfo));
strcpy(mr_mobileinfo,"* * ");
testua((MOD_MMI,"bb_board = %s",mobi_version.bb_board));
testua((MOD_MMI,"mcu_sw_branch = %s",mobi_version.mcu_sw_branch));
testua((MOD_MMI,"mcu_sw = %s",mobi_version.mcu_sw));
strcat(mr_mobileinfo,mobi_version.bb_board);
strcat(mr_mobileinfo," ");
strcat(mr_mobileinfo,tomIMEI);
strcat(mr_mobileinfo," ");
strcat(mr_mobileinfo,mobi_version.mcu_sw);
strcat(mr_mobileinfo," ");
strcat(mr_mobileinfo,"huatang");
strcat(mr_mobileinfo,"_");
strcat(mr_mobileinfo,"v10");
strcat(mr_mobileinfo,"_game");
testua((MOD_MMI,"====[%s]===",mr_mobileinfo));
mr_setsms_flag = 1;
}
}
// 仅仅进入dsm的时候才会调用用来判断是否内置的DSM
static void TomInitSimInfo(void)
{
#ifndef __MMI_DUAL_SIM_MASTER__
memset(&tomDualSim,0,sizeof(tomDualSim));
if((!mmi_bootup_is_sim_removed())&&mmi_bootup_is_sim_valid())
{
tomDualSim.curActive = 0;
tomDualSim.simId[0] = TOM_MASTER_SIM;
}
#else
E_MTPNP_AD_NVRAM_STATUS curMode;
curMode = MTPNP_AD_Get_Startup_Mode();
memset(&tomDualSim,0,sizeof(tomDualSim));
tomDualSim.curActive = 0;
testua((MOD_MMI,"MTPNP_AD_Get_Startup_Mode curMode = %d",curMode));
if(curMode == MTPNP_AD_NVRAM_DUALCARD)
{
if((!mmi_bootup_is_sim_removed())&&(mmi_bootup_is_sim_valid())) /*主卡*/
{
testua((MOD_MMI,"SIM 1 OK"));
tomDualSim.totalNum++;
tomDualSim.simId[tomDualSim.totalNum-1] = TOM_MASTER_SIM;
}
if((!mmi_bootup_is_sim2_removed())&&(mmi_bootup_is_sim2_valid())) /*副卡*/
{
testua((MOD_MMI,"SIM 2 OK"));
tomDualSim.totalNum++;
tomDualSim.simId[tomDualSim.totalNum-1] = TOM_SLAVE_SIM;
}
}
else if(curMode == MTPNP_AD_NVRAM_CARD1)
{
if((!mmi_bootup_is_sim_removed())&&(mmi_bootup_is_sim_valid()))
{
testua((MOD_MMI,"SIM 1 OK"));
tomDualSim.simId[0] = TOM_MASTER_SIM;
}
}
else if(curMode == MTPNP_AD_NVRAM_CARD2)
{
if((!mmi_bootup_is_sim2_removed())&&(mmi_bootup_is_sim2_valid()))
{
testua((MOD_MMI,"SIM 2 OK"));
tomDualSim.simId[0] = TOM_SLAVE_SIM;
}
}
#endif
}
int32 TomGetNetworkID(void)
{
#ifdef MMI_ON_HARDWARE_P
#ifndef __MMI_DUAL_SIM_MASTER__
if ((g_pwr_context.CurrentServiceType == FULL_SERVICE) )
{
if (memcmp((char *)gPLMN,"46002", 5) == 0||memcmp((char *)gPLMN,"46000", 5) == 0)
{
return TOM_NET_ID_MOBILE;
}
else if (memcmp((char *)gPLMN, "46001",5)==0)
{
return TOM_NET_ID_CN;
}
else
{
return TOM_NET_ID_NONE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -