Supporting sending DTMF on AT-based modems
This commit is contained in:
parent
a1a19fa861
commit
526c4d2f57
@ -562,6 +562,8 @@ static HayesRequestHandler _hayes_request_handlers[] =
|
|||||||
_on_request_contact_delete },
|
_on_request_contact_delete },
|
||||||
{ MODEM_REQUEST_CONTACT_LIST, "AT+CPBR=?",
|
{ MODEM_REQUEST_CONTACT_LIST, "AT+CPBR=?",
|
||||||
_on_request_generic },
|
_on_request_generic },
|
||||||
|
{ MODEM_REQUEST_DTMF_SEND, NULL,
|
||||||
|
_on_request_generic },
|
||||||
{ MODEM_REQUEST_MESSAGE, NULL,
|
{ MODEM_REQUEST_MESSAGE, NULL,
|
||||||
_on_request_message },
|
_on_request_message },
|
||||||
{ MODEM_REQUEST_MESSAGE_DELETE, NULL,
|
{ MODEM_REQUEST_MESSAGE_DELETE, NULL,
|
||||||
@ -673,6 +675,7 @@ static char * _request_attention_connectivity(ModemPlugin * modem,
|
|||||||
static char * _request_attention_contact_delete(ModemPlugin * modem,
|
static char * _request_attention_contact_delete(ModemPlugin * modem,
|
||||||
unsigned int id);
|
unsigned int id);
|
||||||
static char * _request_attention_contact_list(ModemRequest * request);
|
static char * _request_attention_contact_list(ModemRequest * request);
|
||||||
|
static char * _request_attention_dtmf_send(ModemRequest * request);
|
||||||
static char * _request_attention_gprs(ModemPlugin * modem,
|
static char * _request_attention_gprs(ModemPlugin * modem,
|
||||||
char const * username, char const * password);
|
char const * username, char const * password);
|
||||||
static char * _request_attention_message(ModemPlugin * modem, unsigned int id);
|
static char * _request_attention_message(ModemPlugin * modem, unsigned int id);
|
||||||
@ -797,6 +800,8 @@ static char * _request_attention(ModemPlugin * modem, ModemRequest * request)
|
|||||||
case MODEM_REQUEST_CONTACT_DELETE:
|
case MODEM_REQUEST_CONTACT_DELETE:
|
||||||
return _request_attention_contact_delete(modem,
|
return _request_attention_contact_delete(modem,
|
||||||
request->contact_delete.id);
|
request->contact_delete.id);
|
||||||
|
case MODEM_REQUEST_DTMF_SEND:
|
||||||
|
return _request_attention_dtmf_send(request);
|
||||||
case MODEM_REQUEST_MESSAGE:
|
case MODEM_REQUEST_MESSAGE:
|
||||||
return _request_attention_message(modem,
|
return _request_attention_message(modem,
|
||||||
request->message.id);
|
request->message.id);
|
||||||
@ -954,6 +959,19 @@ static char * _request_attention_contact_list(ModemRequest * request)
|
|||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char * _request_attention_dtmf_send(ModemRequest * request)
|
||||||
|
{
|
||||||
|
const char cmd[] = "AT+VTS=";
|
||||||
|
char buf[32];
|
||||||
|
unsigned int dtmf = request->dtmf_send.dtmf;
|
||||||
|
|
||||||
|
if((dtmf < '0' || dtmf > '9') && (dtmf < 'A' || dtmf > 'D')
|
||||||
|
&& dtmf != '*' && dtmf != '#')
|
||||||
|
return NULL;
|
||||||
|
snprintf(buf, sizeof(buf), "%s%c", cmd, dtmf);
|
||||||
|
return strdup(buf);
|
||||||
|
}
|
||||||
|
|
||||||
static char * _request_attention_gprs(ModemPlugin * modem,
|
static char * _request_attention_gprs(ModemPlugin * modem,
|
||||||
char const * username, char const * password)
|
char const * username, char const * password)
|
||||||
{
|
{
|
||||||
|
@ -876,8 +876,9 @@ int phone_dialer_append(Phone * phone, char character)
|
|||||||
#endif
|
#endif
|
||||||
if(phone->di_window == NULL)
|
if(phone->di_window == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if((character < '0' || character > '9') && character != '*'
|
if((character < '0' || character > '9')
|
||||||
&& character != '+' && character != '#')
|
&& (character < 'A' || character > 'D')
|
||||||
|
&& character != '*' && character != '#')
|
||||||
return -1; /* ignore the error */
|
return -1; /* ignore the error */
|
||||||
text = gtk_entry_get_text(GTK_ENTRY(phone->di_entry));
|
text = gtk_entry_get_text(GTK_ENTRY(phone->di_entry));
|
||||||
len = strlen(text) + 2;
|
len = strlen(text) + 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user