SlideShare a Scribd company logo
1 of 47
Handy-Programmierung mit Python Symbian S60 Andreas Schreiber < [email_address] > Tech Talk, DLR Köln-Porz, 15.07.2008
Smartphones ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Betriebssysteme für Smartphones ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Symbian OS und S60 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Quelle: S60 Platform: Introductory Guide. Nokia Corporation, 2007. http://www.s60.com/business/developers/documents  A schematic diagram of the S60 platform architecture.
Symbian Foundation Schaffung einer einheitlichen Software-Plattform ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Quellen: Nokia Press Release (June 24, 2008), http://www.nokia.com/A4136001?newsid=1230415 Nokia kauft Symbian (heise news, 24.06.2008), http://www.heise.de/newsticker/meldung/109873
S60 Platform Services Fundamental services ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
S60 Application Services Certain basic functionality for S60 applications  ,[object Object],[object Object],[object Object]
Python for S60 (PyS60) ,[object Object],[object Object],[object Object],[object Object],[object Object]
“ Hello World” import  appuifw appuifw.app.title = u „Hello World&quot; appuifw.note(u &quot;Hello   World!&quot; ,  'info' )
Start des Python-Interpreters
Ausführen von Python-Code (1) Skripte (“Run script”)
Ausführen von Python-Code (2) Interaktive Konsole
Ausführen von Python-Code (3) Bluetooth-Konsole
 
