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

📄 atp5cmd.c

📁 标准ATP命令的处理
💻 C
📖 第 1 页 / 共 5 页
字号:
u8 atp5_14XCommand(void){  u8 vl_Value=0;  t_hee_DataBitFields1 *pl_hee_DataBitFields1    = (t_hee_DataBitFields1 *)MC_PRM_READ_BLOCK_REQ(HEE_DATA_BITFIELDS1);   /* if the parameter is invalid */  if( s_atp_CurrentCommandInfo.v_NumberOfParam )  {    vl_Value=atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param);  }  /* depending on the integer parameter value */  if(vl_Value>4)  {/* Set Additionnal info to invalid parameter *//*     v_atp_AddInfo = ATP_ER_PARAM_INVALID; *//* return ERROR result code */    return ATP_ERROR;  }  else  {    pl_hee_DataBitFields1->v_ExtendedResultCode = vl_Value;    MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_BITFIELDS1,                                  (u8 *)pl_hee_DataBitFields1 );  }  /* return OK result code */  return ATP_OK;}/*P(***************************************************************************  * Procedure name : atp5_15ZCommand * Object :  Execute the Z command (Soft reset) *----------------------------------------------------------------------------*  * Input parameters  : * ------------------- *   None * * Output parameters : * ------------------- *   u8				: return the result code. * * Used variables    : * ------------------- *   None * * Used procedures   : * ------------------- *   atp1_101SetDefaultRegistersValue	: Set default registers and paramters values *   atp5_108DisconnectCall		: disconnect curreny call *  *  *----------------------------------------------------------------------------*  *----------------------------------------------------------------------------*  *                                    DESCRIPTION * *----------------------------------------------------------------------------*  ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 15u8 atp5_15ZCommand(void){/* if the parameter is invalid */  if(s_atp_CurrentCommandInfo.v_NumberOfParam &&     atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param) > 1)  {/* Set Additionnal info to invalid parameter *//*     v_atp_AddInfo = ATP_ER_PARAM_INVALID; */    /* return ERROR result code */    return ATP_ERROR;  }    if( MC_ATP_IS_ACTIVE() )  {/* if one call currently managed, disconnect it */    atp5_108DisconnectCall();  }  /* Set profile parameters and registers values */  atp5_116SetRegistersValueProfile( );/* return OK result code */  return ATP_OK;}/*P(***************************************************************************  * Procedure name : atp5_16zFCommand * Object :  Execute the &F command (Set default params) *----------------------------------------------------------------------------*  * Input parameters  : * ------------------- *   None * * Output parameters : * ------------------- *   u8				: return the result code. * * Used variables    : * ------------------- *   None * * Used procedures   : * ------------------- *   atp1_101SetDefaultRegistersValue	: Set default registers and paramters values *   atoi			: transform a string into a number *  *  *----------------------------------------------------------------------------*  *----------------------------------------------------------------------------*  *                                    DESCRIPTION * *----------------------------------------------------------------------------*  ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 16u8 atp5_16zFCommand(void){/* if the parameter is invalid */  if(s_atp_CurrentCommandInfo.v_NumberOfParam &&     atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param) != 0)  {/* Set Additionnal info to invalid parameter *//*     v_atp_AddInfo = ATP_ER_PARAM_INVALID; */    /* return ERROR result code */    return ATP_ERROR;  }  /* LMSdv73308*/    /*  atp1_101SetDefaultRegistersValue(); */  atp1_101SetDefaultRegistersValue(ATP_ET_F_CMD);/* end LMSdv73308*/    /* return OK result code */  return ATP_OK;}/*P(***************************************************************************  * Procedure name : atp5_17zCCommand * Object :  Execute the &C command (circuit 109 behaviour) *----------------------------------------------------------------------------*  * Input parameters  : * ------------------- *   None * * Output parameters : * ------------------- *   u8				: return the result code. * * Used variables    : * ------------------- *   vl_Status			: circuit 109 status * * Used procedures   : * ------------------- *   atoi			: transform a string into a number *   atp5_107SendStatusReq	: send the status_req *  *----------------------------------------------------------------------------*  *----------------------------------------------------------------------------*  *                                    DESCRIPTION * *----------------------------------------------------------------------------*  ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 17u8 atp5_17zCCommand(void){    u8 vl_Value;  t_hee_DataBitFields1 *pl_hee_DataBitFields1    = (t_hee_DataBitFields1 *)MC_PRM_READ_BLOCK_REQ(HEE_DATA_BITFIELDS1);    vl_Value = atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param);/* depending on the parameter value */  switch(vl_Value)  {    case 0:    case 1:      break;    default:/* Set Additionnal info to invalid parameter *//*       v_atp_AddInfo = ATP_ER_PARAM_INVALID; */      /* return ERROR result code */      return ATP_ERROR;  }  pl_hee_DataBitFields1->v_DcdControl = vl_Value;  MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_BITFIELDS1,                                (u8 *)pl_hee_DataBitFields1 );/* return OK result code */  return ATP_OK;}/*P(***************************************************************************  * Procedure name : atp5_18zDCommand * Object :  Execute the &D command (circuit 108 behaviour) *----------------------------------------------------------------------------*  * Input parameters  : * ------------------- *   None * * Output parameters : * ------------------- *   u8				: return the result code. * * Used variables    : * ------------------- *   None * * Used procedures   : * ------------------- *   atoi			: transform a string into a number *  *----------------------------------------------------------------------------*  *----------------------------------------------------------------------------*  *                                    DESCRIPTION * *----------------------------------------------------------------------------*  ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 18u8 atp5_18zDCommand(void){    t_hee_DataBitFields1 *pl_hee_DataBitFields1    = (t_hee_DataBitFields1 *)MC_PRM_READ_BLOCK_REQ(HEE_DATA_BITFIELDS1);/* depending on the parameter value */  switch(atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param))  {    case ATP_DTR_IGNORED:/* DTR is to be ignored */      break;    case ATP_DTR_SWITCH_MODE:/* switch to command mode when receiving DTR */      break;    case ATP_DTR_DISCONNECT:/* disconnect current call when receiving DTR */      break;    default:/* Set Additionnal info to invalid parameter *//*       v_atp_AddInfo = ATP_ER_PARAM_INVALID; */      /* return ERROR result code */      return ATP_ERROR;  }  pl_hee_DataBitFields1->v_DTRBehaviour = atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param);  MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_BITFIELDS1,                                (u8 *)pl_hee_DataBitFields1 );/* return OK result code */  return ATP_OK;}/*P(***************************************************************************  * Procedure name : atp5_19SetSParameter * Object : Execute the Sx=<param> command *----------------------------------------------------------------------------*  * Input parameters  : * ------------------- *   None * * Output parameters : * ------------------- *   u8				: Result code * * Used variables    : * ------------------- *   None * * Used procedures   : * ------------------- *   atoi			: transform a string into a number *  *----------------------------------------------------------------------------*  *----------------------------------------------------------------------------*  *                                    DESCRIPTION * *----------------------------------------------------------------------------*  ***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER#define PROCEDURE_NUMBER 19u8 atp5_19SetSParameter(void){  u16 vl_ValueU16=atoi((ascii *)s_atp_CurrentCommandInfo.a_ParamList[0].p_Param);  u8  vl_ValueU8;    vl_ValueU8=(u8)vl_ValueU16;   /* Get in memory the last S Register */  if( s_atp_CurrentCommandInfo.a_Command[1]!='\0' )  {    v_atp_SCurrentRegister=atoi((ascii *)&s_atp_CurrentCommandInfo.a_Command[1]);  }     /* depending on the S identifier */  switch( v_atp_SCurrentRegister )  {    case 0:      if( vl_ValueU16<=255)      {/* auto answer value */        MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_S0,                                      &vl_ValueU8 );/* return OK result code */        return ATP_OK;      }      break;          case 2:      if( vl_ValueU8=='+')      {/* esc char value *//* return OK result code */        return ATP_OK;      }      break;          case 3:/* Line termination character */      if (vl_ValueU8 == ATP_CR)/* return OK result code */	return ATP_OK;      break;    case 4:/* response formating character */      if (vl_ValueU8 == ATP_LF)/* return OK result code */        return ATP_OK;      break;    case 5:/* line editing character */      if (vl_ValueU8 == ATP_BS)/* return OK result code */        return ATP_OK;      break;           case 7:      if( (vl_ValueU16>0) && (vl_ValueU16<=255) )      {/* connection completion timeout */        MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_S7,                                      &vl_ValueU8 );/* return OK result code */        return ATP_OK;      }      break;    case 8:      if( vl_ValueU16<=255)      {/* coma dial modifier time */        MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_S8,                                      &vl_ValueU8 );/* return OK result code */        return ATP_OK;      }      break;          case 10:      if( (vl_ValueU16 > 0) &&           (vl_ValueU16 <= 254) )      {/* automatic disconnect delay */        MC_PRM_WRITE_BLOCK_IMAGE_REQ( HEE_DATA_S10,                                      &vl_ValueU8 );/*

⌨️ 快捷键说明

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