Archived:How to detect SMS in outbox in PySymbian
Archived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.
The article is believed to be still valid for the original topic scope.
The article is believed to be still valid for the original topic scope.
These code snippets are used to detect the SMS in the outbox using the inbox module in PySymbian.
Article Metadata
The two methods are as below
Method 1
#import inbox and messaging
import inbox
import messaging
#Body of the detecting function
def detect(id):
global outbox
outbox.delete(id)
# send msg again
outbox=Inbox(inbox.EOutbox)
outbox.bind(detect)
Method 2
#import inbox and messaging
import inbox
import messaging
outbox=Inbox(inbox.EOutbox)
# send msg code
# messages in outbox ?
if outbox.sms_messages() is not None:
# delete all outbox messages !
for m in outbox.sms_messages():
outbox.delete(m)
# send msg again


Cuijartija - Method 1 seem doesnt work !
I tested both methods and the metod 1 not work for me, however the method 2 works well, we can easily simulate the "event" in method 1 pooling the outbox.sms_messages() with a "while" instead "if", remember sleep between cicles !!!cuijartija 16:24, 22 October 2011 (EEST)
Hamishwillee - @Cuijartija - thanks for pointing that out
Hi Eric I've asked Pankaj (Croozeus) if he can heve a look at this. Thanks for taking the time to add corrections. Regards
Hhamishwillee 02:21, 26 October 2011 (EEST)
Croozeus - Making Method 1 work
Hi Cuijartija,
Yes, you need a time.sleep in the handler to avoid the race condition.
It is explained well here for the Inbox and should work likewise for the Outbox. http://www.developer.nokia.com/Community/Wiki/Python_on_Symbian/06._Telephony_and_Messaging#Receiving_Messages
Please let me know if it works, so we can add it here.
Thanks,
Pankaj.croozeus 14:46, 30 October 2011 (EET)