Python API Typen und Bibliotheken von PyS60 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Python S60-Module (1) Betriebssystem-Zugriff und -Information ,[object Object],[object Object],[object Object],[object Object]
Python S60-Module (2) Benutzerschnittstelle und Grafik (I) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Python S60-Module (3) Benutzerschnittstelle und Grafik (II) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Python S60-Module (4) Audio und Kommunikation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Python S60-Module (5) Datenmanagement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Struktur von Applikationen (1) Visuelles Layout ,[object Object],Title Navigation Tabs Body Menu Exit Dialog
Struktur von Applikationen (2) Source-Code-Template ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],import  appuifw import  e32 appuifw.app.screen =  'normal' def  item1(): print   &quot; item1 was selected.” appuifw.app.menu = [(u&quot;item 1&quot;, 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
Graphical User Interface ( appuifw )  Basiselemente ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Graphical User Interface ( appuifw )  Screen Size ,[object Object],[object Object],normal large full
Beispiele
Beispiel „Versenden einer SMS“ (1) Source Code import  appuifw import  messaging data = appuifw.query(u &quot;what are you doing?&quot; ,  &quot;text&quot; ) receiver =  &quot;+49172940****&quot;   if  appuifw.query(u &quot;Send message?&quot; ,  &quot;query&quot; ) ==  True : messaging.sms_send(receiver, data) appuifw.note(u &quot;Message sent.&quot; ,  &quot;info&quot; ) else : appuifw.note( u&quot;Messages   not sent!&quot; ,  &quot;info&quot; ) s60test.send_sms.py
Beispiel „Versenden einer SMS“ (2) Ausführung
Beispiel „Versenden einer SMS“ (3) Erfolgskontrolle beim Empfänger
Beispiel „SMS-Empfang und Sound“ (1) Funktionen ,[object Object],[object Object]
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 &quot;No sound recorded!&quot; ,  &quot;error&quot; ) def  stop(self): if  self.mySound:  self.mySound.stop() self.mySound.close() def  clear(self): self.stop() os.remove(self.filename)
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 &quot;sms content: &quot;  + sms_text ,  &quot;info&quot; ) if  sms_text ==  &quot;play&quot; : recorder.play() elif  sms_text ==  &quot;record&quot; : recorder.record() elif  sms_text ==  &quot;stop&quot; : recorder.stop() elif  sms_text ==  &quot;clear&quot; : recorder.clear() app_lock.signal() box = inbox.Inbox() box.bind(message_received)
Beispiel „Kamera und File-Upload“ (1) Aufnahme von Bildern import  time import  appuifw import  camera filename = time.strftime( &quot;n95-%Y%m%d%H%M%S.jpg&quot; , time.gmtime()) image = camera.take_photo() image.save(filename) appuifw.note(u &quot;Photo   saved to %s&quot;  % filename,  'info' ) if  imageToURL(filename) == 200: appuifw.note(u &quot;Photo   uploaded successfully.&quot; ,  'info' ) else : appuifw.note(u &quot;Photo   upload failed!&quot; ,  'error' )
Kamera-Einstellungen Optionen von camera.take_photo() def  take_photo( mode= 'RGB16' , size=(640, 480), zoom=0, flash= 'none' , exposure= 'auto' , white_balance= 'auto' ):
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 = { &quot;Content-type&quot; :  &quot;application/x-www-form-urlencoded&quot; , &quot;Accept&quot; :  &quot;text/plain&quot; ,} params = urllib.urlencode({u 'fileName' :    os.path.split(aPath)[1], u 'data' :encodedData}) conn = httplib.HTTPConnection( &quot;www.onyame.de&quot; ) conn.request( &quot;POST&quot; ,  &quot;/image_uploader.php&quot; , 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
Beispiel „Kamera und File-Upload“ (3) Hochladen auf Server
Beispiel „Kamera und File-Upload“ (4) Erfolgskontrolle ,[object Object]
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()
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()
Beispiel „Kontakte-Datenbank“ import  contacts db = contacts.open() print u &quot;Searching contacts…&quot; 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 &quot;%s  %s  %s&quot;  %  (firstname, company, email_address)
Beispiel „Kalender“ ,[object Object],[object Object]
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' ]
Beispiel „Bewegungssensor“ (2) Graphische Aufbereitung: „Sensor Analyzer“  ,[object Object]
Beispiel „Location Based Service“ Auswertung der GSM Cell ID ,[object Object],import  location HOME_CELL_ID = u&quot;98521779&quot; WIFE = u&quot;+49173247****“ entries = [u &quot;freu mich auf Dich!&quot; ,  u &quot;hab Hunger.&quot; ,  u &quot;hab schlechte Laune.&quot; ] 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 &quot;Bin gleich zuhause und %s&quot;  % mood  messaging.sms_send(WIFE, message)
Links ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Anlaufstellen für Hilfe ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Python für andere mobile Geräte ,[object Object],[object Object]
Literatur ,[object Object]

More Related Content

What's hot

A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha Teen
A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha TeenA BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha Teen
A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha TeenEscola João Beraldo
 
EXPERIENCE CERTIFICATE-MCPL
EXPERIENCE CERTIFICATE-MCPLEXPERIENCE CERTIFICATE-MCPL
EXPERIENCE CERTIFICATE-MCPLJAYRAM HEGDE
 
Design of analog filters by rolf schaumann(solution manual)
Design of analog filters by rolf schaumann(solution manual)Design of analog filters by rolf schaumann(solution manual)
Design of analog filters by rolf schaumann(solution manual)Šãd Tarìq
 
L & T Experiance certi
L & T Experiance certiL & T Experiance certi
L & T Experiance certiRAKESH PATEL
 
Zagor lib kb 009 bijelo more
Zagor lib kb 009   bijelo moreZagor lib kb 009   bijelo more
Zagor lib kb 009 bijelo moreStripovizijacom
 
Notes for Digital Communication Module 1(18EC61)
Notes for Digital Communication Module 1(18EC61)Notes for Digital Communication Module 1(18EC61)
Notes for Digital Communication Module 1(18EC61)INDU
 
Nora burgues de taylor
Nora burgues de taylorNora burgues de taylor
Nora burgues de taylorcasobelsunce
 
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำ
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำ
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำKrongkaew Taenkaew
 
diploma certificate
diploma certificatediploma certificate
diploma certificategaurab dutta
 
Pu u po - TG - BK i K - 06
Pu u po - TG - BK i K - 06Pu u po - TG - BK i K - 06
Pu u po - TG - BK i K - 06Stripovi Klub
 
คู่มือการมุงกระเบื้องลอนคู่
คู่มือการมุงกระเบื้องลอนคู่คู่มือการมุงกระเบื้องลอนคู่
คู่มือการมุงกระเบื้องลอนคู่thana bkk
 
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)ssuser8c0554
 
Work Experience Certificate From The Arab Contractors Company
Work Experience Certificate From The Arab Contractors Company Work Experience Certificate From The Arab Contractors Company
Work Experience Certificate From The Arab Contractors Company Hassan Ramadan
 
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)zoran radovic
 
