SlideShare une entreprise Scribd logo
1  sur  48
Télécharger pour lire hors ligne
Folie 1
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Programmierung von Mobiltelefonen mit Python
Symbian S60
Andreas Schreiber <Andreas.Schreiber@dlr.de>
PyCologne – Python User Group Köln, 11.02.2009
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 2
Smartphones
Kombination aus
Mobiltelefon („Handy“)
Personal Digital Assistant (PDA)
Viele Funktionen und Protokolle
Telefonie, PIM, Web-Browser, SMS, MMS, E-Mail, VoIP,
Multimedia, Radio, Digitalkamera, GPS, DVB-H, …
GSM, UMTS, GRPS, HSCSD, WLAN, Bluetooth, IR,
USB, …
Betriebssystem
Smartphones haben vollständige, erweiterbare
Betriebssysteme
Handys haben vordefinierte Oberfläche; nur begrenzt
erweiterbar (z.B. durch Java)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 3
Betriebssysteme für Smartphones
Liste: http://de.wikipedia.org/wiki/Smartphone#Betriebssysteme
Linux
Android
Openmoko
Mac OS X (Apple iPhone)
Palm OS
RIM BlackBerry
Symbian OS
UIQ (Sony Ericsson)
Series 80 (Nokia Communicator)
Series 60 (Nokia N-series & E-series, Siemens, Samsung,
Motorola, Panasonic)
Windows
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 4
Symbian OS und S60
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)
A schematic diagram of the S60 platform architecture.
Quelle: S60 Platform: Introductory Guide. Nokia Corporation, 2007.
http://www.s60.com/business/developers/documents
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 5
Python for S60 (PyS60)
Portierung von Python auf S60-Plattform
Entwicklung von NOKIA
Open-Source-Lizenz (Apache Version 2 und Python)
Stable Release
Aktuelle Version: 1.4.5 (03.12.2008)
Verfügbar bei Sourceforge
http://sourceforge.net/projects/pys60
Development Release
Aktuelle Version: 1.9.1 (24.01.2009)
Verfügbar bei maemo.org
https://garage.maemo.org/projects/pys60
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 6
Installation von PyS60
Version 1.9.1 unter Windows
1. Herunterladen des Installationspaketes
(für Windows: PythonForS60_1.9.1_Setup.exe)
2. Der Installer installiert:
a. PyS60 Application Packager Ensymble
b. Python Dokumentation
c. Symbian Installationsdateien
3. Installation der Python Runtime und
der Dependencies auf dem Smartphone
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 7
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 8
“Hello World”
import appuifw
appuifw.app.title = u„Hello World"
appuifw.note(u"Hello World!", 'info')
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 9
Start des Python-Interpreters
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 10
Ausführen von Python-Code (1)
Skripte (“Run script”)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 11
Ausführen von Python-Code (2)
Interaktive Konsole
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 12
Ausführen von Python-Code (3)
Bluetooth-Konsole
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 13
Bluetooth Console
Microsoft HyperTerminal
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 14
Python API
Typen und Bibliotheken von PyS60
Alle Built-In-Typen von Python 2.5.1 sind vorhanden
Python Standard Library
Viele der Standard-Module laufen
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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 15
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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 16
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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 17
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)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 18
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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 19
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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 20
Struktur von Applikationen (1)
Visuelles Layout
Typisches visuelles Layout von S60-Applikationen
Title
Title
Navigation Tabs
Navigation Tabs
Body
Body
Menu
Menu Exit
Exit
Dialog
Dialog
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 21
Struktur von Applikationen (2)
Source-Code-Template
1. Import von Modulen
2. Screen Size setzen
3. Applications Menu
4. Exit key handler setzen
(Callback function)
5. Application title setzen
6. Application body
7. Active Objects
8. 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
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 22
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“)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 23
Graphical User Interface (appuifw)
Screen Size
Drei Formate für Applikationen
Rotation der Anzeige ist möglich (portrait, landscape)
normal large full
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 24
Packaging
Ensymble Developer Utilities
Aufgaben
Erzeugung von SIS-Packages
Merge von SIS-Packages
Signing von Packages
Implementierung
Python-Module und command
line tools
GUI „PyS60 Application
Packager“ (Qt)
Folie 25
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Beispiele
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 26
Beispiel „Versenden einer SMS“ (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")
send_sms.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 27
Beispiel „Versenden einer SMS“ (2)
Ausführung
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 28
Beispiel „Versenden einer SMS“ (3)
Erfolgskontrolle beim Empfänger
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 29
Beispiel „SMS-Empfang und Sound“ (1)
Funktionen
Empfang von Befehlen per SMS („record“, „stop“, „play“, „clear“)
Aufzeichnen und Abspielen von Audio
sms_sound_demo.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 30
Beispiel „SMS-Empfang und Sound“ (2)
Source Code: Sound-Operationen
class SoundRecorder:
filename = 'e:boo.wav' # Drive E: is SD card
mySound = None
def record(self):
self.mySound = audio.Sound.open(self.filename)
self.mySound.record()
def play(self):
try:
self.mySound = audio.Sound.open(self.filename)
self.mySound.play()
except:
appuifw.note(u"No sound recorded!", "error")
def stop(self):
if self.mySound:
self.mySound.stop()
self.mySound.close()
def clear(self):
self.stop()
os.remove(self.filename)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 31
Beispiel „SMS-Empfang und Sound“ (3)
Source Code: SMS-Empfang
recorder = SoundRecorder()
def message_received(msg_id):
box = inbox.Inbox()
sms_text = box.content(msg_id)
appuifw.note(u"sms content: " + sms_text , "info")
if sms_text == "play":
recorder.play()
elif sms_text == "record":
recorder.record()
elif sms_text == "stop":
recorder.stop()
elif sms_text == "clear":
recorder.clear()
app_lock.signal()
box = inbox.Inbox()
box.bind(message_received)
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 32
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"%sn %sn %s" %
(firstname, company, email_address)
contacts_demo.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 33
Beispiel „Kamera und File-Upload“ (1)
Aufnahme von Bildern
import time
import appuifw
import camera
filename = time.strftime("n95-%Y%m%d%H%M%S.jpg", time.gmtime())
image = camera.take_photo()
image.save(filename)
appuifw.note(u"Photo saved to %s" % filename, 'info')
if imageToURL(filename) == 200:
appuifw.note(u"Photo uploaded successfully.", 'info')
else:
appuifw.note(u"Photo upload failed!", 'error')
camera_upload.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 34
Kamera-Einstellungen
Optionen von camera.take_photo()
def take_photo(
mode='RGB16',
size=(640, 480),
zoom=0,
flash='none',
exposure='auto',
white_balance='auto'):
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 35
Beispiel „Kamera und File-Upload“ (2)
Hochladen auf Server mit httplib
import httplib, urllib, base64, os.path
def imageToURL(aPath):
data = open(aPath, 'rb').read() # read binary data of picture
encodedData = base64.encodestring(data) # encoded it to base64
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain",}
params = urllib.urlencode({u'fileName':
os.path.split(aPath)[1],
u'data':encodedData})
conn = httplib.HTTPConnection("www.onyame.de")
conn.request("POST", "/image_uploader.php", params, headers)
response = conn.getresponse()
conn.close()
return response.status
Quelle: http://wiki.forum.nokia.com/index.php/How_to_upload_a_file_to_server_with_application/x-www-form-urlencoded
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 36
Beispiel „Kamera und File-Upload“ (3)
Hochladen auf Server
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 37
Beispiel „Kamera und File-Upload“ (4)
Erfolgskontrolle
http://www.onyame.de/upload/fb.php
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 38
Beispiel „Mandelbrot-Menge“ (1)
Rahmenprogramm
import e32
from appuifw import *
app.screen = 'full'
app.body = canvas = Canvas()
width, height = canvas.size
xaxis = width/2
yaxis = height/1.5
scale = 60
iterations = 25
# <<iteration>>
lock = e32.Ao_lock()
app.exit_key_handler = lock.signal
lock.wait()
mandelbrot.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 39
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()
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 40
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']
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 41
Beispiel „Bewegungssensor“ (2)
Graphische Aufbereitung: „Sensor Analyzer“
http://jouni.miettunen.googlepages.com/sensoranalyzer
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 42
Beispiel „Location Based Service“
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)
cell_id_demo.py
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 43
Beispiel „OpenGL“
http://tinyurl.com/pys60cube
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 44
Links
Python for S60
http://opensource.nokia.com/projects/pythonfors60/index.html
http://sourceforge.net/projects/pys60 (Version 1.4.x)
https://garage.maemo.org/projects/pys60 (Version 1.9.x)
http://wiki.opensource.nokia.com/projects/Python_for_S60
Symbian S60
http://www.s60.com
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 45
Anlaufstellen für Hilfe
Python for S60 discussion board at Forum Nokia
http://discussion.forum.nokia.com/forum/forumdisplay.php?forumid=102
IRC channel #pys60 bei Freenode.net
irc://chat.freenode.net/pys60
Google Group Python for S60
http://groups.google.com/group/py4S60
Google Group PythonS60
http://groups.google.com/group/pythons60
Beispiele / Code-Snippets
http://wiki.forum.nokia.com/index.php/Category:Python#Code_Examples_for_
http://snippets.dzone.com/tags/series60
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 46
Python für andere mobile Geräte
Übersicht Python for Mobile Devices
http://www.awaretek.com/pymo.html
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 47
Literatur
Jürgen Scheible, Ville Tuulos.
Mobile Python: Rapid Prototyping
of Applications on the Mobile
Platform
http://www.mobilepythonbook.org
Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009
Folie 48
Fragen?

