493: Undecipherable

-Blog-

-Projects-

-About me-

-RSS-

Bringing your contacts to a Nokia 7110

Dennis Guse

I just needed a new phone and decided to go for cool solution: Nokia 7110 (v4.84). I got one including serial data cable + dock and the only thing missing was: how do I get my contacts on the phone without typing?

The answer was quite simply: export your address book as vCard and send it to the phone via gnokii on an Ubuntu.

1
2
3
4
5
6
[global]
port = /dev/ttyS0
model = 7110
connection = serial
use_locking = yes
serial_baudrate = 9600

The Nokia 7110 has a bug: the vCard-parser is broken… So, I needed to fix my addressbook: basically remove all not needed data (emails, addresses, birthdays etc.). I implemented a small python-script using vObject.

It reads from stdin and writes to stdout:

cat addressbook.vcf python script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/python
#encoding=UTF-8

import vobject
import sys
import inspect

#Remove entries except in list for one vcard.
def vcard3_remove_all_entries_except(vcard):
   allowedEntries = {'version', 'fn', 'tel', 'categories'}
   entries_dict = vcard.contents
   for key in entries_dict.keys():
       if key not in allowedEntries:
           del entries_dict[key]

importedVCards = vobject.readComponents("".join(sys.stdin.readlines()))
try:
    while (True):
        vcard = importedVCards.next()
        vcard3_remove_all_entries_except(vcard)
        vcard.add('n');
        try:
            print(vcard.serialize())
        except Exception as e:
            print(e)
except StopIteration:
    None

Sync with style:

cat contacts.vcf python import.py gnokii –writephonebook -o –vcard

And a tutorial to clean the Nokia 7110 can be found here.