Discussion:
[Bitpim-devel] Re: [bitpim-cvs-checkins] bitpim commport.py,1.34,1.35
Roger Binns
2004-10-15 05:36:17 UTC
Permalink
Next pass at modem mode commands.
Have you considered a slightly different approach. The consumer code would
look like this:

try:
for line in foo.sendatcommand("AT+GMM"):
print line # or do whatever
for line in foo.sendatcommand("ATsomethingelse"):
print line # or do whatever

except common.ATError:
# deal with error

Whether the ERROR string should be an exception or a function return value
depends on how often it happens. I believe it won't happen that often in
production code since we know what the phone is and what we except it to
do. Obviously it will happen a lot more during development. You can
include the command in the exception attributes. (Doing it the above
way also makes it a lot more efficient over bitfling as only a single
function is called with a single response).

I also have the feeling we will need some sort of format string that
will need to be passed to the line parsing code. The existing packet
description stuff could be used, or something new.

Roger
Stephen Wood
2004-10-15 12:38:59 UTC
Permalink
Post by Roger Binns
Next pass at modem mode commands.
Have you considered a slightly different approach. The consumer code would
print line # or do whatever
print line # or do whatever
# deal with error
Since my sendatcommand now reads and caches the entire response, this
probably makes sense now.

Do you think it OK for sendatcommand to prepend the "AT", or should it
always be called with the full command
Post by Roger Binns
I also have the feeling we will need some sort of format string that
will need to be passed to the line parsing code. The existing packet
description stuff could be used, or something new.
Probably. The types I have seen are integer, string (which is quoted),
date and timestamp. (The VGA1000 has a time stamp that is changed
whenever an entry is changed. However, the timestamp only seems to
exist if one has set the birthday for that entry.)

I'll will code up phonebook reading and do the parsing by hand so I can
get a feel for things. Then I'll have a better idea of what kind of
packet description stuff is needed.

Stephen

P.S. I would appreciate it if developers could test their favorite
(freshly rebooted) phone every time I update commport.py or
com_brew.py. The Samsung stuff should be orthogonal to most everything,
but I have switched over to using sendatcommand in com_brew to do the
prohibited phone (A700) check, so all phones will be exposed to
sendatcommand.

Loading...