Zhone

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (Category: -Applications)
 
(13 intermediate revisions by 9 users not shown)
Line 3: Line 3:
 
==Zen Phone==
 
==Zen Phone==
  
Screenshots: [[FSO UI Tutorial]]
+
Screenshots: [[:Category:Zhone screenshots]]
  
{{Todo|What is zhone, can anyone explain, and write something here?}}
+
Zhone is often told to be a demo application for the Freesmartphone.org 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.
  
The Framework Testing Image.
+
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.
  
 +
== Support for letters ä and ö ==
 +
 +
Apply the following patch to be able to use ä and ö letters in Zhone SMS:s:
 +
 +
<pre>
 +
--- zhone.orig.withvcf 2009-09-28 13:42:27.000000000 +0300
 +
+++ zhone 2009-09-28 13:47:47.000000000 +0300
 +
@@ -1888,6 +1888,15 @@
 +
        key = event.string
 +
        if key == "\x08":
 +
            self.text = self.text[:-1]
 +
+     # Check if the key is aumlaut or oumlaut
 +
+        elif event.key == "adiaeresis":
 +
+            self.text += u"ä"
 +
+        elif event.key == "odiaeresis":
 +
+            self.text += u"ö"
 +
+        elif event.key == "Adiaeresis":
 +
+            self.text += u"Ä"
 +
+        elif event.key == "Odiaeresis":
 +
+            self.text += u"Ö"
 +
        elif key is not None:
 +
            self.text += key
 +
        self.part_text_set( "label", self.text )
 +
</pre>
 +
 +
==Using VCF within Zhone==
 +
Arne sent a small [http://lists.openmoko.org/pipermail/support/2009-January/004394.html 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:
 +
<pre><nowiki>
 +
    def prepare( self ):
 +
        if not self.ready and not self.busy:
 +
            logger.info( "retrieving phonebook from addressbook.vcf..." )
 +
            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'),
 +
                ] )
 +
            """
 +
</nowiki></pre>
 +
Beware this patch loads and parses addressbook.vcf on each start of zhone - I was pretty impressed I did not even notice a significant delay on my 241 entries vcf, though.
 +
 +
If you have multiple phone numbers per contact and these are separated with commas (like an export from abook, e.g. "112233,998877,665544") you don't see the name when being called - and you cannot call these "multiple" numbers. You can extend the above:
 +
<pre><nowiki>
 +
            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:
 +
-                    if name and number:
 +
-                        entry = entry_nr, name, number
 +
-                        entries.append(entry)
 +
-                        entry_nr = entry_nr + 1
 +
+                        nums = number.split(",")
 +
+                        for num in nums:
 +
+                            entry = entry_nr, name, num
 +
+                            entries.append(entry)
 +
+                            entry_nr = entry_nr + 1
 +
</nowiki></pre>
 +
This makes up one entry for each number - all with the same name.
 +
 +
After exporting from abook ("gcrd GnomeCard (VCard) addressbook" format) you should convert it to utf-8, possibly like this (all.vcf is the abook exported file):
 +
<pre><nowiki>
 +
iconv -f ISO-8859-1 -t utf-8 all.vcf > addressbook.vcf
 +
</nowiki></pre>
 +
Then transfer addressbook.vcf to your phone. Make sure the name stays the same, it's hardcoded in the code above. On my phone $HOME/addressbook.vcf resolves to /root/addressbook.vcf.
 
==Installing Zhone on Ubuntu ==
 
==Installing Zhone on Ubuntu ==
  
Line 28: Line 140:
 
* Now you can finally execute:
 
* Now you can finally execute:
 
  zhone
 
  zhone
 
== Developing Zhone ==
 
* Install Zhone see [[Zhone#Installing Zhone on Ubuntu]]
 
* apt-get source zhone
 
  
 
[[Category:FSO]]
 
[[Category:FSO]]

Latest revision as of 15:16, 6 February 2010

Key pages on:
FSO

(Other distributions)


Contents

[edit] Zen Phone

Screenshots: Category:Zhone screenshots

Zhone is often told to be a demo application for the Freesmartphone.org 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.

[edit] Support for letters ä and ö

Apply the following patch to be able to use ä and ö letters in Zhone SMS:s:

--- zhone.orig.withvcf	2009-09-28 13:42:27.000000000 +0300
+++ zhone	2009-09-28 13:47:47.000000000 +0300
@@ -1888,6 +1888,15 @@
         key = event.string
         if key == "\x08":
             self.text = self.text[:-1]
+	    # Check if the key is aumlaut or oumlaut
+        elif event.key == "adiaeresis":
+            self.text += u"ä"
+        elif event.key == "odiaeresis":
+            self.text += u"ö"
+        elif event.key == "Adiaeresis":
+            self.text += u"Ä"
+        elif event.key == "Odiaeresis":
+            self.text += u"Ö"
         elif key is not None:
             self.text += key
         self.part_text_set( "label", self.text )

[edit] 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:
            logger.info( "retrieving phonebook from addressbook.vcf..." )
            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'),
                ] )
             """

Beware this patch loads and parses addressbook.vcf on each start of zhone - I was pretty impressed I did not even notice a significant delay on my 241 entries vcf, though.

If you have multiple phone numbers per contact and these are separated with commas (like an export from abook, e.g. "112233,998877,665544") you don't see the name when being called - and you cannot call these "multiple" numbers. You can extend the above:

            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:
-                    if name and number:
-                        entry = entry_nr, name, number
-                        entries.append(entry)
-                        entry_nr = entry_nr + 1
+                        nums = number.split(",")
+                        for num in nums:
+                            entry = entry_nr, name, num
+                            entries.append(entry)
+                            entry_nr = entry_nr + 1

This makes up one entry for each number - all with the same name.

After exporting from abook ("gcrd GnomeCard (VCard) addressbook" format) you should convert it to utf-8, possibly like this (all.vcf is the abook exported file):

iconv -f ISO-8859-1 -t utf-8 all.vcf > addressbook.vcf

Then transfer addressbook.vcf to your phone. Make sure the name stays the same, it's hardcoded in the code above. On my phone $HOME/addressbook.vcf resolves to /root/addressbook.vcf.

[edit] 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
Personal tools
Key pages on:
FSO

(Other distributions)


Zen Phone

Screenshots: FSO UI Tutorial

TODO: What is zhone, can anyone explain, and write something here? (See: To-Do List)

The Framework Testing Image.

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