Sejn 058 dzek slejd - djavolski rancer
Sejn 058   dzek slejd - djavolski rancer Sejn 058   dzek slejd - djavolski rancer
Sejn 058 dzek slejd - djavolski rancer Balkanski Posetilac
 

What's hot (20)

A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha Teen
A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha TeenA BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha Teen
A BATALHA PELO GRÊMIO ESTUDANTIL-Luluzinha Teen
 
Parsons _ Experience Certificate
Parsons _ Experience CertificateParsons _ Experience Certificate
Parsons _ Experience Certificate
 
EXPERIENCE CERTIFICATE-MCPL
EXPERIENCE CERTIFICATE-MCPLEXPERIENCE CERTIFICATE-MCPL
EXPERIENCE CERTIFICATE-MCPL
 
Design of analog filters by rolf schaumann(solution manual)
Design of analog filters by rolf schaumann(solution manual)Design of analog filters by rolf schaumann(solution manual)
Design of analog filters by rolf schaumann(solution manual)
 
L & T Experiance certi
L & T Experiance certiL & T Experiance certi
L & T Experiance certi
 
Tex vc 043 - Sramna ucena
Tex vc 043 - Sramna ucenaTex vc 043 - Sramna ucena
Tex vc 043 - Sramna ucena
 
10th certificate
10th certificate10th certificate
10th certificate
 
Zagor lib kb 009 bijelo more
Zagor lib kb 009   bijelo moreZagor lib kb 009   bijelo more
Zagor lib kb 009 bijelo more
 
Notes for Digital Communication Module 1(18EC61)
Notes for Digital Communication Module 1(18EC61)Notes for Digital Communication Module 1(18EC61)
Notes for Digital Communication Module 1(18EC61)
 
Nora burgues de taylor
Nora burgues de taylorNora burgues de taylor
Nora burgues de taylor
 
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำ
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำ
ความรู้เบื้องต้นเกี่ยวกับโรคสัตว์น้ำ
 
diploma certificate
diploma certificatediploma certificate
diploma certificate
 
Pu u po - TG - BK i K - 06
Pu u po - TG - BK i K - 06Pu u po - TG - BK i K - 06
Pu u po - TG - BK i K - 06
 
WORLEYPARSONS CERTIFICATE
WORLEYPARSONS CERTIFICATEWORLEYPARSONS CERTIFICATE
WORLEYPARSONS CERTIFICATE
 
คู่มือการมุงกระเบื้องลอนคู่
คู่มือการมุงกระเบื้องลอนคู่คู่มือการมุงกระเบื้องลอนคู่
คู่มือการมุงกระเบื้องลอนคู่
 
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)
ΓΕΡΑΚΙ ΤΟΥ ΤΕΞΑΣ 04 (1972)
 
Work Experience Certificate From The Arab Contractors Company
Work Experience Certificate From The Arab Contractors Company Work Experience Certificate From The Arab Contractors Company
Work Experience Certificate From The Arab Contractors Company
 
**//Fiat Fiorino Furgon//**
**//Fiat Fiorino Furgon//****//Fiat Fiorino Furgon//**
**//Fiat Fiorino Furgon//**
 
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)
Srebrena zvijezda 001. vatreni obracun (strider&amp;folpi&amp;sinisa04)
 
Sejn 058 dzek slejd - djavolski rancer
Sejn 058   dzek slejd - djavolski rancer Sejn 058   dzek slejd - djavolski rancer
Sejn 058 dzek slejd - djavolski rancer
 

Similar to Handy-Programmierung mit Python

C3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisync
C3 Wichterich & Partner Mobile Solutions Blackberry Nokia IntellisyncC3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisync
C3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisyncguest608dc7
 
Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Jürg Stuker
 
CeBit 2001 Messebericht
CeBit 2001 MesseberichtCeBit 2001 Messebericht
CeBit 2001 MesseberichtThomas Wöhlke
 
Top 10 Internet Trends 2002
Top 10 Internet Trends 2002Top 10 Internet Trends 2002
Top 10 Internet Trends 2002Jürg Stuker
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Jürg Stuker
 
