Jumping Jack Flash weblog

Archivio per Febbraio, 2008

Autocostruirsi un misuratore di consumi elettrici

Pubblicato da jumpjack su 28 Febbraio 2008

Pubblicato su varie | Non ci sono Commenti »

Esportazione appunti (Jotter) da cellulari Symbian UIQ 2.x (p800, p900, Motorola a1000)

Pubblicato da jumpjack su 21 Febbraio 2008

I telefoni UIQ 2.x usano per gli appunti un formato particolare, probabilmente proprieario, binario,
incompatibile con qualunque altra applicazione. Su alcuni modelli è FORSE possibile esportali tramite
SyncML, ma in ogni caso non sul mio Motorola a1000.

Questo è uno studio di reverse engineering sul formato del jotter, che dovrebbe portare, con l’aiuto di chi legge,
a scrivere un programma per PC in grado di esportare le note del Jotter.

Gli appunti sono organizzati su due file:

c:\system\apps\jotter\jotter.ini  File delle categorie

c:\documents\jotter\jotter  File dei dati

Il file jotter.ini sembra contenere il percorso c:\documents\jotter\jotter tante volte quante sono le
categorie esistenti, incluse quelle predefinite Generale e Personale.

E’ inoltre presente l’elenco delle categorie; ogni entry è formato da:

un  byte che indica la lunghezza del testo MOLTIPLICATA PER 4 (???)

il testo

4 byte che rappresentano l’UID della categoria; il terzo di questi byte vale 0×10 se la categoria è
“di sistema” (Generale, Personale, e forse un’altra (???)  ).

La categoria “Tutto” ha l’UID speciale ff ff 00 00

Categoria ”Personale”: 01 10 00 00

Categoria ”Generale”: 02 10 00 00

Sembra che, A VOLTE (???), aggiungendo una nuova categoria, questo elenco non vnga aggiornato, ma quello nuovo viene accodato a quello vecchio.

Le categorie sono elencate in ordine alfabetico.

E’ POSSIBILE che cambiando i percorsi associati alle categorie si possa usare un file Jotter
diverso per ogni categoria (???). Forse bisogna prima creare a mano le cartelle (???).

Il file Jotter contiene i dati degli appunti. Ogni entry è formato da 6 campi (elencati all’inizio del file):

Create_date (8), Update_date (8), Flags ( 8) , UID (4) , Sketch (6), Text_Jot (xxx)

Le date sono in formato symbian standard (vedi articolo apposito).

I flag sono sempre tutti a 00 00 00 sul mio A1000.

L’UID è ovviamente quello della categoria associata.

“Sketch” è presente solo se c’e' un disegno associato alla nota

Text_jot è formato da 2 byte:

- se il primo vale 0×00, il secondo indica IL DOPPIO della lunghezza della stringa dell’appunto.

- se il secondo vale 0×40, il primo indica la lunghezza ESATTA della stringa

- se il secondo vale 0×4Y e il primo 0xQR, con Y=qualunque , allora la lunghezza della stringa è data da 0×0YQR

Probabilmente questo schema è descrivibile in un modo piu’ sensato, che al momento non mi viene in mente…

PROBLEMA: non tutti gli appunti rispettano questo schema: alcuni sono semplicemente stringhe
precedute dalla loro lunghezza!

Questo pero’ puo’ dipendere che il Jotter sul mio a1000 è stato ”ereditato” dal SonyEricsson p800
che avevo prima, per cui forse c’e' stato un miscuglio di formati.

PROBLEMA2: bisogna scoprire se esiste una tabella di indirizzi che punta ai vari entry, per individuare
anche quelli ”speciali” senza intestaiozne.

Questa prima bozza di programma è in grado di estrarre ALCUNI degli appunti (solo se successivi
al 2003), individuandoli tramite le loro date:

http://www.planetmobile.it/jumpjack/ReadJotter.zip

Pubblicato su Motorola a1000, Programmazione, Symbian, Symbian UIQ | Non ci sono Commenti »

Symbian messages format (before 9.x version)

Pubblicato da jumpjack su 2 Febbraio 2008

Some notes about binary format of SMS files on Symbian UIQ (partially applicable to Symbian series60).

SEARCHSTRING = chr$(37)+chr$(58)+chr$(0)+chr$(16) ‘ SEQUENCE “0×25 0×3A 0×00 0×10″
RECEIVEDFLAG_MARKER = chr$(32)+chr$(41)+chr$(52)+chr$(24) ‘ SEQUENCE 0×20 0×29 0×34 0×18;
‘10 bytes after sequence beginning there is the  SENT/RECEIVED flag (0×00=rec, 0×01=sent)