Contenu connexe

En vedette

JSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederJSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederChristoph Pickl
 
แนวทางในการแก้ปัญหาภาวะโลกร้อน11
แนวทางในการแก้ปัญหาภาวะโลกร้อน11แนวทางในการแก้ปัญหาภาวะโลกร้อน11
แนวทางในการแก้ปัญหาภาวะโลกร้อน11tethingtong
 
Finanţări ale uniunii europene pentru activităţi educaţionale
Finanţări ale uniunii europene pentru activităţi educaţionaleFinanţări ale uniunii europene pentru activităţi educaţionale
Finanţări ale uniunii europene pentru activităţi educaţionaleIrimia Crisalinda
 
для эссе артикль
для эссе артикльдля эссе артикль
для эссе артикльVera
 
Ict miren leire.
Ict miren leire.Ict miren leire.
Ict miren leire.leiremiren
 
Les tecnologies i_els_seus_problemes
Les tecnologies i_els_seus_problemesLes tecnologies i_els_seus_problemes
Les tecnologies i_els_seus_problemessandrasan96
 
Lewnidasbrousalis mariospapamixahl
Lewnidasbrousalis mariospapamixahlLewnidasbrousalis mariospapamixahl
Lewnidasbrousalis mariospapamixahlVasso Servou
 
