| Reply | « Previous Thread | Next Thread » |
|
I tried to make an application that take a repetitive photo in certain period and there is also an option to send the photo command via sms.
everything works well, except the sms part. python wont allow me to use the Inbox module and everytime the program reached the 'teks = i.content(id)' line, it raised an error message saying something like "KerrAccessDenied" the code is as follows: Code:
import appuifw, e32
import camera
#import socket
from ftplib import FTP
from graphics import Image
import inbox
import messaging
import contacts
jalan = 1
img = Image.new((208,208))
teks = ''
i = None
i = inbox.Inbox()
global rxsms
rxsms = 0
global alamat
alamat = ''
global psn
psn = "Makacih dah ngirim sms ke sini"
def _raw_input(txt):
return appuifw.query( unicode( txt ), "text" )
def berhenti():
global jalan
jalan = 0
kunci.signal()
def ambil_nomor(alm):
db = contacts.open()
try:
global alamat
alamat = db.find(alm)[0].find('mobile_number')[0].value
except:
appuifw.note(u"si %s tidak punya nomor henpon!" % alm,"error")
def baca_sms(id):
e32.ao_sleep(0.1)
global teks, rxsms, alamat
teks = i.content(id)
if i.address(id)[0:1] == '+':
alamat = i.address(id)
else:
ambil_nomor(i.address(id))
alamat = i.address(id)
appuifw.note(u"sms content: " + teks , "info")
if teks == u"rxphoto":
rxsms = 1
def kirim_sms(nomor, pesan):
messaging.sms_send(nomor, pesan)
def handle_redraw(rect):
canvas.blit(img)
def aplod(gambar):
ftp = FTP('www.pradana-satyajaya.com')
ftp.set_pasv('true')
ftp.login('pradan03','teoteblung')
ftp.cwd('public_html/images')
F=open(gambar,'r')
ftp.storbinary('STOR rxradar.jpg',F,1024)
ftp.quit()
F.close()
def jalankan():
appuifw.note(u"Coba-coba bikin kamera otomatis", "info" )
e32.ao_sleep(1)
interval=int( _raw_input("Masukkan interval dalam detik: ") )
jeda=0
lokasi = (u"e:\\images\\roxtars\\radar.jpg")
global rxsms,psn
while jeda<>interval and jalan==1:
e32.ao_yield()
# coba preview foto
gbl = camera.take_photo(size=(640,480))
img.blit(gbl,target=(8,10,200,195),scale=1)
handle_redraw(())
e32.ao_yield()
# akhir preview foto
# coba pake sms interface
if rxsms == 1:
appuifw.note(u"Membalas sms ke %s" % alamat,"info")
try:
kirim_sms(alamat, psn)
except:
appuifw.note(u"Tidak bisa mbalas SMS","error")
rxsms = 0
alamat = ''
# akhir sms interface
e32.ao_sleep(1)
jeda+=1
while interval==jeda and jalan==1:
appuifw.note(u"Mengambil gambar", "info" )
data = camera.take_photo(size=(640,480))
appuifw.note(u"Menyimpan gambar", "info" )
data.save(lokasi)
e32.ao_yield()
appuifw.note(u"Mengunggah gambar", "info" )
aplod(lokasi)
appuifw.note(u"Selesai mengunggah gambar", "info" )
jeda = 0
def jalan_manual():
appuifw.note(u"Ini kamera dan upload manual", "info" )
e32.ao_sleep(1)
lokasi2 = (u"e:\\images\\roxtars\\radar.jpg")
data = camera.take_photo(size=(640,480))
data.save(lokasi2)
e32.ao_yield()
aplod(lokasi2)
canvas = appuifw.Canvas(redraw_callback=handle_redraw)
i.bind(baca_sms)
appuifw.app.body = canvas
#appuifw.app.screen = 'full'
appuifw.app.screen = 'large'
appuifw.app.title=u"Kameraku"
kunci = e32.Ao_lock()
appuifw.app.menu = [(u"Otomatis", jalankan),(u"Manual",jalan_manual),(u"Berhenti",berhenti)]
kunci.wait()
~azmi |
|
Where is ftplib.py?
-Pankaj Nathani ![]() |
|
croozeus,
you can find the ftplib.py at http://www.mobilenin.com/pys60/resources/ftplib.py |
|
Hello ululazmi
![]() I added that lib file and executed you code but...Its not clicking pictures also.. I have executed it on a phone with 2 camera's i.e 6680 ![]() |
|
Quote:
i used the code on my Nokia 5500 which has only a single camera and works, except the sms part. maybe you need to change the code to make it appropriate for your device which has 2 cameras. |
|
@ululazmi
Ya right.We have to add the code to specify the camera we are using...I tried your code on 7610 and its working.... |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Carbide.j 1.5 and Netbeans 5.5 beta 2 | ovjo12 | Mobile Java Tools & SDKs | 5 | 2007-06-11 06:43 |
| loading inbox module | sarathgopalr | Python | 4 | 2007-06-05 15:51 |
| strange behaviour with sm inbox module | novis | Python | 0 | 2007-05-03 23:23 |
| Adding read/unread status to Inbox module | iemorgan | Python | 2 | 2006-10-06 16:02 |
| No module named inbox | nibss | Python | 1 | 2006-05-31 01:14 |