Namespaces
Variants
Actions

Archived:How to take a picture and send it over Bluetooth using PySymbian

Jump to: navigation, search
Archived.png
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.
Article Metadata

Tested with
Devices(s): Nokia N96

Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition

Article
Keywords: camera
Created: giaperrucci (07 Jun 2007)
Last edited: hamishwillee (08 May 2013)

Contents

Overview

This Python code shows how to take a picture and send it using Bluetooth (OBEX). The script uses camera, e32, socket and graphics modules.

Code Snippet

# import modules
import appuifw, camera, e32
from graphics import *
from socket import *
 
# Create menu
def main_menu():
appuifw.app.menu=[(u"Take photo", take_picture),
(u"Send", Send),
(u"Exit",app_exit)]
# Application body
appuifw.app.body=canvas=appuifw.Canvas()
 
# Function for the viewfinder
def vf(im):
appuifw.app.body.blit(im)
 
# Start viewfinder
camera.start_finder(vf)
 
# Function for taking the picture
def take_picture():
# Take the photo
photo = camera.take_photo('RGB', (1024, 768))
# Save it at maximum quality
photo.save(u"e:\\photo.jpg", quality = 100)
# Stop the viewfinder
camera.stop_finder()
# Display image
canvas.blit(photo)
 
# Function to send Image
def Send():
file=(u'e:\\photo.jpg')
device=bt_obex_discover()
address=device[0]
channel=bt_obex_discover(address)[1][u'OBEX Object Push']
bt_obex_send_file(address,channel,file)
 
def app_exit():
camera.release() #Release the camera so other applications may use it
appuifw.app.set_exit()
 
lock=e32.Ao_lock()
appuifw.app.title=u"BT example"
main_menu()
lock.wait()

Screenshots

The following screenshots are the outcome.

Example5-1.jpgExample5-2.jpg Example5-3.jpgExample5-4.jpg

Related Links

This page was last modified on 8 May 2013, at 14:28.
208 page views in the last 30 days.
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