สาธารณรัฐประชาธิปไตยประชาชนเกาหลี
สาธารณรัฐประชาธิปไตยประชาชนเกาหลีสาธารณรัฐประชาธิปไตยประชาชนเกาหลี
สาธารณรัฐประชาธิปไตยประชาชนเกาหลีSRINAKARIN MOTHER PRINCESS SCHOOL
 
Html5 e css3 nei miei progetti: cosa ho fatto
Html5 e css3 nei miei progetti: cosa ho fattoHtml5 e css3 nei miei progetti: cosa ho fatto
Html5 e css3 nei miei progetti: cosa ho fattoRocco Passaro
 
Webdesign portfolio Dollenmetmedia
Webdesign portfolio DollenmetmediaWebdesign portfolio Dollenmetmedia
Webdesign portfolio Dollenmetmediachristiaandollen
 

En vedette (17)

JSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael GreifenederJSUG - OSGi by Michael Greifeneder
JSUG - OSGi by Michael Greifeneder
 
Test
TestTest
Test
 
แนวทางในการแก้ปัญหาภาวะโลกร้อน11
แนวทางในการแก้ปัญหาภาวะโลกร้อน11แนวทางในการแก้ปัญหาภาวะโลกร้อน11
แนวทางในการแก้ปัญหาภาวะโลกร้อน11
 
Finanţări ale uniunii europene pentru activităţi educaţionale
Finanţări ale uniunii europene pentru activităţi educaţionaleFinanţări ale uniunii europene pentru activităţi educaţionale
Finanţări ale uniunii europene pentru activităţi educaţionale
 
для эссе артикль
для эссе артикльдля эссе артикль
для эссе артикль
 
Ict miren leire.
Ict miren leire.Ict miren leire.
Ict miren leire.
 