Skype – Instant Messaging
Skype – Instant MessagingSkype – Instant Messaging
Skype – Instant MessagingMartin Hilger
 
AWS Customer presentation - Voice Publishing
AWS Customer presentation - Voice PublishingAWS Customer presentation - Voice Publishing
AWS Customer presentation - Voice PublishingAmazon Web Services
 
Programmierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonProgrammierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonAndreas Schreiber
 
Top 10 Internet Trends 2004
Top 10 Internet Trends 2004Top 10 Internet Trends 2004
Top 10 Internet Trends 2004Jürg Stuker
 
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...iDTRONIC Marketing
 
Chatbots bauen mit dem Microsoft Bot Framework
Chatbots bauen mit dem Microsoft Bot FrameworkChatbots bauen mit dem Microsoft Bot Framework
Chatbots bauen mit dem Microsoft Bot FrameworkJens Siebert
 
Lotus Foundations Workshop Teil1
Lotus Foundations Workshop Teil1Lotus Foundations Workshop Teil1
Lotus Foundations Workshop Teil1Andreas Schulte
 
App framework company messenger (Messaging-SDK)
App framework company messenger (Messaging-SDK)App framework company messenger (Messaging-SDK)
App framework company messenger (Messaging-SDK)Thomas Teufel
 
Microsoft Bot Framework (.NET Edition)
Microsoft Bot Framework (.NET Edition)Microsoft Bot Framework (.NET Edition)
Microsoft Bot Framework (.NET Edition)Jens Siebert
 
DACHNUG50 MX_Workshop.pdf
DACHNUG50 MX_Workshop.pdfDACHNUG50 MX_Workshop.pdf
DACHNUG50 MX_Workshop.pdfDNUG e.V.
 

Similar to Handy-Programmierung mit Python (20)

C3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisync
C3 Wichterich & Partner Mobile Solutions Blackberry Nokia IntellisyncC3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisync
C3 Wichterich & Partner Mobile Solutions Blackberry Nokia Intellisync
 
Top 10 Internet Trends 2008
Top 10 Internet Trends 2008Top 10 Internet Trends 2008
Top 10 Internet Trends 2008
 
CeBit 2001 Messebericht
CeBit 2001 MesseberichtCeBit 2001 Messebericht
CeBit 2001 Messebericht
 
Top 10 Internet Trends 2002
Top 10 Internet Trends 2002Top 10 Internet Trends 2002
Top 10 Internet Trends 2002
 
Top 10 Internet Trends 2006
Top 10 Internet Trends 2006Top 10 Internet Trends 2006
Top 10 Internet Trends 2006
 
Skype – Instant Messaging
Skype – Instant MessagingSkype – Instant Messaging
Skype – Instant Messaging
 
AWS Customer presentation - Voice Publishing
AWS Customer presentation - Voice PublishingAWS Customer presentation - Voice Publishing
AWS Customer presentation - Voice Publishing
 
Programmierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit PythonProgrammierung von Mobiltelefonen mit Python
Programmierung von Mobiltelefonen mit Python
 
A3 MCA
A3 MCAA3 MCA
A3 MCA
 
Top 10 Internet Trends 2004
Top 10 Internet Trends 2004Top 10 Internet Trends 2004
Top 10 Internet Trends 2004
 
Ajax, Comet & Co.
Ajax, Comet & Co.Ajax, Comet & Co.
Ajax, Comet & Co.
 
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...
iDTRONICs RFID Desktop Reader EVO HF 2.0: HID oder VCP – Einstellbare Datenau...
 
Zertifizierter projektmanager verfügbar
Zertifizierter projektmanager verfügbarZertifizierter projektmanager verfügbar
Zertifizierter projektmanager verfügbar
 
Csb Kundenforum 2007
Csb Kundenforum 2007Csb Kundenforum 2007
Csb Kundenforum 2007
 
Chatbots bauen mit dem Microsoft Bot Framework
Chatbots bauen mit dem Microsoft Bot FrameworkChatbots bauen mit dem Microsoft Bot Framework
Chatbots bauen mit dem Microsoft Bot Framework
 
Lotus Foundations Workshop Teil1
Lotus Foundations Workshop Teil1Lotus Foundations Workshop Teil1
Lotus Foundations Workshop Teil1
 