‘ BINARY SEQUENCE “0×25 0×3A 0×00 0×10″ IS JUST BEFORE MESSAGE BODY BEGINING.
‘ IF TWO BYTES AFTER THE “10″ THERE IS A “02″, THE MESSAGE IS FROM A SPECIAL
‘ NUMBER AND ITS BODY STARTS AT BYTE AFTER THE “02″; ELSE BODY STARTS
‘ EXACTLY TWO BYTES AFTER “10″.

‘ IT IS AN SMS ONLY IF “SEARCHSTRING” IS PRESENT (INIZIO<>0), (both s60 and UIQ)
‘ BUTNOT AT OFFSET 0×05 (I.E. UID=SEARCHSTRING).

“0×34 0×18 0×00″ (BODY END) (both s60 and UIQ)

‘ DETERMINING IF SMS OR NOT:
inizio = instr(SMSMemo,SEARCHSTRING)+ (len(SEARCHSTRING)+1)
if inizio <> 5 and mid$(SMSMemo,22,2) <> chr$(162)+chr$(4) then ‘ IF “A2 04″ THEN… (???? not a message??)
if asc(mid$(SMSMemo,inizio))<32 then
inizio = inizio + 1 ‘ ???
end if

‘ GETTING BODY:
FineTesto = instr(inizio,SMSMemo,chr$(52)+chr$(24)+chr$(0))-3 ‘ LOOK FOR “34 18 00″ (BODY END) (both s60 and UIQ)
BASE = FineTesto
InizioTesto = inizio
LunghezzaTesto = FineTesto-inizio

‘ DETERMINING IF SENT OR RECEIVED:
if asc(mid$(SMSMemo,instr(SMSMemo,RECEIVEDFLAG_MARKER)+10,1)) = 0 then  [RECEIVED MESSAGE]

‘ **** RECEIVED MESSAGE ***

‘ FINDING SENDER NUMBER;
‘ NOTE: sender NAME is not available unless looking for it into local phonebook.
SenderBeginning = BASE + SENDER_OFFSET
SenderEnd = instr(SenderBeginning,SMSMemo,chr$(57)+chr$(0))
if SenderEnd = 0 then ‘ IF SPECIAL NUMBER…
if debug<>0 then LogFile.WriteLine( “SPECIAL NUMBER?!?”)
SenderEnd = instr(SenderBeginning,SMSMemo,chr$(0)+chr$(0))
end if
SenderEnd = SenderBeginning + asc(mid$(SMSMemo,SenderBeginning-1,1))/4

‘ EXTRACTING TIMESTAMP
TimestampBeginning = SenderBeginning - TIMESTAMP_RECEIVED_OFFSET

‘ PROCESSING TIMESTAMP:
microdate(hexstring$(mid$(SMSMemo,TimestampBeginning,8)))
‘ 8 bytes long; counting microseconds since year A.D. 0 (see Microdate() functuin below)

‘***** SENT MESSAGE *****

‘EXTRACTING TIMESTAMP:
TimestampBeginning = BASE + TIMESTAMP_SENT_OFFSET

‘ EXTRACTING RECIPIENT
RecipientBeginning = BASE + RECIPIENT_OFFSET
RecipientEnd = RecipientBeginning + asc(mid$(SMSMemo,RecipientBeginning-1,1))/4-1
RecipientName = mid$(SMSMemo,RecipientEnd+2,LunghezzaNome)

function microdate(s as string) as string
DefInt y,m,d,intdays,intmin,inthours,intseconds
DefLng dd,lngdays
DefDbl dbldays,decimals,hours,minutes,seconds
dim debug as string

debug = s
dbldays = hex2dec(s)/86400000000-12
lngdays = int(dbldays)
dd = datefromserial(lngdays,y,m,d)
if y < 1997 then
microdate=”[ERROR]“
‘EXIT FUNCTION
end if
y=y-1 ‘ TIMESERIAL STARTS COUNTING FROM AD 1, SYMBIAN STARTS FROM AD 0.
decimals = dbldays-lngdays
hours = decimals*86400/3600
minutes = (hours - int(hours))*60
seconds = (minutes-int(minutes))*60
inthours = int(hours)
intmin= int(minutes)
intseconds = int(seconds)
microdate = lead0$(y) & “/” & lead0$(m) & “/” & lead0$(d) & ” ” & lead0$(inthours) & “:” & lead0$(intmin) & “:” &lead0$(intseconds)
end function

Pubblicato su Symbian, Symbian UIQ | 6 Commenti »