Les tecnologies i_els_seus_problemes
Les tecnologies i_els_seus_problemesLes tecnologies i_els_seus_problemes
Les tecnologies i_els_seus_problemes
 
Lewnidasbrousalis mariospapamixahl
Lewnidasbrousalis mariospapamixahlLewnidasbrousalis mariospapamixahl
Lewnidasbrousalis mariospapamixahl
 
จังหวัดกาฬสินธิ
จังหวัดกาฬสินธิจังหวัดกาฬสินธิ
จังหวัดกาฬสินธิ
 
Presentation1
Presentation1Presentation1
Presentation1
 
บราซิล
บราซิลบราซิล
บราซิล
 
สาธารณรัฐประชาธิปไตยประชาชนเกาหลี
สาธารณรัฐประชาธิปไตยประชาชนเกาหลีสาธารณรัฐประชาธิปไตยประชาชนเกาหลี
สาธารณรัฐประชาธิปไตยประชาชนเกาหลี
 
Del Monte Rossi
Del Monte RossiDel Monte Rossi
Del Monte Rossi
 
Html5 e css3 nei miei progetti: cosa ho fatto
Html5 e css3 nei miei progetti: cosa ho fattoHtml5 e css3 nei miei progetti: cosa ho fatto
Html5 e css3 nei miei progetti: cosa ho fatto
 
จังหวัดมหาสารคาม
จังหวัดมหาสารคามจังหวัดมหาสารคาม
จังหวัดมหาสารคาม
 
ศรีษเกษ
ศรีษเกษศรีษเกษ
ศรีษเกษ
 
Webdesign portfolio Dollenmetmedia
Webdesign portfolio DollenmetmediaWebdesign portfolio Dollenmetmedia
Webdesign portfolio Dollenmetmedia
 

Similaire à Programmierung von Mobiltelefonen mit Python

Smartphone Betriebssysteme BlackBerry
Smartphone Betriebssysteme BlackBerrySmartphone Betriebssysteme BlackBerry
Smartphone Betriebssysteme BlackBerrydm-development
 
Ionic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenIonic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenHendrik Lösch
 
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...Gordon Breuer
 
Smartphone Betriebssysteme Windows Phone
Smartphone Betriebssysteme Windows PhoneSmartphone Betriebssysteme Windows Phone
Smartphone Betriebssysteme Windows Phonedm-development
 
Windows 10 IoT Core
Windows 10 IoT CoreWindows 10 IoT Core
Windows 10 IoT CoreJens Siebert
 
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)greenrobot
 
Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Jürg Stuker
 
Augmented Reality Workshop
Augmented Reality WorkshopAugmented Reality Workshop
Augmented Reality Workshopargency
 
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...Gregor Biswanger
 
C / C++ Api for Beginners
C / C++ Api for BeginnersC / C++ Api for Beginners
C / C++ Api for BeginnersUlrich Krause
 
Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Manfred Steyer
 
Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Manfred Steyer
 
Windows 8 für Entwickler
Windows 8 für EntwicklerWindows 8 für Entwickler
Windows 8 für EntwicklerJan Hentschel
 
C API for Lotus Notes & Domino
C API for Lotus Notes & DominoC API for Lotus Notes & Domino
C API for Lotus Notes & DominoUlrich Krause
 
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)Christian Heindel
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Jürg Stuker
 

Similaire à Programmierung von Mobiltelefonen mit Python (20)

Smartphone Betriebssysteme BlackBerry
Smartphone Betriebssysteme BlackBerrySmartphone Betriebssysteme BlackBerry
Smartphone Betriebssysteme BlackBerry
 
Ionic 3
Ionic 3Ionic 3
Ionic 3
 
Ionic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf SteroidenIonic 2 - Hybridapps auf Steroiden
Ionic 2 - Hybridapps auf Steroiden
 
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...
CSI: WP - Dem Windows Phone auf der Spur, Internetspecial: SDK & Development-...
 
Smartphone Betriebssysteme Windows Phone
Smartphone Betriebssysteme Windows PhoneSmartphone Betriebssysteme Windows Phone
Smartphone Betriebssysteme Windows Phone
 
Windows 10 IoT Core
Windows 10 IoT CoreWindows 10 IoT Core
Windows 10 IoT Core
 
Titanium Vs Phonegap
Titanium Vs PhonegapTitanium Vs Phonegap
Titanium Vs Phonegap
 