Webcast 12 09
Webcast 12 09Webcast 12 09
Webcast 12 09
 
App framework company messenger (Messaging-SDK)
App framework company messenger (Messaging-SDK)App framework company messenger (Messaging-SDK)
App framework company messenger (Messaging-SDK)
 
Microsoft Bot Framework (.NET Edition)
Microsoft Bot Framework (.NET Edition)Microsoft Bot Framework (.NET Edition)
Microsoft Bot Framework (.NET Edition)
 
DACHNUG50 MX_Workshop.pdf
DACHNUG50 MX_Workshop.pdfDACHNUG50 MX_Workshop.pdf
DACHNUG50 MX_Workshop.pdf
 

More from 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
 

More from 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
 

Handy-Programmierung mit Python

  • 1. Handy-Programmierung mit Python Symbian S60 Andreas Schreiber < [email_address] > Tech Talk, DLR Köln-Porz, 15.07.2008
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. “ Hello World” import appuifw appuifw.app.title = u „Hello World&quot; appuifw.note(u &quot;Hello World!&quot; , 'info' )
  • 11. Ausführen von Python-Code (1) Skripte (“Run script”)
  • 12. Ausführen von Python-Code (2) Interaktive Konsole
  • 13. Ausführen von Python-Code (3) Bluetooth-Konsole
  • 14.  
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 26. Beispiel „Versenden einer SMS“ (1) Source Code import appuifw import messaging data = appuifw.query(u &quot;what are you doing?&quot; , &quot;text&quot; ) receiver = &quot;+49172940****&quot; if appuifw.query(u &quot;Send message?&quot; , &quot;query&quot; ) == True : messaging.sms_send(receiver, data) appuifw.note(u &quot;Message sent.&quot; , &quot;info&quot; ) else : appuifw.note( u&quot;Messages not sent!&quot; , &quot;info&quot; ) s60test.send_sms.py
  • 27. Beispiel „Versenden einer SMS“ (2) Ausführung
  • 28. Beispiel „Versenden einer SMS“ (3) Erfolgskontrolle beim Empfänger
  • 29.
  • 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 &quot;No sound recorded!&quot; , &quot;error&quot; ) def stop(self): if self.mySound: self.mySound.stop() self.mySound.close() def clear(self): self.stop() os.remove(self.filename)
  • 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 &quot;sms content: &quot; + sms_text , &quot;info&quot; ) if sms_text == &quot;play&quot; : recorder.play() elif sms_text == &quot;record&quot; : recorder.record() elif sms_text == &quot;stop&quot; : recorder.stop() elif sms_text == &quot;clear&quot; : recorder.clear() app_lock.signal() box = inbox.Inbox() box.bind(message_received)
  • 32. Beispiel „Kamera und File-Upload“ (1) Aufnahme von Bildern import time import appuifw import camera filename = time.strftime( &quot;n95-%Y%m%d%H%M%S.jpg&quot; , time.gmtime()) image = camera.take_photo() image.save(filename) appuifw.note(u &quot;Photo saved to %s&quot; % filename, 'info' ) if imageToURL(filename) == 200: appuifw.note(u &quot;Photo uploaded successfully.&quot; , 'info' ) else : appuifw.note(u &quot;Photo upload failed!&quot; , 'error' )
  • 33. Kamera-Einstellungen Optionen von camera.take_photo() def take_photo( mode= 'RGB16' , size=(640, 480), zoom=0, flash= 'none' , exposure= 'auto' , white_balance= 'auto' ):
  • 34. 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 = { &quot;Content-type&quot; : &quot;application/x-www-form-urlencoded&quot; , &quot;Accept&quot; : &quot;text/plain&quot; ,} params = urllib.urlencode({u 'fileName' : os.path.split(aPath)[1], u 'data' :encodedData}) conn = httplib.HTTPConnection( &quot;www.onyame.de&quot; ) conn.request( &quot;POST&quot; , &quot;/image_uploader.php&quot; , 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
  • 35. Beispiel „Kamera und File-Upload“ (3) Hochladen auf Server
  • 36.
  • 37. 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()
  • 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 &quot;Searching contacts…&quot; 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 &quot;%s %s %s&quot; % (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' ]
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.