4. Symbian OS undS60 Symbian OS Betriebssystem für Smartphones und PDAs Microkernel, 32bit, Single User GUI-zentriertes Applikations-Framework S60 Benutzeroberfläche für Smartphones Aktuell: S60 3rd Edition Entwicklungsumgebungen C++, Java, Web Widgets (Flash Lite), (Python) Quelle: S60 Platform: Introductory Guide. Nokia Corporation, 2007. http://www.s60.com/business/developers/documents A schematic diagram of the S60 platform architecture.
6. S60 Platform ServicesFundamental services Application Framework Services — providing the basic capabilities for launching applications and servers, state-persistence management, and UI components. UI Framework Services — providing the concrete look and feel for UI components and handling UI events. Graphics Services — providing capabilities for the creation of graphics and their drawing to the screen. Location Services — allowing the S60 platform to be aware of a device’s location. Web-Based Services — providing services to establish connections and interact with Web-based functionality, including browsing, file download, and messaging. Multimedia Services — providing the capabilities to play audio and video, as well as support for streaming and speech recognition. Communication Services — providing support for local and wide area communications, ranging from Bluetooth technology to voice calls.
7. S60 Application ServicesCertain basic functionality for S60 applications PIM Application Services — providing the fundamental features of PIM applications, including contacts, calendar, and task management, as well as associated functions such as notepad and clock capabilities. Messaging Application Services — providing support for various messaging types, such as short message service (SMS), multimedia messaging service (MMS), e-mail, BIO messages (smart messaging), and instant messaging (IM). Browser Application Services — providing the capabilities to view Web content, including support for Flash Lite, video rendering, Scalable Vector Graphics–Tiny (SVG-T) rendering, and audio rendering.
8. Python for S60(PyS60) Portierung von Python auf S60-Plattform Entwicklung von NOKIA Open-Source-Lizenz (Apache Version 2 und Python) Verfügbar bei Sourceforge http://sourceforge.net/projects/pys60 Aktuelle Version: 1.4.4 (28.06.2008)
15. Python API Typenund Bibliotheken von PyS60 Alle Built-In-Typen von Python 2.2.2 sind vorhanden Python Standard Library Viele der Standard-Module laufen Keine Installation, um Speicherplatz im Handy zu sparen Python-Extensions für S60: Native C++-Erweiterungen Built-in Extensions: e32 : API für die Services der Symbian OS Platform appuifw : API für das UI Application Framework Dynamisch nachladbare Extensions: sysinfo, graphics, camera, keycapture, topwindow, gles, glcanvas, sensor, audio, telephone, messaging, inbox, location, positioning, calendar, contacts, e32db, logs Entwicklung eigener Extensions per Python/C API möglich
16. Python S60-Module (1)Betriebssystem-Zugriff und -Information e32 Zugriff auf Betriebssystem-Funktion von Symbian, die nicht durch GUI-Module oder die Python Standard Library abgedeckt sind, z.B. Scheduler, Process-Management, Drive-Liste, (Py-)S60-Versionen sysinfo Systeminformationen, z.B. aktiviertes Profil, Batteriestatus, Displaygröße, gesamter und freier Speicherplatz, OS Version, Signalstärke
17. Python S60-Module (2)Benutzerschnittstelle und Grafik (I) appuifw API für das S60 GUI Application Framework graphics Grafik- und Bildfunktionen, z.B. Laden, Speichern, Rotieren & Skalieren von Bildern, Erstellen von Grafiken mit Grafikprimitiven und Screenshots camera Aufnahme von Fotos und Video, Einstellen der Kamera-Parameter keycapture Abfangen von Tastatur-Events topwindow Einblenden von Fenstern über Applikationen, dargestellt wird ein graphics.Image
18. Python S60-Module (3)Benutzerschnittstelle und Grafik (II) gles Python API für OpenGL ES 2D/3D Grafik. Siehe OpenGL ES Standard bei Khronos ( http://www.khronos.org/opengles / ) glcanvas UI Steuerung für OpenGL ES Grafik sensor Zugriff auf physikalische Sensoren (Bewegung/Acceleration, Antippen/Tapping, Rotation)
19. Python S60-Module (4)Audio und Kommunikation audio Audio-Funktionen, z.B. Aufnahme, Abspielen von Audio-Dateien, Lautstärkeregelung, Sprachausgabe ( text-to-speech ) telephone Telefonie-Funktionen: Wählen, Auflegen und Rückruf messaging Senden von SMS und MMS inbox Zugriff auf Message-Folder (Inbox, Outbox, Sent und Draft) location Abfrage der GSM-Funkzellen-Informationen positioning Zugriff auf GPS-Empfänger
20. Python S60-Module (5)Datenmanagement contacts Zugriff auf Adressbuch ( ContactDb ), z.B. Suchen nach Kontakten, Anzeigen von Gruppen, Ändern von Kontaktinformationen, Import/Export von vCards calendar Zugriff auf die Kalender-Datenbank ( CalendarDb ), z.B. Hinzufügen und Ändern von Terminen, Ereignissen, Geburtstagen und Aufgaben, Behandlung wiederholender Einträge, Import/Export des vCalendar-Formats e32db Schnittstelle zur nativen Symbian Datenbank, z.B. Anlegen von Datenbanken und SQL-Abfragen logs Zugriff auf Telefon-Protokolle, z.B. Anrufe, SMS, Daten, Faxe, Mails
21. Struktur von Applikationen(1) Visuelles Layout Typisches visuelles Layout von S60-Applikationen Title Navigation Tabs Body Menu Exit Dialog
22. Struktur von Applikationen(2) Source-Code-Template Import von Modulen Screen Size setzen Applications Menu Exit key handler setzen (Callback function) Application title setzen Application body Active Objects Main Loop import appuifw import e32 appuifw.app.screen = 'normal' def item1(): print " item1 was selected.” appuifw.app.menu = [(u"item 1", item1)] def quit(): appuifw.app.set_exit() app.exit_key_handler=quit appuifw.app.title = u 'Simple Application' app_lock = e32.Ao_lock() # starts scheduler -> event processing app_lock.wait() Ausführliches Template unter: http://www.mobilenin.com/pys60/resources/app\_skeleton\_with\_mainloop.py
23. Graphical User Interface( appuifw ) Basiselemente Dialoge note : popup note query : Texteingabe mit einem Feld multi_query : Texteingabe mit zwei Feldern Menus popup_menu : Einfaches Menu Auswahllisten selection_list : Einfache Listenauswahl (vgl. „Radio buttons“) multi_selection_list : Mehrfachauswahl (vgl. „Check boxes“)
24. Graphical User Interface( appuifw ) Screen Size Drei Formate für Applikationen Rotation der Anzeige ist möglich (portrait, landscape) normal large full
25.
26. Beispiel „Versenden einerSMS“ (1) Source Code import appuifw import messaging data = appuifw.query(u "what are you doing?" , "text" ) receiver = "+49172940****" if appuifw.query(u "Send message?" , "query" ) == True : messaging.sms_send(receiver, data) appuifw.note(u "Message sent." , "info" ) else : appuifw.note( u"Messages not sent!" , "info" ) s60test.send_sms.py
27.
28.
29. Beispiel „SMS-Empfang undSound“ (1) Funktionen Empfang von Befehlen per SMS ( „record“ , „stop“ , „play“ , „clear“ ) Aufzeichnen und Abspielen von Audio
38. Beispiel „Mandelbrot-Menge“ (2)Iterationsschleife for y in range(height): for x in range(width): magnitude = 0 z = 0+0j c = complex(float(y-yaxis)/scale, float(x-xaxis)/scale) for i in range(iterations): z = z**2+c if abs(z) > 2: v = 765*i/iterations if v > 510: color = (255, 255, v%255) elif v > 255: color = (255, v%255, 0) else : color = (v%255, 0, 0) break else : color = (0, 0, 0) canvas.point((x, y), color) e32.ao_yield()
39. Beispiel „Kontakte-Datenbank“ import contacts db = contacts.open() print u "Searching contacts…" found = db.find( 'guy' ) # search in name, email, etc. for guy in found: firstname = guy.find( 'first_name' )[0].value company = guy.find( 'company_name' )[0].value email_address = guy.find( 'email_address' )[0].value print u "%s\n %s\n %s" % (firstname, company, email_address)
40.
41. Beispiel „Bewegungssensor“ (1)Abfrage der Beschleunigungssensoren import sensor sensors = sensor.sensors() # Does this device have Accelerator Sensor if sensors.has_key( 'AccSensor' ): SENSOR_ACC = True sensor_data = sensors[ 'AccSensor' ] sensor_acc = sensor.Sensor(sensor_data[ 'id' ], sensor_data[ 'category' ]) sensor_acc.connect(handle_sensor_raw) def handle_sensor_raw(a_data): if a_data.has_key( 'data_1' ): acc_data_1 = a_data[ 'data_1' ] acc_data_2 = a_data[ 'data_2' ] acc_data_3 = a_data[ 'data_3' ]
43. Beispiel „Location BasedService“ Auswertung der GSM Cell ID Send SMS to someone if caretan cell is near import location HOME_CELL_ID = u"98521779" WIFE = u"+49173247****“ entries = [u "freu mich auf Dich!" , u "hab Hunger." , u "hab schlechte Laune." ] listbox = appuifw.Listbox(entries, shout) home = 0 while home == 0: country, provider, lac, cell = location.gsm_location() if (cell== HOME_CELL_ID): home = 1 message = u "Bin gleich zuhause und %s" % mood messaging.sms_send(WIFE, message)