Discussion:
[Bitpim-devel] Samsung packet descriptions
Stephen Wood
2004-12-07 05:43:21 UTC
Permalink
I have written a packet description field type for strings in Samsung AT
commands. You can see how it is used in p_samsungscha620.p. Run
"python analyser.py examples/sampackets.txt" to see how it parses an AT
response.

I believe I put in enough options so that we can parse the coma
separated values in all the Samsung response strings we might
encounter. Of course the items in an AT string are a mix of strings,
integers, dates and timestamps.

I see three ways of dealing with the various data types and am looking
for opinions.

1. Return everything as a string and leave it up to the phone code to
convert these strings to integers or dates as needed.

2. Add options to SAMSTRING that tell the parser to specify data type
to return a field value as.

3. Add more field types such as SAMINT, SAMDATE, SAMRANGE, that return
the desired type. These would want to inherit from SAMSTRING, in order
not to duplicate code, something that I would have to take a bit of time
to figure out how to do since I only know how to do OO by imitation.

Stephen
Roger Binns
2004-12-07 06:42:38 UTC
Permalink
Post by Stephen Wood
3. Add more field types such as SAMINT, SAMDATE, SAMRANGE, that return
the desired type. These would want to inherit from SAMSTRING, in order
not to duplicate code, something that I would have to take a bit of time
to figure out how to do since I only know how to do OO by imitation.
This would be the best choice since it will do type verification
and be most convenient to work with. The types stuff is designed
for OO (especially inheritance). See the comment at the top
of prototypes. LGCALDATE is also an example of inheritance.

Roger
Stephen Wood
2004-12-07 13:21:08 UTC
Permalink
Post by Roger Binns
Post by Stephen Wood
3. Add more field types such as SAMINT, SAMDATE, SAMRANGE, that return
the desired type. These would want to inherit from SAMSTRING, in order
not to duplicate code, something that I would have to take a bit of time
to figure out how to do since I only know how to do OO by imitation.
This would be the best choice since it will do type verification
and be most convenient to work with. The types stuff is designed
for OO (especially inheritance). See the comment at the top
of prototypes. LGCALDATE is also an example of inheritance.
Roger
Thanks for the LGCALDATE pointer, I missed it.

My Samsung phone has a Birthday field (e.g. 01/16/1984) and a time stamp
(e.g. 20040629T214559). The question is, can these be added to the
BitPim phonebook fields? (Or should the the time stamp be munged into a
serial number). And is our internal representation of a date and a time
the same? (Would help me decide if I make just SAMDATE with options, or
SAMDATE and SAMDATETIME).

Stephen

Loading...