From 59af24747ecd2d1d17b4c87e0d24b4cdb1179d78 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 13 Apr 2012 18:30:48 +0200 Subject: [PATCH] gsmopen: workaround for reading with timeout, need something to simulate the poll. Next week :) --- src/mod/endpoints/mod_gsmopen/gsmopen.h | 6 ++++-- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 949444d47d..355ae4a588 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -537,8 +537,10 @@ int gsmopen_serial_config_AT(private_t *tech_pvt); #define gsmopen_serial_write_AT_expect_noexpcr(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 0, 0) #define gsmopen_serial_write_AT_expect_noexpcr_tout(P, D, S, T) gsmopen_serial_write_AT_expect1(P, D, S, 0, T) // 20.5 sec timeout, used for querying the SIM and sending SMSs -#define gsmopen_serial_write_AT_expect_longtime(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 1, 20) -#define gsmopen_serial_write_AT_expect_longtime_noexpcr(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 0, 20) +//#define gsmopen_serial_write_AT_expect_longtime(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 1, 20) +//#define gsmopen_serial_write_AT_expect_longtime_noexpcr(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 0, 20) +#define gsmopen_serial_write_AT_expect_longtime(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 1, 5) +#define gsmopen_serial_write_AT_expect_longtime_noexpcr(P, D, S) gsmopen_serial_write_AT_expect1(P, D, S, 0, 5) int gsmopen_serial_write_AT(private_t *tech_pvt, const char *data); int gsmopen_serial_write_AT_nocr(private_t *tech_pvt, const char *data); int gsmopen_serial_write_AT_ack(private_t *tech_pvt, const char *data); diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index 7943b84355..c45828856e 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -1893,7 +1893,8 @@ int gsmopen_serial_write_AT_ack_nocr_longtime(private_t *tech_pvt, const char *d return -1; } - at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 20, NULL, 1); // 20.5 sec timeout + //at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 20, NULL, 1); // 20.5 sec timeout + at_result = gsmopen_serial_read_AT(tech_pvt, 1, 500000, 3, NULL, 1); // 3.5 sec timeout UNLOCKA(tech_pvt->controldev_lock); POPPA_UNLOCKA(tech_pvt->controldev_lock); @@ -2466,7 +2467,7 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) failed = 1; goto uscita; } - err = gsmopen_serial_AT_expect(tech_pvt, "> ", 0, 1); // wait 1.5s for the prompt, no crlf + err = gsmopen_serial_AT_expect(tech_pvt, "> ", 0, 1); // wait 1.1s for the prompt, no crlf #if 1 if (err) { DEBUGA_GSMOPEN @@ -2557,10 +2558,12 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text) POPPA_UNLOCKA(&tech_pvt->controldev_lock); } +#ifdef NOTDEF err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0"); if (err) { DEBUGA_GSMOPEN("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) do not got OK from the phone, continuing\n", GSMOPEN_P_LOG); } +#endif// NOTDEF DEBUGA_GSMOPEN("FINISH\n", GSMOPEN_P_LOG); if (failed)