You Are Here:

Community: Developer Discussion Boards

#1 Old Simple Bluetooth Chat - 2009-04-26, 20:54

Join Date: Apr 2009
Posts: 4
Sierran
Offline
Registered User
Hello. I have a question. How can i send and receive some bytes ? I wanna create chat via bluetooth. Now i write this code.

Code:
import appuifw
import e32
import sys
from btsocket import *
lock=e32.Ao_lock()
info = appuifw.InfoPopup()

class App():
	
	def __init__(self):
		appuifw.app.exit_key_handler=self.Exit
		self.pseudo = 0
		appuifw.app.menu=[(u"Listen", self.listen),
						(u"Connect", self.Connect),
						(u"Name", self.Name),
						(u"Exit", self.Exit)]

	def listen(self):
			print "Listen"
			if (self.pseudo == 0):
				info.show(u"Here is the tip.", (0, 0), 5000, 0, appuifw.EHRightVCenter)
			else:
				print "ok"
				print self.pseudo
				
				
	def Connect(self):
			print "OK"
                        disc = bt_discover()

	def Name(self):
			self.pseudo = appuifw.query(u"Enter you name", "text")
			print "OK"
			
	def Exit(self):
			print "OK"
			sys.exit(0)
			
appuifw.app.title=u"BT chat"
main_menu = App()
lock.wait()
Can Somebody help ?

Kamil Sampolski
Reply With Quote

#2 Old Smile Re: Simple Bluetooth Chat - 2009-04-26, 22:38

Join Date: Jul 2008
Posts: 471
Location: Pakistan
sajisoft's Avatar
sajisoft
Offline
Regular Contributor
Quote:
Originally Posted by Sierran View Post
Hello. I have a question. How can i send and receive some bytes ? I wanna create chat via bluetooth. Now i write this code.


Can Somebody help ?

Kamil Sampolski
I will recommend u to go through the source code written in python book for better understanding of sending and receiving message via bluetooth:
Bt Chat In Pys60
Hope it helps u..

Best Regards,
SajiSoft


"The purpose of software engineering is to control complexity, not to create it."

--§ajid Ali Anjum--
http://sajisoft.wordpress.com/
Reply With Quote

#3 Old Re: Simple Bluetooth Chat - 2009-04-26, 23:20

Join Date: Apr 2009
Posts: 4
Sierran
Offline
Registered User
Thank you i have only one problem "server = socket.socket(socket.AF_BT, socket.SOCK_STREAM)" It's old socket.. How i can it write with btsocket ?

Kamil Sampolski

Edit:

-------------

conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM) "module object has no atribute 'AF_BT'" Who can help me ?
Last edited by Sierran : 2009-04-27 at 16:26.
Reply With Quote

#4 Old Re: Simple Bluetooth Chat - 2009-04-28, 13:37

Join Date: Jan 2009
Posts: 71
programer_asal
Offline
Regular Contributor
Quote:
Originally Posted by Sierran View Post
conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM) "module object has no atribute 'AF_BT'" Who can help me ?
I have faced the same problem and after the members of this fourm helped me I did two things to over come this problem
first I get the last version whivh is PythonForS60_1_4_5_SDK_2ndEdFP2(2) from http://sourceforge.net/project/downl...zip&a=45221442
second I changed conn = socket.socket(socket.AF_BT, socket.SOCK_STREAM) to this
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
I wish that this help you,just to let you know I am novice and I told you what I knew it today
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
Develop Chat Application Using Bluetooth curlyjoe Bluetooth Technology 12 2008-04-18 13:28
Bluetooth Chat anandpraveen Symbian Networking & Messaging 4 2007-06-27 07:13
Simple Bluetooth Connection laan Mobile Java Tools & SDKs 4 2006-08-14 09:40
Simple question about bluetooth rambler82 General Symbian C++ 5 2006-07-21 11:28
Simple sample of bluetooth program for MIDP 2.0? zhihui Bluetooth Technology 0 2005-06-27 08:02

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