×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    69

    Event to read SMS sents !!

    Hello community i am searching about read sms sent with out polling, the only way i know is:

    Code:
    box=inbox.Inbox(inbox.ESent)
    But for that i need "polling" the sent SMS every 1 minute for example.

    Is any way to get some event whe user sent SMS? like SMS receive??

    Thanks in advance
    Best Regards

    Eric.

  2. #2
    Regular Contributor
    Join Date
    Jan 2009
    Location
    India
    Posts
    138

    Re: Event to read SMS sents !!

    Hi,

    For message receive event in Python S60 use below code snippet.

    Code:
    def CALL_BACK_HANDLER(id):
    	try :
    		e32.ao_sleep(2) 
    		global INBOX
    		id = INBOX.sms_messages()[0]
    		sender = INBOX.address(id)
    		objFile = FileMgr(SELECTED_CONTACT_FILE_NAME)
    		if objFile.Is_NumberExist(sender) == True:
    			SmsText = INBOX.content(id)
    			INBOX.delete(id)
    			objFile = FileMgr(SWAPED_SMS_FILE_NAME)
    			objFile.CREATE_FILE(sender + FIELD_SEPARATOR + SmsText)
    			objFile = None
    			# print "Message Swaped !"
    		# else:
    			# print "Message Not Swaped"
    	except:
    		pass
    
    INBOX = inbox.Inbox()
    INBOX.bind(CALL_BACK_HANDLER)

    For more information about the code see this article for the same.http://croozeus.com/blogs/?p=1276

    Hope it helps for you !
    Pavan Pareta
    Sr. Software Engineer
    http://windows-mobile-dev.blogspot.com

  3. #3
    Regular Contributor
    Join Date
    Aug 2004
    Posts
    295

    Re: Event to read SMS sents !!

    The inbox API is currently broken for ESent, it only works for EInbox.

    Also for EInbox it is broken, that's why the above code uses e32.ao_sleep. This callback is called too early, it is not safe to read the incoming message immediately after the callback.


    Hopefully someday I can release fixes for these..

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    69

    [ solved 50%] Re: Event to read SMS sents !!

    I resolved by polling, it is not the best solution but works well

    Code:
    lastSent=0
    while 1:
    	timer.after(10)
    
    	smsSent=inbox.Inbox(inbox.ESent)
    	messages=smsSent.sms_messages()	
    
    	for msg in messages:
    		if lastSent == 0:
    			lastSent = msg
    		elif msg != lastSent:
    			lastSent = msg
                            # The user code for reading content, address and time was here
    		break
    I can't find another solution.
    Best Regards

    Eric.

Similar Threads

  1. How to read SMS using AT commands
    By rajuk_2004 in forum General Messaging
    Replies: 7
    Last Post: 2009-04-23, 07:23
  2. Replies: 5
    Last Post: 2009-02-20, 12:23
  3. How to read raw SMS body (8-bit encoding) from the Inbox
    By gufiak in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2009-01-30, 09:00
  4. socket read hangs until socket is closed
    By camroe in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-07-21, 09:44
  5. Read class Zero SMS (via RS232)
    By Vir@s in forum General Messaging
    Replies: 1
    Last Post: 2005-02-02, 08:15

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×