Python for S60 SmartPhones

advertisement
Python for S60 SmartPhones
PostPC Workshop
Fall 2006
Amnon Dekel
S60? What?
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
2
What is Python



Python is an Open Source programming
language developed by Guido van Rossum
Python is an interpreted, interactive, objectoriented programming language. It is often
compared to Tcl, Perl, Scheme or Java. The
popularity of Python is on the rise.
Python combines remarkable power with very
clear syntax.
• It has modules, classes, exceptions, very high
level dynamic data types, and dynamic typing.
From: Python Tutorial: Jurgen Scheible (c) 2006
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
3
Who Uses Python?
Google
 NASA
 Industrial Light and Magic
 Many more


www.python.org
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
4
Python for S60



Python for Series 60 brings the Python programming
language to the Series 60 Platform, Nokia's
"modified/enhanced" version of the Symbian Operating
System platform for Mobile devices.
Currently Python for Series 60 is based on Python 2.2.2.
It Supports many of the Python Standard Library modules
but has on top a few mobile platform specific modules
e.g.
- native GUI widgets,
- Bluetooth
- GPRS networking
- GSM Location information,
- SMS Messaging,
- Acces to camera and more!
From: Python Tutorial: Jurgen Scheible (c) 2006
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
5
Python for S60 - Capabilities












GUI: Menu, Forms, Listboxes, Input fields, Dialogs, Notes
Graphics: - color, font and style attributes, - directscreen drawing, - displaying images and icons • Keydown and key-up events
Sockets: TCP/IP, Bluetooth (RFCOMM, OBEX)
Messaging (SMS)
Networking (HTTP, FTP, …)
Access to file system, file reading, XML, RSS
Access to camera, telephone
Access to calendar, contacts, sysinfo
Location (cell-id)
Content handler
Python extensions can be written in C++
Make standalone applications
From: Python Tutorial: Jurgen Scheible (c) 2006
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
6
Python for S60 - Installing
1. Determine the Phone Version:
• S60 1st Edition, 2nd Edition , 2nd Edition FP2, 2nd
Edition FP3, 3rd Edition
• Search for your phone model here:
http://en.wikipedia.org/wiki/Nokia_S60_and_Symbian_OS
 Our Phones:
• 6680: Series 60 2nd Edition, Feature Pack 2
(Version 2.6), based on Symbian OS version
8.0a
• N80: S60 3rd Edition (Version 3.0), based on
Symbian OS version 9.1
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
7
Python for S60 - Installing
1.
Download and Install Python S60:
http://sourceforge.net/project/showfiles.php?group_id=154155

•
Find the installer for the phone
Install first the PythonForS60 package and
then the PythonScriptShell package.
More
Installation Info
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
8
Other Files and Documents

File Manager:
 FExplorer for Series 60
 SExplorer for Series 60 3rd Edition

Documentation:
 PythonForS60_doc_1_3_1.pdf It is a helpful
documentation on Python for Series 60 API's.
 Python Library Refernence (2.2.3) It is useful for
checking out standard Python stuff.

Other documents:
 Programming_with_Python.pdf
 Getting_Started_with_Python.pdf
From: Python Tutorial: Jurgen Scheible (c) 2006
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
9
Links

The Tutorial:
http://www.mobilenin.com/pys60/menu.htm

Code Snippets:
http://www.bigbold.com/snippets/tag/series60

Python.org:
• Download Python + IDE’s for your workstation

Python for S60 Discussion Board:
http://discussion.forum.nokia.com/forum/forumdisplay.php?f
=102 (this is where to find the latest releases and updates)

Python for S60 WIKI:
http://wiki.opensource.nokia.com/projects/Python_for_S60

Python for S60 Emulator:
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
10
Hello World

OK- we have installed Python S60 on
our Phones – Now lets get to Hello
World
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
11
Hello World
1.
2.
3.
Write your script in a text editor on
your workstation
Save it as filenaeme.py
Transfer it to your phone and run it
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
12
Hello World

Write your script in a text editor on
your workstation
From: Python Tutorial: Jurgen Scheible (c) 2006
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
13
Hello World

Save it as
filenaeme.py
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
14
Hello World
Transfer it to your phone:
 Install Nokia PC Sync
 http://europe.nokia.com/A4144903

Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
15
Hello World
Transfer it to your phone:
 Install Nokia PC Sync
 http://europe.nokia.com/A4144903

Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
16
Hello World

Transfer it to
your phone
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
17
Hello World

6680: Open FExplorer on the phone
• Navigate to the Directory where you saved the file
•
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
18
Hello World

N80: Open SExplorer on the phone
• Select the 3rd Shortcut on the Standby Menu
•
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
19
Hello World

Run Python on the Phone
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
20
Lets Try
Write the Hello world code
 Save to disk
 Transfer to Phone
 Install:

• 6680: Install as Python Script
• N80: Copy and Paste into C:\Python\

Run in Python for S60
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
21
Homework
 Go through the Python for S60 Tutorial
• Do the exercises in the tutorial
 Write an app that uses the following:
• Reads User input
• Outputs user input to screen
• Menu
• Record Audio, Play back Audio
• Snap Photo, Show Photo, Upload* photo to web page
• If you have a 3G SIM* (insert and use in the phone)
 Send an SMS to user supplied number with URL to The
web page with the photo (so they can see it on their
phone – make sure the image is not too large)
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
22
Phone Usage




We have 2 Phones for your
use
They will be available for
use in the Lab (Ross 19)
(They must NOT be taken
out)
They must be signed out
with your student or ID card
There is the option of using
an Emulator* http://wiki.opensource.nokia.com/projects/
Installing_PyS60#Emulator_installation
*: I have not done this – you are on your own 
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
23
Contacting Me

amnoid @ cs
Python for S60 Workshop -- Amnon Dekel – HUJI Nov 2006
24
Download