You Are Here:

Community: Developer Discussion Boards

#1 Old problem? - 2008-08-19, 08:56

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
hi
i m writing small app
my code is:



Code:
import inbox, e32, appuifw, switchoff


def quit():
    app_lock.signal()
    appuifw.app.exit_key_handler=quit
app_lock=e32.Ao_lock()
code=(u'shutdown')
def cb(id):
    i=inbox.Inbox()
    id=i.sms_messages()[0]
    x = i.content(id)
    if x == code + u't'  # t = time (t=6 T=15 etc.)
        e32.ao_sleep(t)  # i wanna wait t seconds
        switchoff.Shutdown()
        i.delete(id)
        switchoff.Shutdown()
        



i=inbox.Inbox()

i.bind(cb)

app_lock.wait()

and i send sms to my phone shutdown6 but my app is no worknig
Reply With Quote

#2 Old Re: problem? - 2008-08-19, 09:22

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
PLS HELPPPP
Reply With Quote

#3 Old Re: problem? - 2008-08-19, 09:54

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
[code]
code=(u'shutdown')
def cb(id):
i=inbox.Inbox()
id=i.sms_messages()[0]
x = i.content(id)
if x == code + u't' # t = time (t=6 T=15 etc.)
e32.ao_sleep(t) # i wanna wait t seconds
switchoff.Shutdown()
i.delete(id)
switchoff.Shutdown()
Hello Mr. Eagle,

Why do you need those brackets ?

Anyway it should work either ways
Code:
code=u"shutdown"
The problem is in the statement:

Code:
if x == code + u't'
So your x i.e. the sms content will never be equal to code + u't' or "shutdownt" as you are sending "shutdown" followed by a number and not "t"

You need to modify your code. And you need to manipulate your text sms string to separate "t" and use it as an integer.

t=int(t) would also be required before you call the delay !

Hope that helps,

Best Regards,
Croozeus
Reply With Quote

#4 Old Re: problem? - 2008-08-19, 10:26

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by croozeus View Post
Hello Mr. Eagle,

Why do you need those brackets ?

Anyway it should work either ways
Code:
code=u"shutdown"
The problem is in the statement:

Code:
if x == code + u't'
So your x i.e. the sms content will never be equal to code + u't' or "shutdownt" as you are sending "shutdown" followed by a number and not "t"

You need to modify your code. And you need to manipulate your text sms string to separate "t" and use it as an integer.

t=int(t) would also be required before you call the delay !

Hope that helps,

Best Regards,
Croozeus
can u add t=int(t) into my code. i cant add it
Reply With Quote

#5 Old Re: problem? - 2008-08-19, 10:50

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post
can u add t=int(t) into my code. i cant add it
Why you can't ?

Here you are,
Code:
def cb(id):
    i=inbox.Inbox()
    id=i.sms_messages()[0]
    x = i.content(id)
    t= int(x[8:9])
    if x[0:8]== code:
        e32.ao_sleep(t) 
        switchoff.Shutdown()
        i.delete(id)
        switchoff.Shutdown()
Best Regards,
Croozeus
Reply With Quote

#6 Old Re: problem? - 2008-08-19, 10:53

Join Date: May 2007
Posts: 2,738
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Quote:
Originally Posted by cool_eagle View Post

Code:
    if x == code + u't'

Btw, you had forgot the colon in the statement above

Code:
    if x == code + u't' :
Best Regards,
Croozeus
Reply With Quote

#7 Old Re: problem? - 2008-08-19, 11:10

Join Date: Dec 2007
Posts: 409
Location: Tempe, AZ
Send a message via Yahoo to shubhendra Send a message via Skype™ to shubhendra
shubhendra's Avatar
shubhendra
Offline
Forum Nokia Champion
Instead you can also use regular expression as it will make your job much easier.

Code:
import re
y=re.compile('shutdown[0-9]') # Include range convinent to you
if y.match(abc):              # To compare with the sms you have sent
    print abc


IDEAS is all they need but still they think only Genius can give them that.
Reply With Quote

#8 Old Re: problem? - 2008-08-19, 11:22

Join Date: Aug 2008
Posts: 148
cool_eagle
Offline
Regular Contributor
Quote:
Originally Posted by shubhendra View Post
Instead you can also use regular expression as it will make your job much easier.

Code:
import re
y=re.compile('shutdown[0-9]') # Include range convinent to you
if y.match(abc):              # To compare with the sms you have sent
    print abc
can u give me an example
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with eglSwapBuffers and heap corruption greatape Symbian Media (Graphics & Sounds) 2 2007-05-24 04:35
netcards - Problem with opening adapter kernj Symbian Tools & SDKs 5 2007-01-10 09:56
WAP service problem on Apache bigg_o Browsing and Mark-ups 3 2005-04-17 17:05
Problem: S60 SDK for CW in PC with .NET anttij Carbide.c++ IDE and plug-ins 1 2005-02-28 12:36
wireless problem sash_mca General Browsing 0 2003-06-06 12:34

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia