tzwrapper.cc: fixed use of iterator after erase
[barry.git] / doc / bb_sms_format.txt
blob152c1808ae942fba41daec9ec83f7725819145dc
1 BlackBerry SMS Messages Record Format
3 This information is result of over 9000 btool -d Tasks dumps from a *single* BB 8800.
5 RIM 8800 Series Colour GPRS Handheld
6 App Version v4.5.0.81(108), platform 2.7.0.78
8 There are several cases not tested yet, which are hard to catch, i.e. `Pending', etc.
9 information on these incidents is welcomed. Incidentally, some listings here may be inaccurate.
11 ==Header==
12 Length = const 0x0f bytes
14 00000000: 04 00 x0 x1 40 ?? 44 05 01 00 x2 x3 x4 x5 00  ....@.D........
15           _____ _____ ___________ _____ ___________ __
16           type  len   var0        index uniqueID
18 type        - always 04 00, perhaps SMS uses this but others also do
19 len         - length of this record in bytes, including header.
20 var0        - 40 02 44 05/40 01 44 05(according to my 9000+ messages), change but all records keep the same.
21 index       - the record number within the data base.
22               determines posting order in the device (That is, if you
23               change sort order, the indices of tasks will be modified.
24               Similarly, if you change the priority or due date of a task
25               the ordinal might change as well.
26 uniqueID    - 32byte Integer, unique for each task,
27               generated by time.
29 ==Content Fields==
31 The content is divided into 7+ parts, each with a 3byte header:
32 id# format meaning
33 --- ------ -------
34 00  2byte  size(excluding this header)
35 01  1byte  field type
37 The field type has 7 possible values, ordered as their appearances:
39 ===Field Type 01===
40 Meaning: Metadata
41 Size: 0x40
42 Repeat Count: 1
43 Content:
45 id#   var    format   worked-out  meaning(variable)/value(constant)
46 ----  ---    -------  ----------  ---------------------------------------
47 00    yes    byte     yes         00=SENT/DRAFT, 01=RECV
48 01    yes    byte     yes         status flags, 80=SEND ERROR, 40=DELIVERY REPORT ON(!not sure),
49                                   20=START NEW CONVERSATION, 10=SAVED, 08=DELETED, 01=OPENED
50 02    yes    byte     yes         00=OLD, 01=NEW
51 03    no     2byte    yes         00 00
52 04    yes    4byte    yes         ff 07 00 00=RECV, ff 1f 00 00=SEND ERROR, ff ff 3f 00=DELIVERY SUCCEDDED
53                                   ff ff ff 01=SENT, ff ff ff 07=WAITING, ff ff ff 7f=DRAFT
54 05    yes    4byte    no          error id, 00 00 00 00=NO ERROR, 84 34 00 00=Unidentified Subscriber
55 06    yes    8byte    yes         8byteInt representing UNIX time(in milliseconds), first 4 bytes=uniqueID
56 07    yes    8byte    yes         representing sent time(like #06), probably not in UTC.
57 08    yes    byte     yes         Data Coding Scheme: 00=7bit, 01=VCARD, 02=UCS2
58 09    yes    2byte    no          00 00=SENT/DRAFT, 04 00=RECV, sometimes all 04 00, probably garbage information
59 0a    yes    4byte    yes         00 00 00 00=TEXT, 02 00 00 04=SEND AS FAX3, 03 00 00 04=SEND AS FAX4,
60                                   04 00 00 04=SEND AS VOICE, 05 00 00 04=SEND AS ERMES
61 0b    yes    28byte   yes         00 00 00 00 00 00 00 00
62                                   00 00 00 00 00 00 00 00
63                                   00 00 00 00 00 00 00 00
64                                   00 00 00 00
66 ===Field Type 09===
67 Meaning: Unknown
68 Size: Multiple of 0x8(The multiplier is probably send_times)
69 Repeat Count: 1
70 Content:
72 id#   var    format   worked-out  meaning(variable)/value(constant)
73 ----  ---    -------  ----------  ---------------------------------------
74 00    yes    unknonwn no          Unknown
77 ===Field Type 0B===
78 Meaning: Unknown
79 Size: Half of the size of field type 09
80 Repeat Count: 1
81 Content:
83 id#   var    format   worked-out  meaning(variable)/value(constant)
84 ----  ---    -------  ----------  ---------------------------------------
85 00    yes    unknown  no          Unknown
87 ===Field Type 02===
88 Meaning: Phone Number
89 Size: pn_length + 0x5
90 Repeat Count: recipient_num
91 Content:
93 id#   var    format   worked-out  meaning(variable)/value(constant)
94 ----  ---    -------  ----------  ---------------------------------------
95 00    yes    4byte    no          00 00 00 00/01 00 00 00/03 00 00 00
96 01    yes    string   yes         current recipient's number
97 02    no     byte     yes         trailing NULL
99 ===Field Type 04===
100 Meaning: SMS Content
101 Size: content_length
102 Repeat Count: 1
103 Content:
105 id#   var    format   worked-out  meaning(variable)/value(constant)
106 ----  ---    -------  ----------  ---------------------------------------
107 00    yes    string   yes         content
109 ===Field Type 07===
110 Meaning: Unknown
111 Size: 0xf
112 Repeat Count: 1
113 Content(May be very inaccurate):
115 id#   var    format   worked-out  meaning(variable)/value(constant)
116 ----  ---    -------  ----------  ---------------------------------------
117 00    yes    3byte    no          Unknown
118 01    yes    byte     yes         `Sent As', 00=TEXT, 02=FAX3, 03=FAX4, 04=VOICE, 05=ERMES
119 02    no     2byte    yes         00 00
120 03    yes    byte     yes         00=DEFAULT, 04=SEND AS NON-TEXT
121 04    yes    4byte    yes         00 00 00 00=SEND AS NON-TEXT, 00 00 00 01=DEFAULT
122 06    no     byte     yes         01
123 07    yes    byte     yes         00=DELIVERY REPORT OFF, 01=DELIVERY REPORT ON
124 08    no     2byte    yes         00 00
126 ===Field Type 0c===
127 Meaning: Possibly Footer
128 Size: 0x8
129 Repeat Count: 1
130 Content:
132 id#   var    format   worked-out  meaning(variable)/value(constant)
133 ----  ---    -------  ----------  ---------------------------------------
134 00    no     8byte    yes         00 00 00 00 ff ff ff ff