gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnokiid patch to print ERROR after unkown AT+C and AT+G commands (and mo


From: Daniele Forsi
Subject: gnokiid patch to print ERROR after unkown AT+C and AT+G commands (and more)
Date: Thu, 29 Dec 2005 19:41:58 +0100
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Here is a patch to print MR_ERROR message after those commands that aren't recognized by gn_atem_command_plusc and gn_atem_command_plusg
now only MR_OK is printed in the callee.

While I was at it I noticed that two strings had \r\n at wrong places, that the error message <Not implemented> for PDU_MODE should be prefixed by a 0 (I read it in a GSM reference document) and my caller ID patch did print MR_ERROR in the callee instead of the caller like all other functions and a nice off by one bug by me!

Index: at-emulator.c
===================================================================
RCS file: /sources/gnokii/gnokii/common/data/at-emulator.c,v
retrieving revision 1.43
diff -u -r1.43 at-emulator.c
--- at-emulator.c       27 Jun 2005 21:51:24 -0000      1.43
+++ at-emulator.c       29 Dec 2005 18:08:29 -0000
@@ -569,6 +569,7 @@
                                buf++;
                                /* Returns true if error occured */
                                if (gn_atem_command_plusc(&buf) == true) {
+                                       gn_atem_modem_result(MR_ERROR);
                                        return;
                                }
                                break;
@@ -577,6 +578,7 @@
                                buf++;
                                /* Returns true if error occured */
                                if (gn_atem_command_plusg(&buf) == true) {
+                                       gn_atem_modem_result(MR_ERROR);
                                        return;
                                }
                                break;
@@ -592,6 +594,7 @@
                        buf++;
                        /* Returns true if error occured */
                        if (gn_atem_command_diesis(&buf) == true) {
+                               gn_atem_modem_result(MR_ERROR);
                                return;
                        }
                        break;
@@ -620,7 +623,7 @@
                if ((message->dcs.type == GN_SMS_DCS_GeneralDataCoding) &&
                    (message->dcs.u.general.alphabet == GN_SMS_DCS_8bit))
                        gsprintf(line, MAX_LINE_LENGTH,
-                               
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"%s\r\n"),
+                               
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\r\n%s"),
                                (message->status ? _("REC READ") : _("REC 
UNREAD")),
                                message->remote.number,
message->smsc_time.year, message->smsc_time.month, message->smsc_time.day,
@@ -628,7 +631,7 @@
                                message->time.timezone, _("<Not implemented>"));
                else
                        gsprintf(line, MAX_LINE_LENGTH,
-                               
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"%s\r\n"),
+                               
_("\"%s\",\"%s\",,\"%02d/%02d/%02d,%02d:%02d:%02d+%02d\"\r\n%s"),
                                (message->status ? _("REC READ") : _("REC 
UNREAD")),
                                message->remote.number,
message->smsc_time.year, message->smsc_time.month, message->smsc_time.day,
@@ -636,7 +639,7 @@
                                message->time.timezone, 
message->user_data[0].u.text);
                break;
        case PDU_MODE:
-               gsprintf(line, MAX_LINE_LENGTH, _("<Not implemented>"));
+               gsprintf(line, MAX_LINE_LENGTH, _("0,<Not implemented>"));
                break;
        default:
                gsprintf(line, MAX_LINE_LENGTH, _("<Unknown mode>"));
@@ -747,7 +750,7 @@
                        error = gn_sms_send(&data, sm);

                        if (error == GN_ERR_NONE) {
-                               gsprintf(buffer, MAX_LINE_LENGTH, "\r\n+CMGS: %d", 
data.sms->number);
+                               gsprintf(buffer, MAX_LINE_LENGTH, "+CMGS: %d\r\n", 
data.sms->number);
                                gn_atem_string_out(buffer);
                                gn_atem_modem_result(MR_OK);
                        } else {
@@ -1042,7 +1045,7 @@
        if (strncasecmp(*buf, "MM", 3) == 0) {
                buf[0] += 2;

- gsprintf(buffer, MAX_LINE_LENGTH, _("ngnokii configured on %s for models %s\r\n"), sm->config.port_device, sm->driver.phone.models); + gsprintf(buffer, MAX_LINE_LENGTH, _("gnokii configured on %s for models %s\r\n"), sm->config.port_device, sm->driver.phone.models);
                gn_atem_string_out(buffer);
                return (false);
        }
@@ -1081,14 +1084,13 @@
                                return (false);
                        } else {
                                number = gn_atem_num_get(buf);
-                               if ( number >= 0 && number <= 2 ) {
+                               if ( number >= 0 && number <= 1 ) {
                                        CallerIDMode = number;
                                        return (false);
                                }
                        }
                }
        }
-       gn_atem_modem_result(MR_ERROR);
        return (true);
 }


--
Daniele




reply via email to

[Prev in Thread] Current Thread [Next in Thread]