Stephen Wood
2004-12-07 05:43:21 UTC
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
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