Re: LG AX8600 patches, adding Memo, Call History suppor t

David Ritter <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
On Jan 2, 2008, at 10:29 PM, Joe Pham wrote:

> Can you please attach your patch file instead?
>

Ok, here's another try. Thanks for your help, I'm a little lost with  
these patch formats.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
BitPim-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
AX8600MemoCallHist.patch (application/octet-stream, 5.6 KB)
Index: src/phones/p_lgax8600.p
===================================================================
--- src/phones/p_lgax8600.p.orig      2007-12-22 10:55:11.000000000 -0500
+++ src/phones/p_lgax8600.p   2007-12-30 17:15:44.000000000 -0500
@@ -200,11 +200,27 @@
 # the features that other phones support, when you run bitpim you see loads of
 # options that do not work in the vx8100 on the memo page
 PACKET textmemo:
-    152 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False } text
-    4 UINT {'default' : 0x1000000} +dunno
+    151 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False } text
     4 LGCALDATE memotime # time the memo was writen LG time
 
 PACKET textmemofile:
     4 UINT itemcount
     * LIST { 'elementclass': textmemo } +items
 
+
+PACKET call:
+    4 GPSDATE GPStime #no. of seconds since 0h 1-6-80, based off local time.
+    4 UINT unknown2 # different for each call
+    4 UINT duration #seconds, not certain about length of this field
+    49 USTRING {'raiseonunterminatedread': False} number
+    36 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False} name
+    2 UINT numberlength # length of phone number
+    1 UINT pbnumbertype # 1=cell, 2=home, 3=office, 4=cell2, 5=fax, 6=vmail, 0xFF=not in phone book
+    3 UINT unknown2 #
+    2 UINT pbentrynum #entry number in phonebook
+    58 UINT unknown3
+       
+PACKET callhistory:
+    4 UINT numcalls
+    1 UINT unknown1
+    * LIST {'elementclass': call} +calls

Index: src/phones/com_lgax8600.py
===================================================================
--- src/phones/com_lgax8600.py.orig   2007-08-11 06:25:51.000000000 -0400
+++ src/phones/com_lgax8600.py        2007-12-30 16:22:17.000000000 -0500
@@ -150,6 +150,47 @@
 
 #------------------------------------------------------
 # must be included for difference between alltel and verizon
+    def getcallhistory(self, result):
+        res={}
+        # read the incoming call history file
+        # the telus lg8100 programmers were on something when they wrote their code.
+        if hasattr(self.protocolclass, 'this_takes_the_prize_for_the_most_brain_dead_call_history_file_naming_ive_seen'):
+            self._readhistoryfile("pim/missed_log.dat", 'Incoming', res)
+            self._readhistoryfile("pim/outgoing_log.dat", 'Missed', res)
+            self._readhistoryfile("pim/incoming_log.dat", 'Outgoing', res)
+        else:
+            self._readhistoryfile("pim/missed_log.dat", 'Missed', res)
+            self._readhistoryfile("pim/outgoing_log.dat", 'Outgoing', res)
+            self._readhistoryfile("pim/incoming_log.dat", 'Incoming', res)
+           self._readhistoryfile("pim/data_log.data", 'Data', res)
+        result['call_history']=res
+        return result
+
+    def _readhistoryfile(self, fname, folder, res):
+        try:
+            buf=prototypes.buffer(self.getfilecontents(fname))
+            ch=self.protocolclass.callhistory()
+            ch.readfrombuffer(buf, logtitle="Call History")
+            for call_idx in range(ch.numcalls):
+                call=ch.calls[call_idx]
+                if call.number=='' and call.name=='':
+                        continue
+                entry=call_history.CallHistoryEntry()
+                entry.folder=folder
+                if call.duration:
+                    entry.duration=call.duration
+                entry.datetime=((call.GPStime))
+                if call.number=='': # restricted calls have no number
+                    entry.number=call.name
+                else:
+                    entry.number=call.number
+                    if call.name:
+                        entry.name=call.name
+                res[entry.id]=entry
+        except (com_brew.BrewNoSuchFileException,
+                IndexError):
+            pass # do nothing if file doesn't exist or is corrupted
+        return
 
     def getcalendar(self,result):
         res={}
@@ -545,9 +586,9 @@
         ('calendar', 'read', None),   # all calendar reading
         ('wallpaper', 'read', None),  # all wallpaper reading
         ('ringtone', 'read', None),   # all ringtone reading
-##        ('call_history', 'read', None),# all call history list reading
+        ('call_history', 'read', None),# all call history list reading
 ##        ('sms', 'read', None),         # all SMS list reading
-##        ('memo', 'read', None),        # all memo list reading
+        ('memo', 'read', None),        # all memo list reading
         ('phonebook', 'write', 'OVERWRITE'),  # only overwriting phonebook
         ('calendar', 'write', 'OVERWRITE'),   # only overwriting calendar
         ('wallpaper', 'write', 'MERGE'),      # merge and overwrite wallpaper
@@ -555,7 +596,7 @@
         ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
         ('ringtone', 'write', 'OVERWRITE'),
 ##        ('sms', 'write', 'OVERWRITE'),        # all SMS list writing
-##        ('memo', 'write', 'OVERWRITE'),       # all memo list writing
+        ('memo', 'write', 'OVERWRITE'),       # all memo list writing
 ##        ('t9_udb', 'read', 'OVERWRITE'),
 ##        ('t9_udb', 'write', 'OVERWRITE'),
         )

Index: help/phone-lgax8600.htd
===================================================================
--- help/phone-lgax8600.htd.orig      2007-08-11 06:25:53.000000000 -0400
+++ help/phone-lgax8600.htd   2008-01-02 09:47:27.000000000 -0500
@@ -1,7 +1,7 @@
 #include "pagestart.h"
 
 <h2>What works</h2>
-<P>Phonebook, Calendar, Wallpaper, Ringtones, and file system.
+<P>Phonebook, Calendar, Wallpaper, Ringtones, Memos, Call History and file system.
 
 <H2>Notes</H2>
 <UL>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.