Hello Chris, I've been working on the sms parser for Barry, the code is raw, since the data structure for SMS is really strange and I can't use a packed struct to handle this effectively. But at least, it works now. And I'll do some refinement later when I have finished my homework.
However, I've checked the common.h file and found that the iconv.cc in Barry
converts WINDOWS-1252 to UTF-8, but with SMS encoded as UCS-2, btool
displays my Chinese messages as garbled text. Furthermore, after I changed
the definition of BLACKBERRY_CHARSET to `UCS-2', the output doesn't change.
I thought there's something wrong with iconv.cc? My Memo in 100% English
can't be interpreted correctly either.
Nevertheless, it should work for Western languages, copy the two source
files to /src and modify /tools/btool.cc, /src/record.h, /src/Makefile.am.
Make install and run btool.
r_sms.cc, r_sms.h and bb_sms_format.txt attached.
Best Regards,
Ryan Li
Chris Frey wrote:
On Mon, Mar 23, 2009 at 05:53:51PM +0800, Ryan Li wrote:
Hello everyone,
It seems that there's currently no tools for sms parsing, so I hacked
out one within two months. Haven't checked through the code of barry, I
wrote this parser from scratch. The code surely looks ugly and clumsy,
since it's the first time that I wrote something that I think is a bit
useful(don't mention the damn school homework).
Hi Ryan,
Welcome to Barry!
I just got a chance to look at your code in detail today, and thanks
very much. I like to see people using Barry in ways I didn't expect
originally. :-)
This would ideally be a record parser in the Barry library, and since
you've already done the reverse engineering and proof of concept, it's
just a matter of doing the porting.
I notice that your code is licensed under GPL v3. Barry is licensed
under "GPL v2 and any later version". As a library, this makes it
compatible with a slightly wider number of application licenses. But it also
means that we can't include your code directly into the library without
changing our license as well. I could drop your code in the contrib/
directory though. Would you be willing to relicense your code and
documentation under GPL v2 and later?
If so, I'd like to apply your bb_sms_format.txt file as a documentation
patch right away, and we can work together on porting the record parsing
code to the Barry library.
Feedback is greatly welcomed and when this program becomes a little more
mature I hope I could have it integrated back into btool. More
information can be found in the readme file.
Here's a little feedback from reading the code:
- I see you make use of custom bit stream code, and then
parse the streams using a series of if statements.
The way Barry does parsing like this is to use a set of
structs that match the data layout as closely as possible.
This is a challenge sometimes, but a series of if statements
should translate fairly well into a struct.
- you have custom code to convert from UCS2 to UTF8 manually...
in Barry, we use the iconv library, and we have a class wrapper
to do the work... this conversion is optional and
configurable in Barry as well... see the IConverter class
- some of the manual memory handling should probably be changed to
std::string or Barry's Data class
That said, I've run the code, and it works as advertised. :-)
Thanks again,
- Chris
------------------------------------------------------------------------------
_______________________________________________
Barry-devel mailing
[email protected]https://lists.sourceforge.net/lists/listinfo/barry-devel
r_sms.tar.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------------
_______________________________________________ Barry-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/barry-devel
