×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    15

    Simple Bluetooth Chat

    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

  2. #2
    Nokia Developer Champion
    Join Date
    Jul 2008
    Location
    Pakistan
    Posts
    1,065

    Smile Re: Simple Bluetooth Chat

    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

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    15

    Re: Simple Bluetooth Chat

    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 15:26.

  4. #4
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    71

    Re: Simple Bluetooth Chat

    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

Similar Threads

  1. Develop Chat Application Using Bluetooth
    By curlyjoe in forum Bluetooth Technology
    Replies: 13
    Last Post: 2010-01-22, 22:17
  2. Bluetooth Chat
    By anandpraveen in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2007-06-27, 06:13
  3. Simple Bluetooth Connection
    By laan in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2006-08-14, 08:40
  4. Simple question about bluetooth
    By rambler82 in forum Symbian
    Replies: 5
    Last Post: 2006-07-21, 10:28
  5. Simple sample of bluetooth program for MIDP 2.0?
    By zhihui in forum Bluetooth Technology
    Replies: 0
    Last Post: 2005-06-27, 07:02

Posting Permissions

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