Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Using the Easy API

From Wiki
Jump to: navigation, search
Article Metadata
Created: hozano (16 May 2008)
Last edited: hamishwillee (07 Feb 2012)


Using the Easy API

Easy is a Python-based API designed to ease the development of maemo applications. The goal of Easy is to wrap up the complexity of accessing multimedia, network and desktop services by providing a high level Python modular API. This will be done through python's bindings and an abstraction layer on top of the low level components, such as GStreamer, D-Bus, and other libraries. Easy also offer a framework for rapid GUI development using python and pygtk.

Installing Easy

The installation of Easy can be made using the single-click install support, following these steps:

  1. Access this page from maemo browser and click here.
  2. Follows the instructions in the device screen.

Easy architecture

Nowadays, Easy presents an architecture with seven modules: camera, audio, radio, e-mail, contacts, bluetooth,and UI. Such modules use Python bindings to access GStreamer, D-Bus, BlueZ, Evolution, and so on. The Easy architecture is illustrated with a brief description of each module as follows.

Easy architecture

Some modules of Easy are detailed below.


The Audio module encapsulates a set of functions to record, and to reproduce audio files. It also providing functions to get file duration, get current time position, change volume, and seeking control.

The code below uses the audio module to record an audio file and reproduce it:

>>> from easy import audio
>>> audio.record("./hello_world.wav", 3)
>>> ("./hello_world.wav")

The first line imports the audio module from easy API. The second one records the audio captured from maemo microphone during 3s and stores it in a file named "hello_world.wav". Finally, line 3 plays the audio recorded previously.


This module provides functions to control the camera of the maemo device, including recording, playing videos and taking snapshots.

A brief example of the usage of camera module is detailed below. This example starts the camera and records a video during 30s. Then, it stores the video in a "movie.avi" file:

>>> from easy import camera
>>> camera.start()
>>> camera.record("./movie.avi", 30)

The following code is another example in which the camera module is used to take a snapshot:

>>> from easy import camera


This modules allows management of contacts stored in maemo. The example below describes how to create a contact and how to set its attributes.

>>> from easy import contact
>>> new_contact = contact.create_contact()
>>> = "Guido"
>>> new_contact.family_name = "Rossum"
>>> = ""
>>> new_contact.nickname = "guido"
>>> new_contact.gtalk = ""


Email module uses the smptlib to send e-mails. This module requires a SMTP server authentication. The example below describes how to send an email with attachments.

>>> from easy import e_mail
>>> my_email = e_mail.create_email()
>>> = ""
>>> my_email.subject = "Easy released!"
>>> my_email.message = "Easy is up!"
>>> my_email.add_attachment("./easy.tar.gz")
>>> e_mail.connect("login", "password", "smtp_server")
>>> e_mail.send_mail(my_email)


This module conceives functions to easily manipulate bluetooth using the LightBlue library. The example below sends a single file (hello.txt) to a bluetooth device found in the network.

>>> from easy import bluetooth
>>> bluetooth.finddevices()
[('00:11:9F:02:94:29', u'John', 14373378), ('00:12:62:F3:44:08', u'Smith', 9392130)]
>>> mac, channel, service = bluetooth.findservices('00:11:9F:02:94:29', 
u'OBEX Object Push')[0]
>>> bluetooth.obex.sendfile(mac, channel, './hello.txt')


The Radio module provides a set of functions to reproduce broadcasted FM radios. These functions allow to tune a specific station and to search for available stations. The code example below starts the Radio module and tunes it to 93.1MHz frequency.

>>> from easy import radio
>>> radio.start()
>>> radio.tune(93100)


The UI module encapsulates the Eagle project, creating an abstraction layer on top of GTK+. Thus, it is possible to create GTK-based graphical interfaces using high level widgets provided by Eagle. The code example below presents a small application with a graphical interface using the UI module, with two widgets: Entry and Button.

from easy.eagle import *

def user_input( app, wid, text ):
   print app, wid, text

def set_text( app, wid ):
   app[ "entry" ] = "some text"

   title="Type something or press the button",
      Entry( id="entry", label="Input:", callback=user_input ),
      Button( id="button", label="Change Text", callback=set_text ),


Graphical interface created with UI module

The figure above illustrates the graphical interface with the Entry and Button widgets provided by Eagle.


Some useful links to develop Easy applications are showed below:

This page was last modified on 7 February 2012, at 06:23.
37 page views in the last 30 days.