| Reply | « Previous Thread | Next Thread » |
|
Hi ! i'm new with pyhon.
This is what i'd like to do with python on my N95 8gb: When the phone rings for an incoming call, i want to display a window in the top of the screen with some info regarding the caller. I have to create a small database like this: Name: PhoneNumber: Last Visit: Next Visit: (o.t. : I'm a doctor and these contacts are patients) When the incoming call is from a number in the database, the window on the top of the screen should display tha name, the date of last and next visit. I do not want to add these contacts to my built-in contacts book. My main problem is how to recognize the number of an incoming call. I have read this thread but i cant understand well .. http://discussion.forum.nokia.com/fo...d.php?t=120891 Thank you in advance for helping me !! Matteo |
|
Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
Offline
Forum Nokia Champion
|
|
Hello Matteo and welcome to PyS60.
I have come up with a very basic solution to your question (based on the thread you provided): Code:
import appuifw, e32, telephone, logs
from time import *
app_lock=e32.Ao_lock()
def quit():app_lock.signal()
appuifw.app.exit_key_handler=quit
n=logs.calls(mode='in')[0] #The most recent incoming call
n=n["number"] #Its number
listofnames=['George', 'Alan'] #The names of your patients
#The database containing names, numbers and next visits (you have to add any extra details)
database={'George':['0257813761','next appointment:tuesday'], 'Alan':['0711657212','next app:saturday']}
def callstate(state):
global n
for i in listofnames:
if(n==database[i][0]):print database[i][1]
#That means that if the current incoming call's number is in the
#database the next appointment will be shown
def callback_call(state):
if(state==EStatusRinging):callstate(state)
telephone.call_state(callstate)
app_lock.wait()
Hope this helps ![]() |
|
Join Date: Feb 2008
Posts: 2,542
Location: Bhavnagar, Gujarat, India
gaba88
Offline
Forum Nokia Champion
|
|
hi MatteoG
welcome to the forum nokia the solution to ur question is the logs module recently released in python for S60 have a look at that. thanx Gargi Das- http://gargidas.blogsot.com Forum Nokia Python Wiki Learn Python at http://mobapps.org/PyS60 |
|
Thank you very much for your replies !
But probably my request was not clear: my aim is to display informations about the patient WHILE the phone is ringing and not when the call is finished. I want to be able to see patient's information BEFORE i answer (i have many patients and often i cant remember what i sayed them during last visit). So i think logs module is not useful for this aim. I tryed with this code: Code:
import appuifw
import e32
import telephone
listofnames=['Paz1', 'Paz2', 'Paz3']
database={'Paz1':['+39010555555','next app: 11/05/2008'], 'Paz2':['+390185666666','next app: 12/05/2008'],'Paz3':['+3901857777777','next app: 13/05/2008']}
def handleCall((callState, number)):
if callState == telephone.EStatusRinging:
if number <> "":
print "call from "+ number #print the number
for i in listofnames:
if(number==database[i][0]):
print database[i][1] #print next appointment
print "patient:", i #print patient name
def quit():
app_lock.signal()
appuifw.app.exit_key_handler = quit
app_lock=e32.Ao_lock()
appuifw.app.title = u"Patients PhoneBook"
telephone.call_state(handleCall)
print "waiting for a call ..."
app_lock.wait()
but there is a problem: when the phone is ringing for an incoming call my python window disappears completely. So i can see the correct output of my script only when the call is finished. So i ask you: is it possible to have a little window with my python output during an incomil call (i.e. when the phone is ringing) ?? I'd like to have a little window in foreground in the top of the screen. Thank you again !! Matteo
Last edited by MatteoG : 2008-04-07 at 15:36.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Guidance required for INCOMING call scenario in 3rd party VoIP Client implementation | mevasudeva | VoIP | 0 | 2007-12-31 12:26 |
| gets the number of incoming call | kingkiko | General Symbian C++ | 1 | 2005-04-12 04:53 |
| Call Info in an observer program??? | marycore | Symbian Tools & SDKs | 0 | 2004-12-19 13:25 |
| Display picture and play sound on incoming call | sevih | General Symbian C++ | 0 | 2003-12-03 04:34 |
| Nokia 7650 - Recognize incoming fax call and handle it. | gilfr | General Symbian C++ | 0 | 2002-10-20 09:38 |