⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mmi_atc.c

📁 嵌入式展讯mmi层kernel的c 源代码
💻 C
📖 第 1 页 / 共 4 页
字号:
/******************************************************************************
 ** File Name:      mmi_nmcmd.c                                                   *
 ** Author:         Jassmine.Meng                                             *
 ** DATE:           2003.05.29                                                *
 ** Copyright:      2002 Spreatrum, Incoporated. All Rights Reserved.         *
 ** Description:    define the AT cmd , SMS net manage command , cryptogram   *
 **                 cmd , and the handling function
 ******************************************************************************

 ******************************************************************************
 **                        Edit History                                       *
 ** ------------------------------------------------------------------------- *
 ** DATE           NAME             DESCRIPTION                               *
 ** 05/29/2003    Jassmine.Meng       Create.                                   *
 ******************************************************************************/
#include    "sci_types.h"
//#include    "tb_hal.h"
#include    "mmi_atc.h"
#include    "mmk_type.h"
#include    "mmisms_api.h"
#include    "mmipb_atc.h"
#include    "mmialarm.h"

/**--------------------------------------------------------------------------*
 **                         MACRO DEFINITION                                 *
 **--------------------------------------------------------------------------*/
#define SMS_DELETE_PARAM_NUM 3

#define PHOTO_DIRECTORY     "photo"
#define PICTURE_DIRECTORY   "picture"
#define DIRECTORY_SYMBOL    '/'

#define MAX_RESCMD_LEN      256
#define PB_ENTRY_ID_MAX_LEN 4

/**-------------------------------------------------------------------------*
**                         GLOBAL DEFINITION                                *
**--------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
/*                          LOCAL FUNCTION DECLARE                           */
/*---------------------------------------------------------------------------*/
/*****************************************************************************/
// 	Description : If the cmd is match the indication
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN IsMatchIndication(
				                uint8 *cmd,  // Point to the command infomation buffer
				                uint32 len,   // The length of command infomation buffer
                                const char* ind_ptr //the indication
				                );

/*****************************************************************************/
// 	Description : This function parse at cmd wich from sync tool
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN ParseSyncAtCmd(
					      uint8 *cmd,  // Point to the command infomation buffer
					      uint32 len   // The length of command infomation buffer
					      );

/*****************************************************************************/
// 	Description : This function handle the pb getinfo command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePbGetInfo(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the pb get one item command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePbReadItem(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the pb add command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePbAdd(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the pb delete command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePbDelete(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the pb modify command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePbModify(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the sms deletecommand
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleSmsDelete(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the sms deletecommand
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleSmsDelete(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the ring add command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleRingAdd(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the ring delete command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleRingDelete(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the ring modify command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleRingModify(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the picture add command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePicAdd(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the picture delete command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePicDelete(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the picture modify command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePicModify(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function get string finished by finish_char
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN GetString(
                        uint8* dest_str_ptr, 
                        uint32 max_len, 
                        uint8* src_str_ptr, 
                        uint32 src_str_len,
                        uint8 finish_char
                        );

/*****************************************************************************/
// 	Description : This function return response to at
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL void ReturnResponse(
                            uint8* res_ptr,
                            uint16 len
                            );
/*****************************************************************************/
// 	Description : This function judge pb paramter
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN JudgePbInSim(
                     BOOLEAN *is_in_sim, 
                     uint8 cmd_char
                     );
/*****************************************************************************/
// 	Description : This function get pb entry id from cmd string
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL uint16 GetPbEntryId(
                    uint8* cmd, 
                    uint16 len);
/*****************************************************************************/
// 	Description : This function handle the alarm sync command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleAlarmSync(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );
/*****************************************************************************/
// 	Description : This function handle the ring getinfo command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandleRingGetInfo(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );

/*****************************************************************************/
// 	Description : This function handle the pic getinfo command
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN HandlePicGetInfo(	
                                uint8 *cmd,  // Point to the command infomation buffer
					            uint32 len   // The length of command infomation buffer
                                );                                

void BinaryToHexChar(uint8* src_ptr, uint16 src_len, uint8* dest_ptr, uint16* dest_len);
void HexCharToBinary(uint8* src_ptr, int src_len, uint8* dest_ptr, uint16* dest_len);
uint8 HexCharToByte(uint8 cValue);


/*-------------------------------------------------------------------------*/
/*                         FUNCTIONS                                       */
/*-------------------------------------------------------------------------*/
/*****************************************************************************/
// 	Description : This dummy function called by At.a
//	Global resource dependence : none
//  Author:       Lin.Lin
//	Note:
/*****************************************************************************/
void ATC_ExInit(void)
{

}
/*****************************************************************************/
// 	Description : This function call parse function to get result of command response
//	Global resource dependence : none
//  Author:       Jassmine.Meng
//	Note:
/*****************************************************************************/
uint32 ATC_ExtCmd(
				  uint8 *cmd,  // Point to the command infomation buffer
				  uint32 len   // The length of command infomation buffer
				  )
{
    uint16 ind_len = 0;
    BOOLEAN recode = FALSE;    

    //SCI_TRACE_LOW("mmi_atc.c: ATC_ExtCmd(), received AT command %s, len = %d",cmd, len);
    SCI_TRACE_LOW("mmi_atc.c: ATC_ExtCmd(), received AT command , len = %d", len);

    if(IsMatchIndication(cmd, len, (char *)MMI_SYNC_INDICATE))
    {
        ind_len = strlen((char *)MMI_SYNC_INDICATE);
        cmd += ind_len;
        len -= ind_len;

        if(IsMatchIndication(cmd, len, (char*)MMI_SYNC_START))
        {
            if(MMIATC_IsAtcRun())
            {
                ReturnResponse((uint8 *)MMI_TO_SYNC_OK_SYMBOL, strlen((char*)MMI_TO_SYNC_OK_SYMBOL));
            }
            else
            {
                ReturnResponse((uint8 *)MMI_TO_SYNC_ERROR_SYMBOL, strlen((char*)MMI_TO_SYNC_ERROR_SYMBOL));
            }
        }
        else
        {
            if(!ParseSyncAtCmd(cmd, len))
            {
                ReturnResponse((uint8 *)MMI_TO_SYNC_ERROR_SYMBOL, strlen((char*)MMI_TO_SYNC_ERROR_SYMBOL));
            }
        }
    }
	else
	if(IsMatchIndication(cmd, len, (char *)MMI_SD_INDICATE))
    {
		extern BOOLEAN MMI_GetSDStatus(void );
		if (MMI_GetSDStatus())
			ReturnResponse((uint8 *)MMI_SD_INDICATE_OK, strlen((char*)MMI_SD_INDICATE_OK));
		else
			ReturnResponse((uint8 *)MMI_TO_SYNC_ERROR_SYMBOL, strlen((char*)MMI_TO_SYNC_ERROR_SYMBOL));
	}
}

/*****************************************************************************/
// 	Description : If the cmd is match the indication
//	Global resource dependence : none
//  Author:      lin.lin
//	Note:
/*****************************************************************************/
LOCAL BOOLEAN IsMatchIndication(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -