Chinaunix首页 | 论坛 | 博客
  • 博客访问: 713266
  • 博文数量: 94
  • 博客积分: 2812
  • 博客等级: 少校
  • 技术积分: 1555
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-08 21:28
文章分类

全部博文(94)

文章存档

2012年(23)

2011年(39)

2010年(14)

2009年(18)

分类: C/C++

2011-03-16 16:12:10

#if 1 /* test ggbook sms pay */
#define TCLIENT_SP_SEND_PHONE_NUM "106601"
#define TCLIENT_SP_SEND_CONTENT "A*GMA"

kal_semid g_mssp_lock = NULL;

#define MSSP_LOCK if (g_mssp_lock != NULL) kal_take_sem(g_mssp_lock, KAL_INFINITE_WAIT)
#define MSSP_UNLOCK    if (g_mssp_lock != NULL) kal_give_sem(g_mssp_lock)

BOOL  tclient_ms_sp_is_sim_valid(int iSim)
{
if ((iSim == 0)
&&(mmi_bootup_is_sim_valid()
#ifdef __MMI_DUAL_SIM_MASTER__
|| mmi_bootup_is_sim2_valid()
#endif /* __MMI_DUAL_SIM_MASTER__ */
)
)
{
if(!mmi_bootup_is_network_searching_complete() 
#ifdef __MMI_DUAL_SIM_MASTER__
&& !mmi_bootup_is_sim2_network_searching_complete() 
#endif//__MMI_DUAL_SIM_MASTER__
)
{
return FALSE;
}
return TRUE;
}
else if ((iSim == 1)
&&mmi_bootup_is_sim_valid()
&&mmi_bootup_is_network_searching_complete() 
)
{
return TRUE;
}
#ifdef __MMI_DUAL_SIM_MASTER__
else if ((iSim == 2)
&&mmi_bootup_is_sim2_valid()
&&mmi_bootup_is_sim2_network_searching_complete() 
)
{
return TRUE;
}
#endif /* __MMI_DUAL_SIM_MASTER__ */
return FALSE;
}

static void tclient_ms_sp_send_msg_rsp(void *number, module_type mod, U16 result)
{
U16 currentSCRID;
#if 0
    MMI_BOOL result = callback_data->result;
    U32 cause = (U32)callback_data->cause;

    /* When background sending is enabled, rsp ok just means first step(save) ok */
    if (result == MMI_TRUE)
    {
        cause = SRV_SMS_CAUSE_NO_ERROR;
    //return;//
    }
#endif

currentSCRID = GetActiveScreenId();
    DeleteScreenIfPresent(SCR_ID_MSG_PROCESSING);
    DeleteScreenIfPresent(SCR_ID_MSG_SENDING);
    DeleteScreenIfPresent(SCR_ID_MSG_NUMBER);
    DeleteScreenIfPresent(SCR_ID_MSG_SC_NUMBER);
    DeleteScreenIfPresent(SCR_ID_MSG_SAVING);

if((currentSCRID == SCR_ID_MSG_SENDING) || (currentSCRID == SCR_ID_MSG_PROCESSING))
GoBackHistory();

//AlmEnableSPOF();

    return;
}

void tclient_ms_sp_send_msg_req_background(const char* phonenum, const char* data)
{
int length = 0 ;
WCHAR szSrc[101];
mmi_frm_sms_send_struct *sendData = NULL;
sendData = (mmi_frm_sms_send_struct *)OslMalloc(sizeof(mmi_frm_sms_send_struct));
memset((mmi_frm_sms_send_struct *) sendData, 0, sizeof(mmi_frm_sms_send_struct));
length = strlen(data);
memset(sendData->number, 0, sizeof(sendData->number));
memcpy(sendData->number, phonenum, strlen(phonenum));
memset((char*)szSrc, 0, 200);
mmi_chset_convert(MMI_CHSET_ASCII, MMI_CHSET_UCS2, (char*)data, (char*)szSrc, 100);
length=mmi_ucs2strlen((char *)szSrc);
if (mmi_frm_sms_check_UCS2((U16*)data, (U16)length))
{
U32 uLength=(length+1)*2;
uLength=(length+1)*2; // TODO: unicode len ;
sendData->string = OslMalloc(uLength);
sendData->dcs = SMSAL_UCS2_DCS;
sendData->stringlength = length; 
memset((S8*)sendData->string,0,uLength);
memcpy ((S8*)sendData->string, (S8*)szSrc, uLength); // TODO: init sendData string
}
else
{
U32 buf_len;
buf_len = (length+1);//*ENCODING_LENGTH ;

sendData->string = OslMalloc(buf_len);
sendData->dcs = SMSAL_DEFAULT_DCS;
strcpy((char *)sendData->string, data);
sendData->stringlength = strlen(sendData->string);//mmi_ucs2strlen(sendData->string); 
}

MTPNP_AD_Free_Channel(MTPNP_AD_SMS_CHANNEL);
if(tclient_ms_sp_is_sim_valid(1) == TRUE) // TODO: sim 1
{
MTPNP_AD_Set_Channel(MTPNP_AD_SMS_CHANNEL, MTPNP_AD_CHANNEL_MASTER);
}
#if defined(__MMI_DUAL_SIM_MASTER__) // TODO: sim 2
else
{
MTPNP_AD_Set_Channel(MTPNP_AD_SMS_CHANNEL, MTPNP_AD_CHANNEL_SLAVE);
}
#endif

    sendData->sendcheck |= MMI_FRM_SMS_SCR;

sendData->sendrequire &= ~MMI_FRM_SMS_DISP_SIM_OPT; //silence, /*huajun add*/

mmi_frm_sms_send_sms(tclient_ms_sp_send_msg_rsp, MOD_MMI, sendData);
#if defined(MT6253)//|| defined(MT6235)|| defined(MT6235B)
OslMfree(sendData);
#else
    kal_release_buffer(sendData, stack_int_get_active_module_id(), __FILE__, __LINE__);
#endif  //MMI_MESSAGE
}

void tclient_send_msg(char* phonenum, char* data)
{
MSSP_LOCK ;
tclient_ms_sp_send_msg_req_background(phonenum, data);
MSSP_UNLOCK ;
return ;
}
#endif
阅读(2236) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~