|
发表于 2006-8-21 11:53:00
|
显示全部楼层
我也做过sp业务,这个是我的发短信的代码,你可以参考一下
void Entertainment_send_message_response(void *number,module_type mod,U16 result)
{
U16 currentSCRID;
if (result == MMI_FRM_SMS_OK)
{
}
else
{
}
if (CloseDeliveryRepyStatesFlag)
{
CloseDeliveryRepyStatesFlag = 0;
DeliveryRepyStates[0] = 1;
mmi_frm_sms_set_common_settings(NULL,MOD_MMI,DeliveryRepyStates);
}
MdogSendMessage = 0;
mmi_frm_sms_delete_screen_history();
currentSCRID = GetActiveScreenId();
if ((currentSCRID == SCR_ID_MSG_SENDING) || (currentSCRID == SCR_ID_MSG_PROCESSING))
GoBackHistory();
AlmEnableSPOF();
}
/*****************************************************************************
* FUNCTION
* Entertainment_IsReady4SendSms
* DESCRIPTION
* ÊäÈë¹Ì¶¨Îı¾ÄÚÈݲ¢·¢ËͶÌÏûÏ¢
* PARAMETERS
*
* RETURNS
*
* Author
*
*****************************************************************************/
extern S8 Entertainment_IsReady4SendSms(void)
{
S8 result;
if (g_pwr_context.CurrentServiceType == NO_SERVICE)
{
return FALSE;
}
else if (mmi_frm_sms_get_sms_list_size(0x00) == MMI_FRM_SMS_INVALID_INDEX)
{
return FALSE;
}
else
{
if (mmi_frm_sms_check_action_pending())
{
return FALSE;
}
else
{
return TRUE;
}
}
}
/*****************************************************************************
* FUNCTION
* Entertainment_SendSms
* DESCRIPTION
* ÊäÈë¹Ì¶¨Îı¾ÄÚÈݲ¢·¢ËͶÌÏûÏ¢
* PARAMETERS
*
* RETURNS
*
* Author
*
*****************************************************************************/
S8 Entertainment_SendSms(U8 *pNumber,U8 *pContent)
{
S8 *textbufUCS2 ;
S8 smsPhoneNumber[(MAX_DIGITS + 1) * ENCODING_LENGTH];
EMSData *pEMS;
byte result;
U8 len, i;
if (!Entertainment_IsReady4SendSms())
{
return FALSE;
}
len = strlen((char *) pContent);
ReleaseEMSEditBuffer();
pEMS = GetEMSDataForEdit(0,1);
g_msg_cntx.sendSaveStatus = SEND_SAVE_NIL;
memset(g_msg_cntx.smsPhoneNumber,0,sizeof(g_msg_cntx.smsPhoneNumber));
AnsiiToUnicodeString((S8 *) smsPhoneNumber,(S8 *) pNumber);
pfnUnicodeStrcpy(g_msg_cntx.smsPhoneNumber,(S8 *) smsPhoneNumber);
PendingSaveSendData.totalSegments = 1;
PendingSaveSendData.mti = SMSAL_MTI_SUBMIT;
memset(PendingSaveSendData.TPUD,0,sizeof(PendingSaveSendData.TPUD));
for (i = 1; i < mmi_msg_get_seg_num(); i++)
{
PendingSaveSendData.TPUDLen = 0;
PendingSaveSendData.TPUD_p = NULL;
PendingSaveSendData.l4index = SMS_INVALID_INDEX;
PendingSaveSendData.TPUD_udhi = FALSE;
}
g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;
textbufUCS2 = (S8 *) OslMalloc((len + 1) * 2);
memset(textbufUCS2,0,((len + 1) * 2));
AnsiiToUnicodeString((S8 *) textbufUCS2,(S8 *) pContent);
result = AppendEMSString(INPUT_TYPE_ALPHANUMERIC_SENTENCECASE,
pEMS,
(U8 *) textbufUCS2,
SMSAL_DEFAULT_DCS,
NULL);
OslMfree(textbufUCS2);
if (result)
{
mmi_frm_sms_send_struct *sendData = OslMalloc(sizeof(mmi_frm_sms_send_struct));
if (DeliveryRepyStates[0] == 1)
{
CloseDeliveryRepyStatesFlag = 1;
DeliveryRepyStates[0] = 0;
mmi_frm_sms_set_common_settings(NULL,MOD_MMI,DeliveryRepyStates);
}
memset((S8 *) sendData,0,sizeof(mmi_frm_sms_send_struct));
memset(sendData->number,0,MAX_DIGITS_SMS);
if (pfnUnicodeStrlen((S8 *) smsPhoneNumber))
UnicodeToAnsii((S8 *) sendData->number,(S8 *) smsPhoneNumber);
MdogSendMessage = 1;
mmi_frm_sms_send_sms(Entertainment_send_message_response,MOD_MMI,sendData);
OslMfree(sendData);
return TRUE;
}
return FALSE;
} |
|