[RFI+Patch] AT2 Modems.conf

"Bruno David Rodrigues" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <001001c1ca04$ed917f60$733b0a0a@davi>
Attached to this message is a patch to at2 to have modem definitions outside the source

I want you to test it and check if it's working and some comments/advise to some issues:

1. I'm opening a "kannel.conf" that is hard coded on the code. It's not easy to pass the full 
Cfg struct to smsc_at2, and it's not easy to pass the config filename also. If we have a modem-def
configuration with the filename value in smsc group, there's gonna be several modem-def for each 
smsc = at2. How can I say to at2 where is kannel.conf ? 
now that we have a include directive in configuration, at2 could read directly a modems.conf or the normal kannel.conf that includes the modems.conf, or have the modems groups directly at kannel.conf

2. at2_read_modems returns a ModemDef * structure. I should do a gw_free(ModemDef), but what
about the Octstr inside it ? (I haven't yet looked at list* functions). gw_free destroys everything, 
or should I do a destroy_modemdef() and octstr_destroy every octstr and then gw_free the ModemDef?

3. the function at2_read_modems accept id string or idnumber. This way, we could directly read the
modem definition for the modemtype, or cicle through it until returning NULL in detect_modem, as you
can see at the code

4. I've tested with Ericsson T68 and Nokia 6210 with success, defining modemtype and/or speed or
letting kannel detect the modem and speed
(I haven't yet discovered the right at+cnmi for ericsson :((( )

5. grp = list_extract_first(grplist) returns a CfgGrp, shouldn't I destroy it later ? list_destroy(grp, NULL)
gaves me an error and list_destroy((List*) grp, NULL) crashes :(

6. in modems definition, I've included a keepalive-cmd. This way, I can set ericsson and Nokia to do a
AT+CBC;+CSQ and receive +CBC: 0,63 (on batery, 63% full) and +CSQ: 15,99 (gsm signal quality) :)

7. At line 520, I've set timeout waiting for +CPIN reply to 10 seconds, could you test it with the that 
modem that takes too long to reply?

8. added a colon to +CMT search (+CMTI:) to prevent it from receiving +CMTI:

9. Where's the sim/me memory patch ? ;)

I'll wait for comments.
diff (application/octet-stream, 16.3 KB) - not displayed
modems.conf (application/octet-stream, 1.6 KB)
# Modems configuration
#
# Example and default values
# 
# group = modems
# id = "my-id"
# name = "my-name"
# detect-string = "MODEM"
# detect-string2 = "" [Default]
# init-string = "AT+CNMI=1,2,0,0,0" [Default]
# speed = 9600 [Default]
# enable-hwhs = "AT+IFC=2,2" [Default]
# need-sleep = false [Default]
# no-pin = false [Default]
# no-smsc = false [Default]
# sendline-sleep = 100 [Default, miliseconds]
# keepalive-cmd = "AT" [Default]


# If modemtype=auto, try everyone and defaults to this one
group = modems
id = generic
name = "Generic Modem"

group = modems
id = wavecom
name = Wavecom
detect-string = "WAVECOM"

group = modems
id = premicell
name = Premicell
detect-string = "PREMICEL"
no-pin = true
no-smsc = true

group = modems
id = siemens_tc35
name = "Siemens TC35"
detect-string = "SIEMENS"
detect-string2 = "TC35"
init-string = "AT+CNMI=1,2,0,0,1"
speed = 19200
enable-hwhs = "AT\\Q3"
need-sleep = true

group = modems
id = siemens_m20
name = "Siemens M20"
detect-string = "SIEMENS"
detect-string2 = "M20"
speed = 19200
enable-hwhs = "AT\\Q3"
need-sleep = true

group = modems
id = nokiaphone
name = "Nokia Phone"
detect-string = "Nokia Mobile Phone"
need-sleep = true
keepalive-cmd = "AT+CBC;+CSQ"

group = modems
id = falcom
name = "Falcom"
detect-string = "Falcom"
no-smsc = true

group = modems
id = ericsson_r520m
name = "Ericsson R520m"
detect-string = "R520m"
init-string = "AT+CNMI=3,2,0,0"

group = modems
id = ericsson_t68
name = "Ericsson T68"
detect-string = "23T68"
init-string = "AT+CNMI=3,1"
keepalive-cmd = "AT+CBC;+CSQ"

group = modems
id = alcatel
name = "Alcatel"
detect-string = "Alcatel"
init-string = "AT+CNMI=3,2,0,0"
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.