Pymbian - Symbian C++ programming paradigm simulator for Python enviroment

Pymbian simulates Symbian platform essential services. It makes possible to build prototypes in regular Python, using Symbian C++ programming paradigms.

NOTE: It does not run in Symbian devices, nor do anything useful. It does not integrate with real Symbian OS.

Author:simo.salminen@iki.fi

Contents

Background

Symbian OS is well-known mobile platform. The OS is based on micro-kernel design, and provides its services via client/server framework. It also has somewhat curious way of doing asynchronous programming.

Symbian C++ is known for its steep learning curve. The client/server framework and asyncronous programming framework are unique to Symbian. They are quite puzzling to new programmers.

Pymbian is designed to be a pedagogical device, helping to understand underlying principles of Symbian OS. It enables programmer to use regular Python to implement prototypes using Symbian C++ programming paradigms.

Specially, it models following features of Symbian OS:
  • Threads, Timers, Semaphores
  • Low-level asynchronous services (thread request semaphores, request status signaling & waiting, etc)
  • High-level asynchronous service (active schedulers and active objects)
  • client/server framework

Goals

1) This research should help to understand design choices on Symbian: why certains things are done as they are, and how the symbian platform works.

2) Provides a way to lower the learning curve of Symbian. Applications build on Pymbian teaches all the Symbian essentials, without the pain of Symbian C++ ugly sides (CleanupStack, etc).

3) Give understanding about the nature of asynchronous programming, and it's problems (unnatural flow of code because of the callbacks)

Example

This source file shows how Active Scheduler, Active Object and platform timer service is used:

import sys
import thread
import time

from pymbian.base import CActiveScheduler, CActive
from pymbian.std import KErrNone, User, RThread, KRequestPending, RTimer
from pymbian.std import KErrCancel

def do_example():
    print "starting example"

    scheduler = CActiveScheduler()
    CActiveScheduler.Install(scheduler)

    ao = TestAO()
    ao.IssueRequest()

    scheduler.Start()

    print "closing down example"

class TestAO(CActive):
    def __init__(self):
        CActive.__init__(self)
        CActiveScheduler.Add(self)        
        self.service = RTimer()

    def IssueRequest(self):
        print "issuing request for 1 sec delay"
        self.service.After(self.iStatus, 1)
        self.SetActive()

    def Run(self):
        print "TestAO.Run called"
        print "closing down activescheduler"
        CActiveScheduler.Stop()

    def DoCancel(self):
        self.service.Cancel()


def main():
    do_example()

if __name__ == "__main__":
    main()

Download

Download it from here: Click http://sourceforge.net/project/showfiles.php?group_id=143316

To install, simply unpack and run 'python setup.py install'. After installation, you can run the test suite by executing 'python runtests.py' in src/ dir. There are couple examples in src/examples.

View Source

ViewCVS interface here: http://pymbian.cvs.sourceforge.net/pymbian/pymbian/src/pymbian/ Please note that it takes a while before web interface is syncronized with CVS.


Sponsored by SourceForge. SourceForge Logo

Project page: http://sourceforge.net/projects/pymbian