gsmopen: workaround for reading with timeout, need something to simulate the poll. Next week :)

This commit is contained in:
Giovanni Maruzzelli 2012-04-13 18:30:48 +02:00
parent f74ba1ae61
commit 59af24747e
2 changed files with 9 additions and 4 deletions

View File

@ -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);

View File

@ -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)