dun: Add ATX command in emulator (X0 only)
PATCH 1/1 dun: Add ATX command in emulator (X0 only)
--- src/emulator.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-)
src/emulator.c +56 -1
@@ -177,6 +177,59 @@ error:g_at_server_send_final (em->server,G_AT_SERVER_RESULT_ERROR ); } +static gboolean get_result_value (GAtServer *server,GAtResult *result, +int min,int max,int *value) +{ +GAtResultIter iter; +int val; + +g_at_result_iter_init (&iter, result); + +if (!g_at_result_iter_next (&iter,"" )) +return FALSE; + +if (!g_at_result_iter_next_number (&iter, &val)) +return FALSE; + +if (val < min || val > max) +return FALSE; + +if (value !=NULL ) + *value = val; + +return TRUE; +} + +static void at_x_cb (GAtServer *server,GAtServerRequestType type, +GAtResult *result,gpointer user_data) +{ +switch (type) { +case G_AT_SERVER_REQUEST_TYPE_SET : +if (!get_result_value (server, result,0 ,0 ,NULL )) { +g_at_server_send_final (server, +G_AT_SERVER_RESULT_ERROR ); +return ; + } +/* the value is not stored, as there's only one choice */ +g_at_server_send_final (server,G_AT_SERVER_RESULT_OK ); +break ; + +case G_AT_SERVER_REQUEST_TYPE_QUERY : +g_at_server_send_info (server,"000" , TRUE); +g_at_server_send_final (server,G_AT_SERVER_RESULT_OK ); +break ; + +case G_AT_SERVER_REQUEST_TYPE_SUPPORT : +g_at_server_send_info (server,"X: (0-0)" , TRUE); +g_at_server_send_final (server,G_AT_SERVER_RESULT_OK ); +break ; + +default : +g_at_server_send_final (server,G_AT_SERVER_RESULT_ERROR ); +break ; + } +} +static void brsf_cb (GAtServer *server,GAtServerRequestType type,GAtResult *result,gpointer user_data) {
@@ -466,8 +519,10 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)__ofono_atom_register (em->atom, emulator_unregister); -if (em->type ==OFONO_EMULATOR_TYPE_DUN ) +if (em->type ==OFONO_EMULATOR_TYPE_DUN ) {g_at_server_register (em->server,"D" , dial_cb, em,NULL ); +g_at_server_register (em->server,"X" , at_x_cb, em,NULL ); + }else if (em->type ==OFONO_EMULATOR_TYPE_HFP )g_at_server_set_echo (em->server, FALSE); }
Signature · 1 line
1.7.1
Hi Olivier,
Quoted 4 lines · Olivier Guiter
--- src/emulator.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-)
I applied this patch, however...
<snip>
src/emulator.c error: · line 218
Quoted 2 lines
src/emulator.c +2
-0+case G_AT_SERVER_REQUEST_TYPE_QUERY : +g_at_server_send_info (server,"000" , TRUE);
This seems fishy to me. Shouldn't this be X: 0?
Review
Quoted 2 lines
(quoted diff) +2
-0+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break;
<snip>
Regards,
-Denis
Quoted 15 lines · Denis Kenzior
Hi Olivier,
Quoted 4 lines · Olivier Guiter
--- src/emulator.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-)I applied this patch, however...
<snip>
src/emulator.c error: · line 218
Quoted 2 lines
src/emulator.c +2
-0+case G_AT_SERVER_REQUEST_TYPE_QUERY : +g_at_server_send_info (server,"000" , TRUE);This seems fishy to me. Shouldn't this be X: 0?
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break;<snip>
Regards,
-Denis
It should be ;) but i tried to keep the answer format consistent with other AT command answers... Maybe i m wrong ?
Olivier
Hi Olivier,
Quoted 17 lines · Olivier Guiter
Quoted 16 lines · Denis Kenzior
Hi Olivier,
Quoted 5 lines · Olivier Guiter
--- src/emulator.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 1 deletions(-)I applied this patch, however...
<snip>
src/emulator.c error: · line 218
Quoted 2 lines
src/emulator.c +2
-0+case G_AT_SERVER_REQUEST_TYPE_QUERY : +g_at_server_send_info (server,"000" , TRUE);This seems fishy to me. Shouldn't this be X: 0?
Quoted 8 lines
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK); + break;<snip>
Regards,
-DenisIt should be ;) but i tried to keep the answer format consistent with other AT command answers... Maybe i m wrong ?
What other AT command answers?
Anyhow, I've reverted this patch for now since I realized that ATX is already implemented in gatserver.c
Regards,
-Denis