Discussion:
[Bitpim-devel] Describing AT commands
Roger Binns
2004-11-13 17:41:42 UTC
Permalink
I saw Stephen take a first stab at the description syntax for AT
commands (you can see that in p_samsungscha620.p).

Our current scheme is designed for binary data, as well as being
able to put in control flows (eg if statements, number of items
in a list).

I am wondering if any other scheme may work better?

One thing I was thinking of is a format string like
(s)printf takes. We could then write it something
like:

"$command %islot,%uslot,%dunno1,%dunno2,$name,%dunno3,%dunno4,$..."

Actually that seems to suck since it isn't possible to annotate
the fields amongst other things. I guess the big difference is
that whitespace can be ignored with AT style commands/responses.

Any ideas on improvements?

Roger
Stephen Wood
2004-11-13 20:06:57 UTC
Permalink
Some random thoughts:

A printf does seem kind of natural, but annotating the fields is
important.

When reading, we can pretty much identify the "type" of each field by
inspection, (number, timestamp, US date, quoted string), but it would be
good to have the types in the description, particularly for writing to
the phone. Sometimes blank fields (nothing between two commas) will be
allowed. We'll need an way/attribute to describe that.

I want to be able to put as many phone specific constants as possible in
these description files.

Once you skip over the header characters in the Samsung AT responses,
there does not seem to be any whitespace (except inside quotes). Most
responses are single lines, but some will be multiline lists (eg. groups
names, ringer names).

I'll look at the phonebook commands for GSM phones. We should make sure
we have something that isn't entirely Samsung specific.

Does anyone know if any other open source sync software has some kind of
protocol description language?

Stephen
Post by Roger Binns
I saw Stephen take a first stab at the description syntax for AT
commands (you can see that in p_samsungscha620.p).
Our current scheme is designed for binary data, as well as being
able to put in control flows (eg if statements, number of items
in a list).
I am wondering if any other scheme may work better?
One thing I was thinking of is a format string like
(s)printf takes. We could then write it something
"$command %islot,%uslot,%dunno1,%dunno2,$name,%dunno3,%dunno4,$..."
Actually that seems to suck since it isn't possible to annotate
the fields amongst other things. I guess the big difference is
that whitespace can be ignored with AT style commands/responses.
Any ideas on improvements?
Roger
-------------------------------------------------------
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
_______________________________________________
Bitpim-devel mailing list
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
Roger Binns
2004-11-13 20:51:53 UTC
Permalink
Post by Stephen Wood
A printf does seem kind of natural, but annotating the fields is
important.
A half-way house is something like:

FORMAT fooresponse:
command islot,uslot,dunno1,dunno2,name,dunno3,....,name
* STRING command "foo"
* UINT islot "bar"
* UINT {'blankok': True} uslot "bam"
...
* STRING {'maxlen': 22} name

The first line doesn't really add that much, other than
implicitly defining the field seperators. I can then also
make the compiler do some magic for FORMAT vs PACKET including
getting alternative versions of STRING/UINT etc that know
about optional double quotes etc
Post by Stephen Wood
the phone. Sometimes blank fields (nothing between two commas) will be
allowed. We'll need an way/attribute to describe that.
Yes, those are fun. I figure we need to differentiate between
them not being there, not having a value, and having a value.
For the first case we can use the existing scheme (throw an
exception on field access). For the second case it be None
and the last case is as normal.
Post by Stephen Wood
I want to be able to put as many phone specific constants as possible in
these description files.
Yup. My dream is it taking 60 seconds to support a new phone by
copying an existing file and putting in the new arbitrary limits :-)
Post by Stephen Wood
Once you skip over the header characters in the Samsung AT responses,
there does not seem to be any whitespace (except inside quotes).
I assume that the whitespace is allowed though?
Post by Stephen Wood
Most
responses are single lines, but some will be multiline lists (eg. groups
names, ringer names).
Those will be interesting to describe. We can probably get something
into the format string to show newlines?
Post by Stephen Wood
Does anyone know if any other open source sync software has some kind of
protocol description language?
The only other project I look at is FMA. The screenshots are really nice
and I like what they have done with a lot of things:

http://fma.sourceforge.net/index2.htm
Stephen Wood
2004-11-14 06:44:41 UTC
Permalink
Post by Roger Binns
Post by Stephen Wood
A printf does seem kind of natural, but annotating the fields is
important.
command islot,uslot,dunno1,dunno2,name,dunno3,....,name
* STRING command "foo"
* UINT islot "bar"
* UINT {'blankok': True} uslot "bam"
...
* STRING {'maxlen': 22} name
The first line doesn't really add that much, other than
implicitly defining the field seperators. I can then also
make the compiler do some magic for FORMAT vs PACKET including
getting alternative versions of STRING/UINT etc that know
about optional double quotes etc
The first line seems redundant. The default seperator can be ",",
except for the last item in the list which would default to end of
string.
Post by Roger Binns
Yup. My dream is it taking 60 seconds to support a new phone by
copying an existing file and putting in the new arbitrary limits :-)
I think there are two Sanyo phone just out or almost out. Well see if I
can add them in 120 seconds.
Post by Roger Binns
Post by Stephen Wood
Once you skip over the header characters in the Samsung AT responses,
there does not seem to be any whitespace (except inside quotes).
I assume that the whitespace is allowed though?
I tried putting whitespace in or before phone numbers and wrote to the
phone. The whitespace showed up on the phone.
Post by Roger Binns
Post by Stephen Wood
Most
responses are single lines, but some will be multiline lists (eg. groups
names, ringer names).
Those will be interesting to describe. We can probably get something
into the format string to show newlines?
If we don't have a format string, then we just indicate that the
seperator is endofstring whenever a new line follows.

Stephen

Loading...