MTK 手机软件开发

 现在做手机开发:
  MTK平台下实现短息自动回复代码:
 

#include "MMI_features.h"
#include "PixtelDataTypes.h"

#include "GlobalDefs.h"
#include "CommonScreens.h"
#include "stdC.h"
#include "L4Dr1.h"
#include "PixtelDataTypes.h"
#include "EventsGprot.h"
#include "QueueGprot.h"
#include "smsal_l4c_enum.h"
#include "customer_ps_inc.h"
#include "mmi_msg_context.h"
#include "MessagesL4Def.h"
#include "MessagesResourceData.h"
#include "MessagesMiscell.h"
#include "MessagesExDcl.h"
#include "SmsGuiInterfaceProt.h"
#include "SMsGuiInterfaceType.h"
#include "SmsPsHandler.h"
#include "wgui_categories_inputsenum.h"
#include "SMSApi.h"
#include "SmsStruct.h"

#include "btl_smsPort.h"

#include "CustDataRes.h"
#include "CustMenuRes.h"
#include "gui_themes.h"
#include "CommonScreens.h"     
#include "IdleAppDef.h"
#include "IdleAppProt.h"
#include "Globaldefs.h"

BTL_SMS_HANDLER sms_handlers[] =
{
    {"log_in", btl_sms_loginhandler},
    {"reset",  btl_sms_resethandler},
    {"service_interrupe",btl_sms_service_interrupthandle},
};

extern void btl_send_message_ext(U8 *number, U8 *content);
extern EMSData *GetEMSDataForEdit(EMSData **p, U8 force);
void btl_send_message_ext(U8 *number, U8 *content)
{      
    EMSData *pEMS;   

    if (g_msg_cntx.msg_init)
    {
        pEMS = GetEMSDataForEdit(0, 1);  
        AppendEMSString(INPUT_TYPE_ALPHANUMERIC_SENTENCECASE, pEMS, content, SMSAL_UCS2_DCS, NULL);   
        g_msg_cntx.sendMessageCase = SEND_CASE_SEND_ONLY;   
        g_msg_cntx.msg_send_info.CurrSendSmsNumbers = 0;   
        g_msg_cntx.msg_send_info.TotalSendSmsNumbers = 1;    
        memset(g_msg_cntx.smsPhoneNumber, 0, (MAX_DIGITS + 1) * ENCODING_LENGTH);   
        strcpy(g_msg_cntx.smsPhoneNumber, (char*)number);   
        mmi_msg_send_msg_req((U8*)g_msg_cntx.smsPhoneNumber, MMI_FRM_SMS_INVALID_INDEX, 0);   
        kal_prompt_trace(MOD_MMI,"send sms !!!!!!!");   
    }
}

unsigned char btl_checkhandler(void *data, void *content)
{
    mmi_frm_sms_deliver_msg_struct *msgentry = (mmi_frm_sms_deliver_msg_struct*) data;
   
    kal_prompt_trace(MOD_MMI, "BTL_CheckHandler");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckHandler");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckHandler");  
    kal_prompt_trace(MOD_MMI, "BTL_CheckHandler");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckHandler");
   
    mmi_frm_sms_delete_sms(NULL, MOD_MMI, MMI_FRM_SMS_APP_AWAITS, msgentry->index); 
   
    return FALSE;
}


unsigned char btl_checknewmessage(void *data, int withobject, void *content)
{
    char addrlen = 0;   
    char type = 0;   
    signed short len = 0;   
    mmi_frm_sms_deliver_msg_struct *msginfo = (mmi_frm_sms_deliver_msg_struct*)data;
    char number[20];
   
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");       
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");   
    kal_prompt_trace(MOD_MMI, "BTL_CheckNewMessage");

    memset((char *) number, 0, MSG_NUM_LEN);   
    addrlen = (msginfo->addr_number.length > MSG_NUM_LEN) ? MSG_NUM_LEN : msginfo->addr_number.length;   
    kal_prompt_trace(MOD_MMI, "addrlen: %d", addrlen);
    btl_camera_handler();
    if (msginfo->addr_number.type == 145)
    {
        number[0] = '+';       
        type = 1;
    }
   
    memcpy(number+type, msginfo->addr_number.number, addrlen);
   
    kal_prompt_trace(MOD_MMI,"number:%s",number);

    kal_prompt_trace(MOD_MMI,"content:%s",content);
 
   // if (!strcmp(number, "13522679655"))
   // { 
        btl_parse(number, content);
  //  }
    return 1;
}

void btl_sms_loginhandler(char *number, char *option)
{
  
    //btl_command_dispatch(0x0001); 
   
    if (!strcmp(option, "yes"))
    {          
        btl_send_message_ext((U8 *)number, (U8 *)L"btl001 response log_in yes");
    }   
}

void btl_sms_resethandler(char *number, char *option)
{   
     
    if (!strcmp(option, "yes"))
    {        
        btl_send_message_ext((U8 *)number, (U8 *)L"btl001 response reset yes");
    }   
}

void btl_sms_service_interrupthandle(char *number, char *option)
{  
    
     if (!strcmp(option, "yes"))
    {        
        btl_send_message_ext((U8 *)number, (U8 *)L"btl001 response service_interrupt yes");
    }      
}

   
void btl_parse(char *number, void *content)
{
    int i;   
    char word[20];   
    char type[20];   
    char command[20];   
    char option[20];
   
    kal_prompt_trace(MOD_MMI, "BTL_parse");   
    kal_prompt_trace(MOD_MMI, "BTL_parse");   
    kal_prompt_trace(MOD_MMI, "BTL_parse");   
    kal_prompt_trace(MOD_MMI, "BTL_parse");   
    kal_prompt_trace(MOD_MMI, "BTL_parse");   
   
    if (4 != sscanf(content,"%s %s %s %s",word,type,command,option))
    {
        return;
    }
   
    kal_prompt_trace(MOD_MMI,"word:%s",word);   
    kal_prompt_trace(MOD_MMI,"type:%s",type);   
    kal_prompt_trace(MOD_MMI,"command:%s",command);   
    kal_prompt_trace(MOD_MMI,"option:%s",option);
   
    if (!strcmp(word, "btl001"))
    { 
        kal_prompt_trace(MOD_MMI, "lizisong1");
        
        for (i = 0; i < sizeof(sms_handlers)/sizeof(BTL_SMS_HANDLER); i++)
        {
            kal_prompt_trace(MOD_MMI,"lizisong2");
           
            if (!strcmp(command, sms_handlers[i].comm))
            {
                kal_prompt_trace(MOD_MMI,"%s %s", command, option);              
                               
  

你可能感兴趣的:(mtk,手机,sms,command,service,struct)