Patch: Adding support for sim-start in smsc_at.c

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <0DEA52842A8545738143CA06BC842C58@drwho>
Hi,

This is a simple patch to add a configuration option to at smsc, sim-start 
(in group modems). In case of sim-buffering it will set the starting buffer 
index in the sim. For some modems such as the UMG181 this needs to be set to 
0. Defaults to 1, and doesn't need changing for most others.

If admitted will also provide user-guide patch

Reported by Chris Holt.

@Chris: I have no way of testing this. Could you please do the honors?

Thanks,
Nikos
kannel.diff (application/octet-stream, 2.2 KB)
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.142
diff -a -u -r1.142 cfg.def
--- gwlib/cfg.def	6 Dec 2009 17:24:14 -0000	1.142
+++ gwlib/cfg.def	22 Apr 2010 22:44:57 -0000
@@ -323,6 +323,7 @@
     OCTSTR(smsc-password)
     OCTSTR(keepalive)
     OCTSTR(sim-buffering)
+    OCTSTR(sim-start)
     OCTSTR(modemtype)
     OCTSTR(device)
     OCTSTR(speed)
Index: gw/smsc/smsc_at.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.c,v
retrieving revision 1.63
diff -a -u -r1.63 smsc_at.c
--- gw/smsc/smsc_at.c	24 Aug 2009 09:49:08 -0000	1.63
+++ gw/smsc/smsc_at.c	22 Apr 2010 22:44:59 -0000
@@ -1094,8 +1094,7 @@
         /*
          * loop till end of memory or collected enouch messages
          */
-        for (i = 1; i <= privdata->sms_memory_capacity &&
-             message_count < privdata->sms_memory_usage; ++i) { 
+        for (i = privdata->sms_memory_start; i <= privdata->sms_memory_capacity && message_count < privdata->sms_memory_usage; ++i) {
 
             /* if (meanwhile) there are pending CMTI notifications, process these first
              * to not let CMTI and sim buffering sit in each others way */
@@ -1579,6 +1578,8 @@
         else
             privdata->sms_memory_poll_interval = AT2_DEFAULT_SMS_POLL_INTERVAL;
     }
+    if (cfg_get_integer(&privdata->sms_memory_start, cfg, octstr_imm("sim-start")))
+        privdata->sms_memory_start = 1;
 
     privdata->my_number       = cfg_get(cfg, octstr_imm("my-number"));
     privdata->sms_center      = cfg_get(cfg, octstr_imm("sms-center"));
Index: gw/smsc/smsc_at.h
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at.h,v
retrieving revision 1.18
diff -a -u -r1.18 smsc_at.h
--- gw/smsc/smsc_at.h	12 Aug 2009 15:38:27 -0000	1.18
+++ gw/smsc/smsc_at.h	22 Apr 2010 22:44:59 -0000
@@ -142,6 +142,7 @@
     int	sms_memory_poll_interval;
     int	sms_memory_capacity;
     int	sms_memory_usage;
+    long	sms_memory_start;
     List *pending_incoming_messages;
     long max_error_count;
     Octstr *rawtcp_host;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.