Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User MatteoG's Avatar
    Join Date
    Apr 2008
    Posts
    10
    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

  2. #2
    Nokia Developer Moderator bogdan.galiceanu's Avatar
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471
    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()
    I haven't done extensive testing and you will clearly need to adapt it to your needs, but it shouldn't be too hard from here.
    Hope this helps

  3. #3
    Nokia Developer Champion gaba88's Avatar
    Join Date
    Feb 2008
    Location
    Ahmedabad, Gujarat, India
    Posts
    3,692
    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

  4. #4
    Registered User MatteoG's Avatar
    Join Date
    Apr 2008
    Posts
    10
    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()
    .. and it works !!!

    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 14:36.

Similar Threads

  1. Replies: 0
    Last Post: 2007-12-31, 11:26
  2. gets the number of incoming call
    By kingkiko in forum Symbian C++
    Replies: 1
    Last Post: 2005-04-12, 03:53
  3. Call Info in an observer program???
    By marycore in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-12-19, 12:25
  4. Display picture and play sound on incoming call
    By sevih in forum Symbian C++
    Replies: 0
    Last Post: 2003-12-03, 03:34
  5. Replies: 0
    Last Post: 2002-10-20, 08:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved