gnokii-commit
[Top][All Lists]
Advanced

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

[SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-34


From: Pawel Kot
Subject: [SCM] libgnokii and core programs branch, master, updated. rel_0_6_29-343-g68a3e10
Date: Sun, 25 Dec 2011 19:45:41 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "libgnokii and core programs".

The branch, master has been updated
       via  68a3e1085dd30965bc2e68399855bffc84e711cc (commit)
      from  7de9d7a93df13453ca42bd786ac01eff4e2c54ee (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/gnokii.git/commit/?id=68a3e1085dd30965bc2e68399855bffc84e711cc


commit 68a3e1085dd30965bc2e68399855bffc84e711cc
Author: Pawel Kot <address@hidden>
Date:   Sun Dec 25 20:41:28 2011 +0100

    Implement GN_OP_Ping
    
    GN_OP_Ping is a new operation intended to keep alive the connection.
    Implement it for AT driver.

diff --git a/ChangeLog b/ChangeLog
index 104c995..99a1d94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
     o move device_script() to generic device; it will cause ability
       to execute connect_script and disconnect_script with all
       connection types                                  (Paweł Kot)
+    o implement GN_OP_Ping operation                    (Paweł Kot)
  * at driver updates
     o in the default case autodetect if PDU SMS starts with SMSC
                                                     (Daniele Forsi)
@@ -19,6 +20,7 @@
       Tristan Drinkwater for patient testing            (Paweł Kot)
     o add optional authentication during the initialization phase
                                                         (Paweł Kot)
+    o implement GN_OP_Ping operation                    (Paweł Kot)
  * fake driver updates
     o always autodetect if PDU SMS starts with SMSC (Daniele Forsi)
  * Documentation updates
diff --git a/common/phones/atgen.c b/common/phones/atgen.c
index 3a912a3..21f7a49 100644
--- a/common/phones/atgen.c
+++ b/common/phones/atgen.c
@@ -114,6 +114,7 @@ static gn_error AT_SendDTMF(gn_data *data, struct 
gn_statemachine *state);
 static gn_error AT_GetActiveCalls(gn_data *data, struct gn_statemachine 
*state);
 static gn_error AT_OnSMS(gn_data *data, struct gn_statemachine *state);
 static gn_error AT_GetSMSMemorySize(gn_data *data, struct gn_statemachine 
*state);
+static gn_error AT_Ping(gn_data *data, struct gn_statemachine *state);
 
 typedef struct {
        int gop;
@@ -167,6 +168,7 @@ static at_function_init_type at_function_init[] = {
        { GN_OP_OnSMS,                 AT_OnSMS,                 Reply },
        { GN_OP_AT_IncomingSMS,        NULL,                     
ReplyIncomingSMS },
        { GN_OP_AT_GetSMSMemorySize,   AT_GetSMSMemorySize,      
ReplyGetSMSMemorySize },
+       { GN_OP_Ping,                  AT_Ping,                  Reply },
 };
 
 /*
@@ -1799,6 +1801,14 @@ static gn_error AT_GetSMSMemorySize(gn_data *data, 
struct gn_statemachine *state
        return sm_block_no_retry(GN_OP_AT_GetSMSMemorySize, data, state);
 }
 
+static gn_error AT_Ping(gn_data *data, struct gn_statemachine *state)
+{
+       if (sm_message_send(3, GN_OP_Ping, "AT\r", state))
+               return GN_ERR_NOTREADY;
+
+       return sm_block_no_retry(GN_OP_Ping, data, state);
+}
+
 static gn_error ReplyReadPhonebook(int messagetype, unsigned char *buffer, int 
length, gn_data *data, struct gn_statemachine *state)
 {
        at_driver_instance *drvinst = AT_DRVINST(state);
diff --git a/gnokii/gnokii.c b/gnokii/gnokii.c
index 035d627..ae39196 100644
--- a/gnokii/gnokii.c
+++ b/gnokii/gnokii.c
@@ -177,7 +177,8 @@ typedef enum {
        OPT_CONFIGMODEL,
        OPT_SHELL,
        OPT_GETMMS,                     /* 340 */
-       OPT_DELETEMMS
+       OPT_DELETEMMS,
+       OPT_PING
 } opt_index;
 
 static FILE *logfile = NULL;
@@ -233,7 +234,8 @@ static int usage(FILE *f, int argc, char *argv[])
                             "                 [dial] [profile] [settings] 
[wap] [logo] [ringtone]\n"
                             "                 [security] [file] [other]\n"
                             "          --version\n"
-                            "          --shell\n"));
+                            "          --shell\n"
+                            "          --ping\n"));
 
        /* FIXME? throw an error if argv[i] is duplicated or unknown */
        for (i = 1; i < argc; i++) {
@@ -448,6 +450,18 @@ static int foogle(int argc, char *argv[])
 }
 #endif
 
+static int ping(gn_data *data, struct gn_statemachine *state)
+{
+        gn_error err;
+
+       err = gn_sm_functions(GN_OP_Ping, data, state);
+       if (err == GN_ERR_NONE)
+               fprintf(stdout, _("Device responded OK.\n"));
+        else
+                fprintf(stdout, _("Device did not respond.\n"));
+        return err;
+}
+
 static int parse_options(int argc, char *argv[])
 {
        int c;
@@ -700,7 +714,7 @@ static int parse_options(int argc, char *argv[])
                /* Delete a file by id */
                { "deletefilebyid",     required_argument, NULL, 
OPT_DELETEFILEBYID },
 
-               /* shell like interface */
+               /* Shell like interface */
                { "shell",              no_argument, NULL, OPT_SHELL },
 
                /* Get MMS message mode */
@@ -709,6 +723,9 @@ static int parse_options(int argc, char *argv[])
                /* Delete MMS message mode */
                { "deletemms",          required_argument, NULL, OPT_DELETEMMS 
},
 
+               /* Check if the phone responds */
+               { "ping",               no_argument, NULL, OPT_PING },
+
                { 0, 0, 0, 0 },
        };
 
@@ -779,6 +796,7 @@ static int parse_options(int argc, char *argv[])
                { OPT_GETMMS,            2, 6, 0 },
                { OPT_DELETEMMS,         2, 3, 0 },
                { OPT_FOOGLE,            0, 0, 0 },
+               { OPT_PING,              0, 0, 0 },
                { 0, 0, 0, 0 },
        };
 
@@ -1104,6 +1122,9 @@ static int parse_options(int argc, char *argv[])
        case OPT_SHELL:
                rc = shell(data, state);
                break;
+       case OPT_PING:
+               rc = ping(data, state);
+               break;
 #ifndef WIN32
        case OPT_FOOGLE:
                rc = foogle(argc, argv);
diff --git a/include/gnokii/data.h b/include/gnokii/data.h
index fa51d34..a35c3dd 100644
--- a/include/gnokii/data.h
+++ b/include/gnokii/data.h
@@ -281,6 +281,7 @@ typedef enum {
        GN_OP_DeleteFileById,
        GN_OP_GetMMS,
        GN_OP_DeleteMMS,
+       GN_OP_Ping,
        GN_OP_Max,      /* don't append anything after this entry */
 } gn_operation;
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog             |    2 ++
 common/phones/atgen.c |   10 ++++++++++
 gnokii/gnokii.c       |   27 ++++++++++++++++++++++++---
 include/gnokii/data.h |    1 +
 4 files changed, 37 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
libgnokii and core programs



reply via email to

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