« Return to Thread: Want to help with LG Cosmos

Re: [bitpim-devel] want to help with lg cosmos

by Seth Randall-2 :: Rate this Message:

| View in Thread

Nathan,
I've attached some preliminary support for the Accolade (VX5600) that I
was able to use for my address book. I haven't gotten SMS working yet
though.

I haven't had time to work on it, but I figure I might as well make it
available for someone else to look at.

On 05/24/2010 10:29 AM, hjelmn wrote:

> To get started follow this link: http://www.bitpim.org/developerhtml
>
> Once the development environment is set up I recommend taking a look at
> com_lgvx11000.py and p_lgvx11000.p . You will probably want to subclass
> com_lgvx11000. If you need any help let me know
>
> Also, I am working on Accolade support which, in all likelihood, is
> similar to the Cosmos (same generation phone). I will let you know when
> that is complete.
>
> -Nathan

[com_lgvx5600.py]

#!/usr/bin/env python

### BITPIM
###
### Copyright (C) 2007-2008 Nathan Hjelm <hjelmn@...>
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of the BitPim license as detailed in the LICENSE file.
### $Id$


"""
Communicate with the LG VX5600 cell phone.
"""

# BitPim modules
import common
import com_brew
import bpcalendar
import prototypes
import com_lgvx8575
import p_lgvx5600
import p_brew
import helpids
import copy
import time
import os.path
import phonebookentryeditor

DEBUG1=False
#-------------------------------------------------------------------------------
parentphone=com_lgvx8575.Phone
class Phone(parentphone):
    desc="LG-VX5600"
    helpid=None
    protocolclass=p_lgvx5600
    serialsname='lgvx5600'

    my_model='VX5600'

    calendarringerlocation='sch/toolsRinger.dat'

    ringtonelocations= (
        # type           index file             default dir                 external dir  max  type   index
        ( 'ringers',    'dload/myringtone.dat','brew/mod/10889/ringtones', '',            100, 0x01,  100),
        ( 'sounds',     'dload/mysound.dat',   'brew/mod/18067',           '',            100, 0x02,  None),
        ( 'music',      'dload/efs_music.dat', 'my_music',                 '',            100, 0x104, None),
        )

    #add picture ids to list of wallpapers, seems to be new for this phone
    wallpaperlocations= (
        #  type          index file                           default dir         external dir  max  type Index
        ( 'images',     'dload/image.dat',                    'brew/mod/10888',    '',          100, 0x00, 100),
        ( 'video',      'dload/video.dat',                    'brew/mod/10890',    '',          100, 0x03, None),
        ( 'picture ids','set_as_pic_id_dir/setas_pic_id.dat', 'set_as_pic_id_dir', '',          999, 0x00, None),
        )

#-------------------------------------------------------------------------------
parentprofile=com_lgvx8575.Profile
class Profile(parentprofile):
    protocolclass=Phone.protocolclass
    serialsname=Phone.serialsname

    BP_Calendar_Version=3
    phone_manufacturer='LG Electronics Inc'
    phone_model=Phone.my_model

    # inside screen resoluation
    WALLPAPER_WIDTH=176
    WALLPAPER_HEIGHT=220

    imageorigins={}
    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "images"))
    imageorigins.update(common.getkv(parentprofile.stockimageorigins, "video"))

    # our targets are the same for all origins
    imagetargets={}
    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "fullscreen",
                                      {'width': 238, 'height': 246, 'format': "JPEG"}))
    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "wallpaper",
                                      {'width': 240, 'height': 274, 'format': "JPEG"}))
    imagetargets.update(common.getkv(parentprofile.stockimagetargets, "pictureid",
                                      {'width': 120, 'height': 100, 'format': "JPEG"}))

    _supportedsyncs=(
        ('phonebook', 'read', None),  # all phonebook reading
        ('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
        ('sms', 'read', None),         # all SMS 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
        ('wallpaper', 'write', 'OVERWRITE'),
        ('ringtone', 'write', 'MERGE'),      # merge and overwrite ringtone
        ('ringtone', 'write', 'OVERWRITE'),
        ('sms', 'write', 'OVERWRITE'),        # all SMS list writing
        ('memo', 'write', 'OVERWRITE'),       # all memo list writing
        ('t9_udb', 'write', 'OVERWRITE'),
        )
    if __debug__:
        _supportedsyncs+=(
        ('t9_udb', 'read', 'OVERWRITE'),
        )

    field_color_data={
    'phonebook': {
        'name': {
            'first': False, 'middle': False, 'last': False, 'full': 1,
            'nickname': False, 'details': 1 },
        'number': {
            'type': 5, 'speeddial': 5, 'number': 5,
            'ringtone': False, 'wallpaper': False, 'details': 5 },
        'email': 2,
        'email_details': {
            'emailspeeddial': False, 'emailringtone': False,
            'emailwallpaper': False },
        'address': {
            'type': False, 'company': False, 'street': 1, 'street2': False,
            'city': 1, 'state': 1, 'postalcode': 1, 'country': 1, 'details': 1 },
        'url': 0,
        'memo': 0,
        'category': 1,
        'wallpaper': 1,
        'group_wallpaper': 1,
        #'wallpaper_type': False,
        'ringtone': 1,
        'storage': False,
        'secret': False,
        'ICE': 1,
        'Favorite': 1,
        },
    'calendar': {
        'description': True, 'location': False, 'allday': False,
        'start': True, 'end': True, 'priority': False,
        'alarm': True, 'vibrate': True,
        'repeat': True,
        'memo': False,
        'category': False,
        'wallpaper': False,
        'ringtone': True,
        },
    'memo': {
        'subject': False,
        'date': True,
        'secret': False,
        'category': False,
        'memo': True,
        },
    'todo': {
        'summary': False,
        'status': False,
        'due_date': False,
        'percent_complete': False,
        'completion_date': False,
        'private': False,
        'priority': False,
        'category': False,
        'memo': False,
        },
    }        
 


[p_lgvx5600.p]

### ( -*- Python -*- )
### Copyright (C) 2007-2008 Nathan Hjelm <hjelmn@...>
###
### This program is free software; you can redistribute it and/or modify
### it under the terms of the BitPim license as detailed in the LICENSE file.
###
### $Id$

%{

"""Various descriptions of data specific to LG VX5600"""

from p_lgvx8575 import *
%}

# /pim/pbentry.dat format
PACKET pbfileentry:
    5   STRING { 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '\xff\xff\xff\xff\xff' } +entry_tag
    if self.entry_tag==PB_ENTRY_SOR:
       1   UINT { 'default': 0xff } +unk0
       * PBDateTime { 'defaulttocurrenttime': True } +mod_date
       6   STRING { 'terminator': None, 'default': '\xff\xff\xff\xff\xff\xff' } +unk1
       4   UINT entry_number1 # 1 based entry number -- might be just 2 bytes long
       2   UINT entry_number0 # 0 based entry number
       34  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False} +name
       *  LIST {'length': NUMGROUPS } +groups:
           2 UINT { 'default': 0 } +gid
       *  LIST {'length': NUMEMAILS} +emails:
          49 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'default': ''} email
       2   UINT { 'default': 0xffff } +ringtone
       2   UINT { 'default': 0 } +wallpaper
       * LIST {'length': NUMPHONENUMBERS} +numbertypes:
          1 UINT { 'default': 0 } numbertype
       4  UINT { 'default': 0 } +unk2
       31 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'default': ''} +memo
       * LIST {'length': NUMPHONENUMBERS} +numberindices:
          2 UINT { 'default': 0xffff } numberindex
       2 UINT { 'default': 0xffff } +addressindex
       2 UINT { 'default': 0xffff } +unk3
       2 UINT { 'default': 0xffff } +imindex
       224 DATA { 'default': '\x00'*224 } +reserved
       6   USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '</PE>'} +exit_tag
    else:
        # this is a blank entry, fill it up with 0xFF
        507 DATA { 'default': '\xff'*507 } +dontcare
    %{
    def valid(self):
        global PB_ENTRY_SOR
        return self.entry_tag==PB_ENTRY_SOR and \
               (self.name and ord(self.name[0]) != 0xff)
    %}

