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

📄 smi_sms.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 3 页
字号:
  TRACE_FUNCTION ("sms_CmgdRej ()");

  ui_signal (UI_SIG_UNHND_CMS_ERR, err);
}
                
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_CmgdCnf              |
+--------------------------------------------------------------------+

  PURPOSE : This function is called to indicate that a message was 
            deleted successfully from preferred message storage.
*/
GLOBAL void sms_CmgdCnf (T_ACI_AT_CMD cmdId)
{
  TRACE_FUNCTION ("sms_CmgdCnf ()");

  if (cmdId EQ currSmsCmd)
  {
    currSmsCmd = AT_CMD_NONE;
    sms_sigCmgd (SMS_RSLT_DELETE);  
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_sigCmgw              |
+--------------------------------------------------------------------+

  PURPOSE : This function is called to signal that a message was 
            written successfully to the preferred message storage.

            <index>: location area index
*/
LOCAL void sms_sigCmgw (SHORT index)
{
  TRACE_FUNCTION ("sms_sigCmgw ()");

  ui_signal (UI_SIG_SMS_WRITE, index);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCMGW             |
+--------------------------------------------------------------------+

  PURPOSE : This function is called to indicate that a message is
            written successfully to the preferred message storage.

            <index>: location area index
*/
GLOBAL void rAT_PlusCMGW  (UBYTE index, UBYTE numSeg)
{
  TRACE_FUNCTION ("rAT_PlusCMGW ()");

  if (currSmsCmd EQ AT_CMD_CMGW)
  {
    currSmsCmd = AT_CMD_NONE;
    sms_sigCmgw (index);  
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_CmgwRej              |
+--------------------------------------------------------------------+

  PURPOSE : This function is called to indicate that a message is not
            stored successfully to the preferred message storage.

            <err>: error code
*/
LOCAL void sms_CmgwRej (T_ACI_CMS_ERR err)
{
  TRACE_FUNCTION ("sms_CmgwRej ()");

  ui_signal (UI_SIG_UNHND_CMS_ERR, err);
}
                
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCMS              |
+--------------------------------------------------------------------+

  PURPOSE : This function will be called by the ACI when an error
            inside the ME occured.

            <cmdId>: command identity
            <err>:   error code
*/
GLOBAL void rAT_PlusCMS (T_ACI_AT_CMD cmdId, T_ACI_CMS_ERR err, 
                         T_EXT_CMS_ERROR *conc_error)
{
  CHAR buf[30];

  sprintf (buf, "rAT_PlusCMS (%d, %d)", cmdId, err);
  TRACE_FUNCTION (buf);

  if (cmdId EQ currSmsCmd)
    currSmsCmd = AT_CMD_NONE;

  switch (cmdId)
  {
    case (AT_CMD_CMGR): sms_CmgrRej (err); break;
    case (AT_CMD_CMGD): sms_CmgdRej (err); break;
    case (AT_CMD_CMGW): sms_CmgwRej (err); break;
    case (AT_CMD_CMGS): sms_CmgsRej (err); break;
    case (AT_CMD_CMSS): sms_CmssRej (err); break;

    default: 
      ui_signal (UI_SIG_UNHND_CMS_ERR, err);
      break;
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_setSca               |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to set the last edited service
            center address.

            <inSca>: service center address
*/
GLOBAL void sms_setSca (CHAR* inSca)
{
  if (inSca NEQ NULL)
    aca_cvtNumber (inSca, &sca);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_setDa                |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to set the last edited 
            destination address.

            <inDa>: destination address
*/
GLOBAL void sms_setDa (CHAR* inDa)
{
  if (inDa NEQ NULL)
    aca_cvtNumber (inDa, &da);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_setMsg               |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to set the last edited short
            message.

            <inMsg>: short message
*/
GLOBAL void sms_setMsg (CHAR* inMsg)
{
  if (inMsg NEQ NULL)
  {
    msg.len = MINIMUM (strlen(inMsg), MAX_SM_LEN);
    memcpy (msg.data, inMsg, msg.len);
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_setVp                |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to set the last edited 
            validity period.

            <inVp>: validity period
*/
GLOBAL void sms_setVp (SHORT inVp)
{
  if ( inVp >= 0 AND inVp <= 255 )
    vp = inVp;
  else
    vp = -1;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_getSca               |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to get the last edited service
            center address.

            returns: service center address
*/
GLOBAL void sms_getSca (CHAR* outSca)
{
  aca_recvtNumber (&sca, outSca);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_getDa                |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to get the last edited 
            destination address.

            returns: destination address
*/
GLOBAL void sms_getDa (CHAR* outDa)
{
  aca_recvtNumber (&da, outDa);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_getMsg               |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to get the last edited short
            message.

            returns: short message
*/
GLOBAL void sms_getMsg (CHAR* outMsg)
{
  if (outMsg NEQ NULL)
  {
    memcpy (outMsg, msg.data, msg.len);
    outMsg[msg.len] = NULL_TERM;
  }
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : sms_getVp                |
+--------------------------------------------------------------------+

  PURPOSE : This function will be used to get the last edited 
            validity period.

            returns: validity period
*/
GLOBAL SHORT sms_getVp (void)
{
  return vp;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCMTI             |
+--------------------------------------------------------------------+

  PURPOSE : This function will be called when an incomming short
            message was stored in memory.

            <mem>:   type of memory
            <index>: memory location index
*/
GLOBAL void rAT_PlusCMTI (T_ACI_SMS_STOR mem,
                          UBYTE          index,
                          T_ACI_CMGL_SM* sm)
{
  TRACE_FUNCTION ("rAT_PlusCMTI");

  ui_sms_signal (UI_SIG_SMS_MT_IND, mem, index);
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCMGR             |
+--------------------------------------------------------------------+

  PURPOSE : This function is used to deliver a short message or a
            cell braodcast message which was read from the memory 
            to the MMI.

            <sm>:  short message
            <cbm>: cell broadcast message
*/
GLOBAL void rAT_PlusCMGR (T_ACI_CMGL_SM*  sm,
                          T_ACI_CMGR_CBM* cbm)
{
  TRACE_FUNCTION ("rAT_PlusCMGR");

  if (currSmsCmd EQ AT_CMD_CMGR)
  {
    currSmsCmd = AT_CMD_NONE;

    if (sm NEQ NULL)
      ui_sms_signal (UI_SIG_SMS_SHOW_MSG, sm->data);
  }
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCMGD             |
+--------------------------------------------------------------------+

  PURPOSE :
*/
GLOBAL void rAT_PlusCMGD ()
{
  TRACE_FUNCTION ("rAT_PlusCMGD");
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_SMS                  |
| STATE   : code                  ROUTINE : rAT_PlusCBM              |
+--------------------------------------------------------------------+

  PURPOSE : This function is called to indicate an incomming cell
            broadcast message.

            <sn>:    serial number
            <mid>:   message identifier
            <dcs>:   data coding scheme
            <page>:  page parameter bits 4-7
            <pages>: page parameter bits 0-3
            <data>:  message data
*/
GLOBAL void rAT_PlusCBM (SHORT           sn,
                         SHORT           mid, 
                         SHORT           dcs, 
                         UBYTE           page, 
                         UBYTE           pages, 
                         T_ACI_CBM_DATA* data)
{
  TRACE_FUNCTION ("rAT_PlusCBM");

/*
  if (data NEQ NULL)
    ui_sms_signal (UI_SIG_SMS_SHOW_MSG, data);
*/
}

⌨️ 快捷键说明

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