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

"Nikos Balkanas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <873E8DF279D547E6A998AC92A26ECE34@drwho>
Oops! Sorry about that. Here is the version for modems group.

Configures parameter message-start in group modems.

Can you please restest?

Thanks,
Nikos
----- Original Message ----- 
From: "Chris Holt" <[email protected]>
To: "Nikos Balkanas" <[email protected]>
Cc: <[email protected]>
Sent: Friday, April 23, 2010 5:02 AM
Subject: Re: Patch: Adding support for sim-start in smsc_at.c


>I applied it to my 1.4.3 source and it works, except the sim-start had
> to be in group smsc not modems.
>
> Many thanks!
> -Chris
>
> 2010/4/22 Nikos Balkanas <[email protected]>:
>> 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.4 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	23 Apr 2010 09:57:35 -0000
@@ -532,6 +532,7 @@
     OCTSTR(keepalive-cmd)
     OCTSTR(broken)
     OCTSTR(message-storage)
+    OCTSTR(message-start)
     OCTSTR(enable-mms)
     OCTSTR(reset-string)
 )
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	23 Apr 2010 09:57:36 -0000
@@ -1087,6 +1087,7 @@
          */
         int i;
         int message_count = 0; /* cound number of messages collected */
+        ModemDef *modem = privdata->modem;
 
         debug("bb.smsc.at2", 0, "AT2[%s]: %d messages waiting in memory", 
               octstr_get_cstr(privdata->name), privdata->sms_memory_usage);
@@ -1094,8 +1095,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 = modem->message_start; i < (privdata->sms_memory_capacity  + modem->message_start) && 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 */
@@ -2827,6 +2827,8 @@
             modem->keepalive_cmd = octstr_create("AT");
 
         modem->message_storage = cfg_get(grp, octstr_imm("message-storage"));
+        if (cfg_get_integer(&modem->message_start, grp, octstr_imm("message-start")))
+            modem->message_start = 1;
 
         cfg_get_bool(&modem->enable_mms, grp, octstr_imm("enable-mms"));
 
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	23 Apr 2010 09:57:36 -0000
@@ -111,6 +111,7 @@
     Octstr *keepalive_cmd;
     int	broken;
     Octstr *message_storage;
+    long	message_start;
     int	enable_mms;
 } ModemDef;
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.