Zhone

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Removes spaces in numbers and now searches for N; not for (wrong) N:)
(Using VCF within Zhone: support both N: and N; and explain in a comment)
Line 35: Line 35:
 
                     name = None
 
                     name = None
 
                     number = None
 
                     number = None
 +
                # Search for both N: and N; since it depends on the VCF file. For example ones created with tsv2vcf.pl have "N:", not the usual "N;"
 +
                if line.startswith("N:"):
 +
                    name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
 
                 if line.startswith("N;"):
 
                 if line.startswith("N;"):
 
                     name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
 
                     name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
Line 64: Line 67:
 
             """
 
             """
 
</nowiki></pre>
 
</nowiki></pre>
 +
 
==Installing Zhone on Ubuntu ==
 
==Installing Zhone on Ubuntu ==
  

Revision as of 12:43, 15 April 2009

Key pages on:
FSO

(Other distributions)


Contents

Zen Phone

Screenshots: FSO UI Tutorial

Zhone is often told to be a demo application for the free softphone framework (FSO). But it actually is a quite usable phone program that allows to send and receive calls, SMS messages and tells you your gps coordinates. The FSO automagically detects when the gps coordinates are no more shown and shuts down the GPS hardware as long as it is not needed.

Since it mainly only sends commands over dbus to the daemons that actually do the work it is rather stable and even able to do multitasking like allowing you to read an SMS whilst using the phone.

Using VCF within Zhone

Arne sent a small patch that imports phone numbers from a VCF 3.0 address book. Since Zhone has problems with numbers -, the patch below is a sligthly different and removes -.

In /usr/bin/zhone search for class pyphone_contacts(edje_group) and modify the prepare function:

    def prepare( self ):
        if not self.ready and not self.busy:
            file = open(os.environ.get('HOME')+"/addressbook.vcf", "r")
            entries = []
            entry_nr = 1
            name = None
            number = None
            for line in file:
                #if line.startswith("END:VCARD"):
                if line.startswith("TEL;"):
                    number = unicode(line.partition(":")[2].strip())
                    number = number.replace('-','')
                    number = number.replace(' ','')
                    if name and number:
                        entry = entry_nr, name, number
                        entries.append(entry)
                        entry_nr = entry_nr + 1
                if line.startswith("END:VCARD"):
                    name = None
                    number = None
                # Search for both N: and N; since it depends on the VCF file. For example ones created with tsv2vcf.pl have "N:", not the usual "N;"
                if line.startswith("N:"):
                    name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
                if line.startswith("N;"):
                    name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
                #if line.startswith("TEL;"):
                #    number = unicode(line.partition(":")[2].strip())
            file.close()
            self.cbPhonebookReply(entries)
 
            """
            if dbus_object.gsm_device_obj:
                logger.info( "retrieving phonebook..." )
                dbus_object.gsm_sim_iface.RetrievePhonebook(
                    "contacts",
                    reply_handler=self.cbPhonebookReply,
                    error_handler=self.cbPhonebookError
                )
                self.busy = True
            else:
                # Fake phonebook...
                self.cbPhonebookReply( [
                    (1, u'Kirk', '+023224433'),
                    (2, u'Spock', '+034433463'),
                    (3, u'McCoy', '+013244344'),
                    (4, u'Scott', '+013244344'),
                    (5, u'Uhura', '+013244344'),
                    (6, u'Sulu', '+013244344'),
                    (7, u'Chekov', '+456663443'),
                ] )
             """

Installing Zhone on Ubuntu

WARNING: Adding those repositories (or the zhone installation?) may lead to problems on a Kubuntu 8.04 Hardy Heron.

Many packages update are done at the same time (200+ changes), and something break the upgrade. Removing repositories and launching an "apt-get -f install" fix the problem.


  • Add this to your /etc/apt/sources.lst :
deb http://pkg-fso.alioth.debian.org/debian/ unstable main
deb-src http://pkg-fso.alioth.debian.org/debian/ unstable main
deb http://ftp.debian.org/debian/ experimental main
deb http://e17.dunnewind.net/ubuntu hardy e17
  • Execute:
sudo apt-get update
sudo apt-get install zhone
  • remove this from your /etc/apt/sources.lst
deb http://ftp.debian.org/debian/ experimental main
  • Now you can finally execute:
zhone

Developing Zhone

Personal tools
Key pages on:
FSO

(Other distributions)


Zen Phone

Screenshots: FSO UI Tutorial

Zhone is often told to be a demo application for the free softphone framework (FSO). But it actually is a quite usable phone program that allows to send and receive calls, SMS messages and tells you your gps coordinates. The FSO automagically detects when the gps coordinates are no more shown and shuts down the GPS hardware as long as it is not needed.

Since it mainly only sends commands over dbus to the daemons that actually do the work it is rather stable and even able to do multitasking like allowing you to read an SMS whilst using the phone.

Using VCF within Zhone

Arne sent a small patch that imports phone numbers from a VCF 3.0 address book. Since Zhone has problems with numbers -, the patch below is a sligthly different and removes -.

In /usr/bin/zhone search for class pyphone_contacts(edje_group) and modify the prepare function:

    def prepare( self ):
        if not self.ready and not self.busy:
            file = open(os.environ.get('HOME')+"/addressbook.vcf", "r")
            entries = []
            entry_nr = 1
            name = None
            number = None
            for line in file:
                #if line.startswith("END:VCARD"):
                if line.startswith("TEL;"):
                    number = unicode(line.partition(":")[2].strip())
                    number = number.replace('-','')
                    number = number.replace(' ','')
                    if name and number:
                        entry = entry_nr, name, number
                        entries.append(entry)
                        entry_nr = entry_nr + 1
                if line.startswith("END:VCARD"):
                    name = None
                    number = None
                if line.startswith("N;"):
                    name = unicode(line.partition(":")[2].replace(';',' ').strip(), "utf8", "utf8")
                #if line.startswith("TEL;"):
                #    number = unicode(line.partition(":")[2].strip())
            file.close()
            self.cbPhonebookReply(entries)
 
            """
            if dbus_object.gsm_device_obj:
                logger.info( "retrieving phonebook..." )
                dbus_object.gsm_sim_iface.RetrievePhonebook(
                    "contacts",
                    reply_handler=self.cbPhonebookReply,
                    error_handler=self.cbPhonebookError
                )
                self.busy = True
            else:
                # Fake phonebook...
                self.cbPhonebookReply( [
                    (1, u'Kirk', '+023224433'),
                    (2, u'Spock', '+034433463'),
                    (3, u'McCoy', '+013244344'),
                    (4, u'Scott', '+013244344'),
                    (5, u'Uhura', '+013244344'),
                    (6, u'Sulu', '+013244344'),
                    (7, u'Chekov', '+456663443'),
                ] )
             """

Installing Zhone on Ubuntu

WARNING: Adding those repositories (or the zhone installation?) may lead to problems on a Kubuntu 8.04 Hardy Heron.

Many packages update are done at the same time (200+ changes), and something break the upgrade. Removing repositories and launching an "apt-get -f install" fix the problem.


  • Add this to your /etc/apt/sources.lst :
deb http://pkg-fso.alioth.debian.org/debian/ unstable main
deb-src http://pkg-fso.alioth.debian.org/debian/ unstable main
deb http://ftp.debian.org/debian/ experimental main
deb http://e17.dunnewind.net/ubuntu hardy e17
  • Execute:
sudo apt-get update
sudo apt-get install zhone
  • remove this from your /etc/apt/sources.lst
deb http://ftp.debian.org/debian/ experimental main
  • Now you can finally execute:
zhone

Developing Zhone