📄 atp5cmd.c
字号:
/******************************************************************************//* SCCS: %Z% Name: %M% Date US: %G% %U% Ver.: %I% *//******************************************************************************//*F(*************************************************************************** * File name : %M% * Project : Embedded Data Stack * Module : AT Parser * Date : (US) %G% %U% * Version : %I% * Compiler name and release(s) : *---------------------------------------------------------------------------* *---------------------------------------------------------------------------* * DESCRIPTION * *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* * FUNCTIONS DEFINED IN THIS FILE *----------------------------------------------------------------------------* * Name | Object *----------------------------------------------------------------------------* * atp5_1DCommand | Execute the D command (Dial) * atp5_2ACommand | Execute the A command (Answer) * atp5_3ECommand | Execute the E command (Echo) * atp5_4SetCRLPParameter | Execute +CRLP=<param> command * atp5_5HCommand | Execute the H command (Hangup) * atp5_6SetIPRParameter | Execute +IPR=<param> Command * atp5_7SetFCLASSParameter | Execute +FCLASS=<param> Command * atp5_8SetCSTAParameter | Execute +CSTA=<param> Command * atp5_9SetCPBSParameter | Execute +CPBS=<param> Command * atp5_10SetCBSTParameter | Execute +CBST=<param> Command * atp5_11VCommand | Execute the V command (Verbose response) * atp5_12QCommand | Execute the Q command (Result code suppression) * atp5_13OCommand | Execute the O command (Return to Online data state) * atp5_14XCommand | Execute the X command (Result code selection) * atp5_15ZCommand | Execute the Z command (Soft reset) * atp5_16zFCommand | Execute the &F command (Set default params) * atp5_17zCCommand | Execute the &C command (circuit 109 behaviour) * atp5_18zDCommand | Execute the &D command (circuit 108 behaviour) * atp5_19SetSParameter | Execute the Sx=<param> command * atp5_20SetCMODParameter | Execute the +CMOD=<param> command * atp5_21CHUPCommand | Execute the +CHUP command (Hang up call) * atp5_22SetCRCParameter | Execute the +CRC=<param> command * atp5_23SetCRParameter | Execute the +CR=<param> command * atp5_24SetCPBRParameter | Execute +CPBR=<param> Command * atp5_25SetCPBFParameter | Execute +CPBF=<param> Command * atp5_26SetCPBWParameter | Execute +CPBW=<param> Command * atp5_27SetCMEEParameter | Execute the +CMEE=<param> command * atp5_28CNUMCommand | execute +CNUM command * atp5_29DirectDialCommand | Execute the D><param>command * atp5_30CGMICommand | returns the manufacturer name : PHILIPS * atp5_31CGMMCommand | returns the product model : Xenium * atp5_32CGMRCommand | returns the software version * atp5_33CGSCommand | returns the IMEI of the mobile. * atp5_34zVCommand | Display current configuration and stored profiles. * atp5_35zWCommand | Store current configuration. * atp5_36SetCREGParameter | Execute +CREG=<param> command * atp5_37SetCOPSParameter | Execute +COPS=<param> command * atp5_38CBCCommand | Execute +CBC command * atp5_39ICommand | Execute the I command (Identification) * atp5_40SetICFParameter | Execute +ICF=<param> command * atp5_41SetIFCParameter | Execute +IFC=<param> command * atp5_42CEERCommand | returns an extended report of the failure reason * atp5_43zKCommand | Store Flow control value * atp5_44CMERSetCmd | Mobile Equipment event reporting * atp5_45CMECSetCmd | Mobile Equipment control mode * atp5_46CCLKCommand | Clock Command * atp5_47FillDirectDiallingCmd | Fill DIR_READ_REQ after an ATD> cmd * atp5_48SetCSCSParameter | Store ChSet param * atp5_49CALACommand | Execute +CALA command * atp5_50CMGDSetCmd | Execute +CMGD=<index> command * atp5_51CSMSSetCmd | Execute +CSMS=<param> command * atp5_52CPMSSetCmd | Execute +CPMS=<param> command * atp5_53CPASCommand | Execute +CPAS command * atp5_54CMGFSetCmd | Execute +CMGF=<param> command * atp5_55CSCASetCmd | Execute +CSCA=<param> command * atp5_56WCommand | Execute the W command (config connect result code) * atp5_57CSMPSetCmd | Execute +CSMP=<param> command * atp5_58SetCSDHParameter | Show Text Mode Parameters * atp5_59SettingsSetCmd | Execute +CSAS=<param> command * atp5_60CMGRSetCmd | Execute +CMGR=<param> command * atp5_61CNMISetCmd | Execute +CNMI=<param> command * atp5_62CMGLSetCmd | Execute +CMGL=<param> command * atp5_63CMGSWSetCmd | Execute +CMGS=<param> and +CMGW=<param> command * atp5_64CMSSSetCmd | Execute +CMSS=<param> command * atp5_65CMGSSendMsg | Send the msg of the CMGS Command * atp5_66CMGWSaveMsg | Save the msg of the CMGW Command * atp5_67GCAPCommand | Execute +GCAP cmd * atp5_68ReqStorageOrgInfo | Req information on the Org list for the command set *PCCORGR * atp5_69PCCORGWCmd | Execute the set command *PCCORGW * atp5_70CProtSetCmd | Execute the set command +CPROT * atp5_71CGQREQSetCmd | Execute +CGQREQ=<param> and +CGQMIN=<param> commands * atp5_72CGDCONTSetCmd | Execute +CGDCONT=<param> command * atp5_73CGACTSetCmd | Execute +CGACT=<param> command * atp5_74CGDATASetCmd | Execute +CGDATA=<param> command * atp5_75CGSMSSetCmd | Execute +CGSMS=<param> command * atp5_76CGCLASSSetCmd | Execute +CGCLASS=<param> command * atp5_77CGATTSetCmd | Execute +CGATT=<state> command * atp5_78SetCGREGParameter | Execute +CGREG=<param> command * atp5_80CGEQREQSetCmd | Execute +CGEQREQ=<param> command * atp5_98PCCDBGSetCmd | Execute an ATTOL request. Used only for unitary test * atp5_99IgnoredCommand | Execute the ignored command ie just return OK result * FUNCTIONS * ========= * atp5_100SetUpCall | Set up the call with D parameters * atp5_101FillBcList | Fill bearer capabilities according to AT configuration * atp5_102FillHlcList | Fill Hight Layer capabilities * atp5_103FillLlcList | Fill low layer capabilities * atp5_104RemoveSaveDtmf | Remove and save DTMfs from phone number * atp5_105GetMccMnc | Get Mcc & Mnc from a String * atp5_106StringCmp | Compare 2 strings case insensitive * atp5_107SendStatusReq | Send a mobi_mis_status_req with the given parameters * atp5_108DisconnectCall | Disconnect current call * atp5_109SetIfBoolean | Set parameter to Enable or Disable if correct * atp5_110DeleteEntry | Deletes the specified phonebook entry * atp5_111WriteNewEntry | Writes a new phonebook entry * atp5_112SendSS(not used) | Send the SS according to the Dial command * atp5_113GetListType | Get list type on appi corresponding to the parameter * atp5_114SendCPBRResponse | Fill and Send the result to CPBR SET in emergency phonebook case * atp5_115FormatString | Display string in specific format * atp5_116SetRegistersValueProfile | Restore profile stored in Eeprom * atp5_117ReturnCMEError | return ATP_CME_ERROR * atp5_118FillTimeParam | Fill time info in spo structure * atp5_119ReturnCMSError | return ATP_CMS_ERROR * atp5_120DecodeAbsoluteTime | Decode a time string * atp5_121EncodeAbsoluteTime | Encode a time string * atp5_122SmsReadMsgReq | Send an APPI_SMS_READ_MSG_REQ * atp5_123CheckAndConvertDate | Convert a date of type string in DateBitFiled and check it * atp5_124CGMCommand | Execute one of the CGM commands (CGMI, CGMM, CGMR). * atp5_125DisplayString | Send a null-terminated string to MIS for Workshop I/O display * atp5_127SendMapiAtpComInfoInd | Send MAPI_ATP_COM_INFO_IND to LOOK when 'D' command is accepted * atp5_128SendMapiAtpComStartInd | Send MAPI_ATP_COM_START_IND to LOOK when context opening is confirmed * atp5_129SendMapiAtpComNoInfoInd | Send MAPI_ATP_COM_NOINFO_IND to LOOK when execution of D command ends * atp5_130SendMapiAtpComStopInd | Send MAPI_ATP_COM_STOP_IND to LOOK when PDP context has been closed * atp5_131StartGPRSDataCom | Starts GPRS data com with protocol depending on CGDATA or D*98*0# command * atp5_132SendResponse | Send CONNECT or NO CARRIER response in GPRS operation * atp5_133CloseAllContexts | Initiates closing of all opened contexts.Returns number of remaining contexts * atp5_134SendGprsSwitchClassReq | Send APPI_GPRS_SWITCH_CLASS_REQ to SPVNET * atp5_135ActDeactPDPContexts | Activate next PDP context or deactivate several * atp5_136CheckCid | Check that the value of the Cid is allowed * atp5_350SendMapiAtpctmConfigAtpInd | Send MAPI_ATPCTM_CONFIG_ATP_IND to ATPCTM * atp5_351SendOutgoingMsg | Sends a message from ATP to the system via ATPCTM*----------------------------------------------------------------------------* *----------------------------------------------------------------------------* * EVOLUTION *----------------------------------------------------------------------------* * Date | Author | Arnb | Description *----------------------------------------------------------------------------* * 14.01.99 | Chevrier | XXYYYY | Creation ***************************************************************************)F*//* #*/#define ATP5CMD_C/*inc - INCLUDE---------------*/#include "atp.hi"extern const u32 v_hm_ProductSoftwareVersion;/*ef - EXTERNAL FUNCTIONS------------------------*/extern ascii* GetManufacturerId(void);extern ascii* GetModelId(void);extern ascii* GetRevisionId(void);extern ascii* GetTcdNumber(void);/*lc - LOCAL CONSTANTS DECLARATION-----------------------------------*//*lm - LOCAL MACROS DEFINITION------------------------------*//*ld - LOCAL LITERAL DEFINITION--------------------------------*/#define MODULE_NUMBER THIS_MODULE#define PROCESS_NUMBER THIS_PROCESS#define FILE_NUMBER 5/*ls - LOCAL STRUCTURE DEFINITION----------------------------------*//*lp - LOCAL PROCEDURES DECLARATION------------------------------------*//*lv - LOCAL VARIABLES DEFINITION---------------------------------*//* #*//* ========================================================================== * * COMMAND EXECUTION * * ========================================================================== *//*P(*************************************************************************** * Procedure name : atp5_1DCommand * Object : execute the D command (Dial) *----------------------------------------------------------------------------* * Input parameters : * ------------------- * None * * Output parameters : * ------------------- * u8 : return the result code. * * Used variables : * ------------------- * p_AppiCmd : Result of the execution of sps3_1CheckGsmString * * Used procedures : * ------------------- * MC_RTK_GET_MEMORY : Get memory allocation * MC_UPV_FREE_BUFFER : Release memory allocation * sizeof : Get the size of a structure * sps3_1CheckGsmString : Check if the D parameter is a SS string or a call * atp5_100SetUpCall : Sets up the call * *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* * DESCRIPTION * *----------------------------------------------------------------------------* ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 1u8 atp5_1DCommand(void){ t_sps_AppiCheckGsmStringCnf * p_AppiCmd; u8 * pl_Temp;#ifdef GPRS_FTR u8 vl_Command = ATP_CMD_CGDATA; u8 vl_iCid; u8 *pl_CidParam = NULL; /* is it a D*98[*<cid>]# or *D*99[*[<called_address]][*[<L2P>][*[<cid>]]]]# GPRS command ? */ /* process the D*98 command */ if(!strcmp((ascii *) s_atp_CurrentCommandInfo.a_Command ,"D*98")) { vl_Command = ATP_CMD_D98; if ((s_atp_CurrentCommandInfo.v_NumberOfParam == 1) && (s_atp_CurrentCommandInfo.a_ParamList[0].v_ParamLength > 0)) { pl_CidParam = s_atp_CurrentCommandInfo.a_ParamList[0].p_Param; } } /* process the D*99 command */ if(!strcmp((ascii *) s_atp_CurrentCommandInfo.a_Command ,"D*99")) { vl_Command = ATP_CMD_D99; /* check the <called_address> parameter (not supported) */ if (s_atp_CurrentCommandInfo.a_ParamList[0].v_ParamLength > 0) { v_atp_AddInfo = ATP_CME_ER_OPERATION_NOT_SUPPORTED; return ATP_ERROR; } /* check the <L2P> parameter : only "PPP" value supported (and 1 as a numeric equivalent) or no parameter */ if (s_atp_CurrentCommandInfo.a_ParamList[1].v_ParamLength > 0) { if ((strcmp((ascii *) s_atp_CurrentCommandInfo.a_ParamList[1].p_Param,"\"PPP\"") != 0) && (strcmp((ascii *) s_atp_CurrentCommandInfo.a_ParamList[1].p_Param,"1") != 0)) { v_atp_AddInfo = ATP_CME_ER_OPERATION_NOT_SUPPORTED; return ATP_ERROR; } } /* store the position of the Cid parameter */ if (s_atp_CurrentCommandInfo.a_ParamList[2].v_ParamLength > 0) { pl_CidParam = s_atp_CurrentCommandInfo.a_ParamList[2].p_Param; } } /* if a valid (except maybe for the cid) D*98 or D*99 command has been detected */ if ( vl_Command != ATP_CMD_CGDATA) { if (pl_CidParam == NULL) { /* No cid parameter was given : use the default number defined in EEPROM */ vl_iCid = v_atp_DefaultCid; } else { /* Check the value of the provided cid */ vl_iCid = atp5_136CheckCid(pl_CidParam); if (vl_iCid == 0) return ATP_ERROR; } /* If the context is waiting for completion of a closing procedure, refuse command and send NO CARRIER */ if ( s_atp_PDP_Param[vl_iCid - 1].v_PDP_Active == ATP_GPRS_PDP_PPP_CLOSING) { atp5_132SendResponse(ATP_BUSY); v_atp_ReturnState = ATP_UNDEFINED; return (ATP_ERROR); } /* additional info valid for all remaining errors */ v_atp_AddInfo = ATP_CME_ER_OPERATION_NOT_ALLOWED; /* the specified context must not have been activated for D*9x commands to be performed */ if ( s_atp_PDP_Param[vl_iCid - 1].v_PDP_Active != ATP_GPRS_PDP_QUIESCENT) return (ATP_ERROR); /* check if the specified context is defined */ if ((s_atp_PDP_Param[vl_iCid - 1].v_DefMask & ATP_GPRS_CONTEXT_DEFINED) == ATP_GPRS_UNDEFINED) return (ATP_ERROR); /* D*98 command is only for PDP context with IP or PPP type */ if ((vl_Command == ATP_CMD_D98) && (s_atp_PDP_Param[vl_iCid - 1].v_PDP_type != ATP_CGDCONT_TYPE_IP) && (s_atp_PDP_Param[vl_iCid - 1].v_PDP_type != ATP_CGDCONT_TYPE_PPP)) { return (ATP_ERROR); } /* If we are already processing an incoming CS call, reject the command */ if (p_atp_SavedParams != NULL) return ATP_ERROR; /* The D command is accepted : it is time to tell LOOK about it */ atp5_127SendMapiAtpComInfoInd(ATP_MAX_CS_CALL_ID + vl_iCid, ATP_COM_TYPE_GPRS, (ascii *)s_atp_PDP_Param[vl_iCid - 1].p_Apn); /* save the extracted parameters : will be freed when we finally activate the startcomm function */ p_atp_SavedParams = (void *) MC_RTK_GET_MEMORY(sizeof(t_atp_StartComParams)); ((t_atp_StartComParams *) p_atp_SavedParams)->v_EventDescription = ATP_INHIBIT_NONE; ((t_atp_StartComParams *) p_atp_SavedParams)->v_AT_Command = vl_Command; ((t_atp_StartComParams *) p_atp_SavedParams)->v_Cid = vl_iCid; if (v_atp_GPRS_Attach_State == ATP_GPRS_ATTACH) { /* if we are already attached to the GPRS network, we can try to establish the comm right away */ return atp5_131StartGPRSDataCom(); } else { /* otherwise , we must attach first */ /* set a reminder of what we must do upon reception of the cnf response message */ v_atp_ActionUponAttach = ATP_ATTACH_START_COMM; /* send the message to SPV NET */#ifdef SR_ABORT_GPRS_FTR atp5_134SendGprsSwitchClassReq(SPN_CLASS_B,SPN_PDP_SWITCH_CAUSE);#else atp5_134SendGprsSwitchClassReq(SPN_CLASS_B,SPN_PDP_ACT);#endif /* Set return state to SPV WAIT */ v_atp_ReturnState = ATP_SPV_WAIT; return ATP_OK; } } /* if any of the conditions required to identify a valid D*98[*<cid>]# or a */ /* *D*99[*[<called_address]][*[<L2P>][*[<cid>]]]]# */ /* command is not met , then let the standard processing of the 'D' command */ /* try to make sense out of it */ #endif /* GPRS_FTR */ if( s_atp_CurrentCommandInfo.a_ParamList[0].v_ParamLength ) { if(!strcmp( (ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param, "*#232737*#")) { v_atp_DebugBearer = !v_atp_DebugBearer; } p_AppiCmd =(t_sps_AppiCheckGsmStringCnf *) MC_RTK_GET_MEMORY(sizeof(t_sps_AppiCheckGsmStringCnf));/* Check if the D parameter is a SS string or a call */ sps3_1CheckGsmString( (ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param, p_AppiCmd ) ; /* depending on the result operation type */ switch(p_AppiCmd->v_OperationType) { case SPS_REGISTER_PASSWORD : case SPS_DEACTIVATION : case SPS_ACTIVATION : case SPS_REGISTRATION : case SPS_ERASURE : case SPS_INTERROGATION : case SPS_USS_REQUEST :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -