AT parsing

Rene Kluwen / Chimit Software Solutions <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hello devel,

I was in discussion with Oded about something (something else, btw.).
And I would like to ask the following to everybody in the list.

Question:

At this moment, each function implements its own AT parsing, most of it
is done (rudimentarily) in at2_wait_modem_command.
Would Kannel benefit from a general AT responses/indications parser?

I am thinking of something like:

/* this function takes a AT response or indication and returns the
 * parameters as an Octstr-list.
 * returns 0 on success or -1 on error.
 */
int at2_parse_at(Octstr *line, List **result)
{
    ...
}
But any other result parameters that can be easily used in a calling
function is also good for me ;)...

Reason for this proposal is that in similar projects, I did we also
started out with simple search functions, etc. But on the way -while
more functionality is added- these things were copy/pasted into the
new functions, causing redundancy.
Above that, parsing functions like that tend to be readable very
bad, because of all the exceptions you have to take into account: Are
we expecting / getting quotes or not. And what if we only get one
quote without a closing one... What if a parameter is skipped in the
response... etc.

-- 
Best regards,
 Rene                          mailto:[email protected]
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.