PACKET pbfile:
    * LIST { 'elementclass': pbfileentry,
             'length': NUMPHONEBOOKENTRIES,
             'createdefault': True} +items
    6 STRING { 'default': '<HPE>',
               'raiseonunterminatedread': False,
               'raiseontruncate': False } +eof_tag
    10 STRING { 'raiseonunterminatedread': False,
                'raiseontruncate': False } +model_name
    * PBDateTime { 'defaulttocurrenttime': True } +mod_date
    477 DATA   { 'default': '\x00'*477 } + blanks
    7 STRING { 'default': '</HPE>',
               'raiseonunterminatedread': False,
               'raiseontruncate': False  } +eof_close_tag

PACKET pafileentry:
    5   STRING { 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '\xff\xff\xff\xff\xff' } +entry_tag
    if self.entry_tag==PA_ENTRY_SOR:
       1   UINT { 'default': 0x00 } +pad0
       *   PBDateTime { 'defaulttocurrenttime': True } +mod_date
       6   UNKNOWN +zeros
       2   UINT    +index
       2   UINT    +pb_entry
       34  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '' } +street
       34  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '' } +city
       34  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '' } +state
       12  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '' } +zip_code
       34  USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '' } +country
       74  DATA { 'default': '\x00'*74 } +pad1
       6   USTRING { 'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False, 'raiseontruncate': False, 'default': '</PA>'} +exit_tag
    else:
        # this is a blank entry, fill it up with 0xFF
        251 DATA { 'default': '\xff'*251 } +dontcare
    %{
    def valid(self):
        global PA_ENTRY_SOR
        return self.entry_tag==PA_ENTRY_SOR
    %}

PACKET pafile:
    * LIST { 'elementclass': pafileentry,
             'length': NUMPHONEBOOKENTRIES,
             'createdefault': True } +items

# similar to the VX-8575 with a shorter name and shorter number_location
PACKET call:
    4 GPSDATE GPStime    # no. of seconds since 0h 1-6-80, based off local time.
    4 UINT  unk0         # different for each call
    4 UINT  duration     # seconds, not certain about length of this field
    49 USTRING {'raiseonunterminatedread': False} number
    33 USTRING {'encoding': PHONE_ENCODING, 'raiseonunterminatedread': False} name
    1 UINT  numberlength # length of phone number
    1 UINT  status       # 0=outgoing, 1=incoming, 2=missed, etc
    1 UINT  pbnumbertype # 1=cell, 2=home, 3=office, 4=cell2, 5=fax, 6=vmail, 0xFF=not in phone book
    4 UINT  unk1         # always seems to be 0
    2 UINT  pbentrynum   # entry number in phonebook
    75 DATA number_location # set by pay software

# similar to the VX-8575 but with an single unknown before the calls instead of 4
PACKET callhistory:
    4 UINT { 'default': 0x00050000 } unk0
    4 UINT numcalls
    1 UINT { 'default': 0 } unk1
    * LIST { 'elementclass': call, 'length': self.numcalls} +calls


------------------------------------------------------------------------------


_______________________________________________
BitPim-devel mailing list
BitPim-devel@...
https://lists.sourceforge.net/lists/listinfo/bitpim-devel

 « Return to Thread: Want to help with LG Cosmos