Help pdf
Help pdfHelp pdf
Help pdf
 
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)
Android Entwicklung (App Entwickler Konferenz 2010 der Telekom)
 
Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Top 10 Internet Trends 2008
Top 10 Internet Trends 2008
 
Augmented Reality Workshop
Augmented Reality WorkshopAugmented Reality Workshop
Augmented Reality Workshop
 
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...
Roadshow: Einstieg in die Hybrid-App Entwicklung mit dem Intel XDK und Apache...
 
Windows 8
Windows 8Windows 8
Windows 8
 
C / C++ Api for Beginners
C / C++ Api for BeginnersC / C++ Api for Beginners
C / C++ Api for Beginners
 
Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2
 
Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2Moderne Web-Anwendungen mit Angular 2
Moderne Web-Anwendungen mit Angular 2
 
Windows 8 für Entwickler
Windows 8 für EntwicklerWindows 8 für Entwickler
Windows 8 für Entwickler
 
C API for Lotus Notes & Domino
C API for Lotus Notes & DominoC API for Lotus Notes & Domino
C API for Lotus Notes & Domino
 
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)
SharePoint, HTML5 und mobile Geräte (SharePoint UserGroup Dresden 11/2011)
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006
 

Plus de Andreas Schreiber

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Andreas Schreiber
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityAndreas Schreiber
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureAndreas Schreiber
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterAndreas Schreiber
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsAndreas Schreiber
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsAndreas Schreiber
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data ScienceAndreas Schreiber
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using ComicsAndreas Schreiber
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenAndreas Schreiber
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with PythonAndreas Schreiber
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataAndreas Schreiber
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestAndreas Schreiber
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataAndreas Schreiber
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionAndreas Schreiber
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannAndreas Schreiber
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenAndreas Schreiber
 

Plus de Andreas Schreiber (20)

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented Reality
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructure
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace Center
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket Scientists
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality Headsets
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data Science
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using Comics
 
Quantified Self Comics
Quantified Self ComicsQuantified Self Comics
Quantified Self Comics
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with Python
 
Python at Warp Speed
Python at Warp SpeedPython at Warp Speed
Python at Warp Speed
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self Data
 
Open Source im DLR
Open Source im DLROpen Source im DLR
Open Source im DLR
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The Rest
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris Data
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & Exposition
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermann
 
Big Python
Big PythonBig Python
Big Python
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-Sensoren
 

