static inline int at_response_sms_prompt (pvt_t* pvt) { at_queue_t* e; if ((e = at_fifo_queue_head (pvt)) && e->res == RES_SMS_PROMPT) { if (e->ptype != 0 || !e->param.data || at_send_sms_text (pvt, e->param.data) || at_fifo_queue_add (pvt, CMD_AT_CMGS, RES_OK)) { ast_log (LOG_ERROR, "[%s] Error sending sms message\n", pvt->id); return -1; } at_fifo_queue_rem (pvt); } else if (e) { ast_log (LOG_ERROR, "[%s] Received sms prompt when expecting '%s' response to '%s', ignoring\n", pvt->id, at_res2str (e->res), at_cmd2str (e->cmd)); } else { ast_log (LOG_ERROR, "[%s] Received unexpected sms prompt\n", pvt->id); } return 0; }
int CardDevice::at_response_sms_prompt() { if(m_lastcmd && (m_lastcmd->m_cmd == CMD_AT_CMGS)) { if(m_lastcmd->get()) { String* text = static_cast<String*>(m_lastcmd->get()); at_send_sms_text((char*)text->safe()); } } else { if(m_lastcmd) Debug(DebugAll, "[%s] Received sms prompt when expecting '%s' response to '%s', ignoring", c_str(), at_res2str (m_lastcmd->m_res), at_cmd2str(m_lastcmd->m_cmd)); else Debug(DebugAll, "[%s] Received unexpected sms prompt", c_str()); //FIXME: Send empty SMS text. To exit from SMS prompt. at_send_sms_text(""); } return 0; }