Python For Maemo 5 Info

The python used in the Nokia N900 is known as PyMaemo. It is basically the normal python, with additional device related commands.

API Documentation (non-pythonic): Maemo 5 Api Docs

Python Tutorials: Python for newbies

It is also possible to access C APIs that don't have Python bindings. However, this can bring some interesting problems. Not recommended, as most of the maemo APIs should work just fine with Python. However, check Accessing APIs without Python bindings for more info.

Using Accelerometer

Download this source from here: Accelerometer.py

""" Created August 9, 2011 @author: Janne Parkkila @contact: japskua@gmail.com @summary: This file contains class implementation on connecting to maemo dbus and receiving accelerometer data """ import dbus class Accelerometer(object): """ @summary: This class is used to get accelerometer data from the dbus """ bus = None accelerometer = None def __init__(self): """ @summary: The Constructor for the class """ self.bus = dbus.SystemBus() self.accelerometer = self.bus.get_object("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request") def getData(self): """ @summary: This function returns the data of the accelerometer @return: orientation, stand, face, x, y, z @rtype: list """ return self.accelerometer.get_device_orientation() def displayData(self): """ @summary: This function is just used to display data """ orientation, stand, face, x, y, z = self.getData() print "Orientation: ", orientation print "Stand: ", stand print "Face: ", face print "X: ", x print "Y: ", y print "Z: ", z # This is only if we want to run the accelerometer test straight from the command line if __name__ == "__main__": print "Starting the Accelerometer test" accel = Accelerometer() accel.displayData()

Using Location API

The python location might not be installed on the device. In this case, you need to install it with apt-get install python-location

More info on location API with pyMaemo can be found from PyMaemo Location API at maemo wiki