Programmierung von Mobiltelefonen mit Python

  • 1. Folie 1 Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Programmierung von Mobiltelefonen mit Python Symbian S60 Andreas Schreiber <Andreas.Schreiber@dlr.de> PyCologne – Python User Group Köln, 11.02.2009
  • 2. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 2 Smartphones Kombination aus Mobiltelefon („Handy“) Personal Digital Assistant (PDA) Viele Funktionen und Protokolle Telefonie, PIM, Web-Browser, SMS, MMS, E-Mail, VoIP, Multimedia, Radio, Digitalkamera, GPS, DVB-H, … GSM, UMTS, GRPS, HSCSD, WLAN, Bluetooth, IR, USB, … Betriebssystem Smartphones haben vollständige, erweiterbare Betriebssysteme Handys haben vordefinierte Oberfläche; nur begrenzt erweiterbar (z.B. durch Java)
  • 3. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 3 Betriebssysteme für Smartphones Liste: http://de.wikipedia.org/wiki/Smartphone#Betriebssysteme Linux Android Openmoko Mac OS X (Apple iPhone) Palm OS RIM BlackBerry Symbian OS UIQ (Sony Ericsson) Series 80 (Nokia Communicator) Series 60 (Nokia N-series & E-series, Siemens, Samsung, Motorola, Panasonic) Windows
  • 4. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 4 Symbian OS und S60 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) A schematic diagram of the S60 platform architecture. Quelle: S60 Platform: Introductory Guide. Nokia Corporation, 2007. http://www.s60.com/business/developers/documents
  • 5. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 5 Python for S60 (PyS60) Portierung von Python auf S60-Plattform Entwicklung von NOKIA Open-Source-Lizenz (Apache Version 2 und Python) Stable Release Aktuelle Version: 1.4.5 (03.12.2008) Verfügbar bei Sourceforge http://sourceforge.net/projects/pys60 Development Release Aktuelle Version: 1.9.1 (24.01.2009) Verfügbar bei maemo.org https://garage.maemo.org/projects/pys60
  • 6. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 6 Installation von PyS60 Version 1.9.1 unter Windows 1. Herunterladen des Installationspaketes (für Windows: PythonForS60_1.9.1_Setup.exe) 2. Der Installer installiert: a. PyS60 Application Packager Ensymble b. Python Dokumentation c. Symbian Installationsdateien 3. Installation der Python Runtime und der Dependencies auf dem Smartphone
  • 7. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 7
  • 8. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 8 “Hello World” import appuifw appuifw.app.title = u„Hello World" appuifw.note(u"Hello World!", 'info')
  • 9. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 9 Start des Python-Interpreters
  • 10. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 10 Ausführen von Python-Code (1) Skripte (“Run script”)
  • 11. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 11 Ausführen von Python-Code (2) Interaktive Konsole
  • 12. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 12 Ausführen von Python-Code (3) Bluetooth-Konsole
  • 13. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 13 Bluetooth Console Microsoft HyperTerminal
  • 14. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 14 Python API Typen und Bibliotheken von PyS60 Alle Built-In-Typen von Python 2.5.1 sind vorhanden Python Standard Library Viele der Standard-Module laufen 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
  • 15. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 15 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
  • 16. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 16 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
  • 17. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 17 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)
  • 18. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 18 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
  • 19. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 19 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
  • 20. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 20 Struktur von Applikationen (1) Visuelles Layout Typisches visuelles Layout von S60-Applikationen Title Title Navigation Tabs Navigation Tabs Body Body Menu Menu Exit Exit Dialog Dialog
  • 21. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 21 Struktur von Applikationen (2) Source-Code-Template 1. Import von Modulen 2. Screen Size setzen 3. Applications Menu 4. Exit key handler setzen (Callback function) 5. Application title setzen 6. Application body 7. Active Objects 8. 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
  • 22. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 22 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“)
  • 23. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 23 Graphical User Interface (appuifw) Screen Size Drei Formate für Applikationen Rotation der Anzeige ist möglich (portrait, landscape) normal large full
  • 24. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 24 Packaging Ensymble Developer Utilities Aufgaben Erzeugung von SIS-Packages Merge von SIS-Packages Signing von Packages Implementierung Python-Module und command line tools GUI „PyS60 Application Packager“ (Qt)
  • 25. Folie 25 Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Beispiele
  • 26. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 26 Beispiel „Versenden einer SMS“ (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") send_sms.py
  • 27. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 27 Beispiel „Versenden einer SMS“ (2) Ausführung
  • 28. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 28 Beispiel „Versenden einer SMS“ (3) Erfolgskontrolle beim Empfänger
  • 29. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 29 Beispiel „SMS-Empfang und Sound“ (1) Funktionen Empfang von Befehlen per SMS („record“, „stop“, „play“, „clear“) Aufzeichnen und Abspielen von Audio sms_sound_demo.py
  • 30. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 30 Beispiel „SMS-Empfang und Sound“ (2) Source Code: Sound-Operationen class SoundRecorder: filename = 'e:boo.wav' # Drive E: is SD card mySound = None def record(self): self.mySound = audio.Sound.open(self.filename) self.mySound.record() def play(self): try: self.mySound = audio.Sound.open(self.filename) self.mySound.play() except: appuifw.note(u"No sound recorded!", "error") def stop(self): if self.mySound: self.mySound.stop() self.mySound.close() def clear(self): self.stop() os.remove(self.filename)
  • 31. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 31 Beispiel „SMS-Empfang und Sound“ (3) Source Code: SMS-Empfang recorder = SoundRecorder() def message_received(msg_id): box = inbox.Inbox() sms_text = box.content(msg_id) appuifw.note(u"sms content: " + sms_text , "info") if sms_text == "play": recorder.play() elif sms_text == "record": recorder.record() elif sms_text == "stop": recorder.stop() elif sms_text == "clear": recorder.clear() app_lock.signal() box = inbox.Inbox() box.bind(message_received)
  • 32. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 32 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"%sn %sn %s" % (firstname, company, email_address) contacts_demo.py
  • 33. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 33 Beispiel „Kamera und File-Upload“ (1) Aufnahme von Bildern import time import appuifw import camera filename = time.strftime("n95-%Y%m%d%H%M%S.jpg", time.gmtime()) image = camera.take_photo() image.save(filename) appuifw.note(u"Photo saved to %s" % filename, 'info') if imageToURL(filename) == 200: appuifw.note(u"Photo uploaded successfully.", 'info') else: appuifw.note(u"Photo upload failed!", 'error') camera_upload.py
  • 34. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 34 Kamera-Einstellungen Optionen von camera.take_photo() def take_photo( mode='RGB16', size=(640, 480), zoom=0, flash='none', exposure='auto', white_balance='auto'):
  • 35. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 35 Beispiel „Kamera und File-Upload“ (2) Hochladen auf Server mit httplib import httplib, urllib, base64, os.path def imageToURL(aPath): data = open(aPath, 'rb').read() # read binary data of picture encodedData = base64.encodestring(data) # encoded it to base64 headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain",} params = urllib.urlencode({u'fileName': os.path.split(aPath)[1], u'data':encodedData}) conn = httplib.HTTPConnection("www.onyame.de") conn.request("POST", "/image_uploader.php", params, headers) response = conn.getresponse() conn.close() return response.status Quelle: http://wiki.forum.nokia.com/index.php/How_to_upload_a_file_to_server_with_application/x-www-form-urlencoded
  • 36. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 36 Beispiel „Kamera und File-Upload“ (3) Hochladen auf Server
  • 37. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 37 Beispiel „Kamera und File-Upload“ (4) Erfolgskontrolle http://www.onyame.de/upload/fb.php
  • 38. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 38 Beispiel „Mandelbrot-Menge“ (1) Rahmenprogramm import e32 from appuifw import * app.screen = 'full' app.body = canvas = Canvas() width, height = canvas.size xaxis = width/2 yaxis = height/1.5 scale = 60 iterations = 25 # <<iteration>> lock = e32.Ao_lock() app.exit_key_handler = lock.signal lock.wait() mandelbrot.py
  • 39. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 39 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()
  • 40. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 40 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']
  • 41. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 41 Beispiel „Bewegungssensor“ (2) Graphische Aufbereitung: „Sensor Analyzer“ http://jouni.miettunen.googlepages.com/sensoranalyzer
  • 42. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 42 Beispiel „Location Based Service“ 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) cell_id_demo.py
  • 43. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 43 Beispiel „OpenGL“ http://tinyurl.com/pys60cube
  • 44. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 44 Links Python for S60 http://opensource.nokia.com/projects/pythonfors60/index.html http://sourceforge.net/projects/pys60 (Version 1.4.x) https://garage.maemo.org/projects/pys60 (Version 1.9.x) http://wiki.opensource.nokia.com/projects/Python_for_S60 Symbian S60 http://www.s60.com
  • 45. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 45 Anlaufstellen für Hilfe Python for S60 discussion board at Forum Nokia http://discussion.forum.nokia.com/forum/forumdisplay.php?forumid=102 IRC channel #pys60 bei Freenode.net irc://chat.freenode.net/pys60 Google Group Python for S60 http://groups.google.com/group/py4S60 Google Group PythonS60 http://groups.google.com/group/pythons60 Beispiele / Code-Snippets http://wiki.forum.nokia.com/index.php/Category:Python#Code_Examples_for_ http://snippets.dzone.com/tags/series60
  • 46. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 46 Python für andere mobile Geräte Übersicht Python for Mobile Devices http://www.awaretek.com/pymo.html
  • 47. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 47 Literatur Jürgen Scheible, Ville Tuulos. Mobile Python: Rapid Prototyping of Applications on the Mobile Platform http://www.mobilepythonbook.org
  • 48. Python User Group Köln > A. Schreiber > Programmierung von Mobiltelefonen mit Python > 11.02.2009 Folie 48 Fragen?

Notes de l'éditeur

  1. © 2009 Andreas Schreiber &amp;lt;Andreas.Schreiber@dlr.de&amp;gt;, Deutsches Zentrum für Luft- und Raumfahrt e.V., Köln-Porz http://www.dlr.de/sc/abteilung/verteiltesysteme
  2. http://www.amazon.de/gp/product/0470515058?ie=UTF8&amp;tag=onyamede-21&amp;link_code=as3&amp;camp=2514&amp;creative=9386&amp;creativeASIN=0470515058