×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    101

    Help me with this code..

    Hi everyone, My application needs to connect to a Bluetooth device, but my following Pys60 code for my phone, always select a device and enter a code. How can I automatically connect to my device without needing to select device and enter code?
    this is the code I'm using in connecting to my micro controller with Bluetooth module..
    Code:
    import inbox,e32, camera, appuifw, key_codes, graphics
    import socket,messaging  
    
    
    def bt_connect():
        global sock
        sock=socket.socket(socket.AF_BT,socket.SOCK_STREAM)
        target=''
        if not target:
            address,services=socket.bt_discover()
            print "Discovered: %s, %s"%(address,services)
            if len(services)>1:
                import appuifw
                choices=services.keys()
                choices.sort()
                choice=appuifw.popup_menu([unicode(services[x])+": "+x
                                            for x in choices],u'Choose port:')
                target=(address,services[choices[choice]])
            else:
                target=(address,services.values()[0])
        print "Connecting to "+str(target)
        sock.connect(target)
        return
    Appreciate any help,
    picuser

  2. #2
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: Help me with this code..

    In your program you set the choices for the user to select a particular port during the runtime, remove it.
    Otherwise set the address port same in your program.

    Best regards,

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    101

    Re: Help me with this code..

    Quote Originally Posted by rahulvala View Post
    In your program you set the choices for the user to select a particular port during the runtime, remove it.
    Otherwise set the address port same in your program.

    Best regards,
    Hi, I got it to work thanks for the info.

    regards,
    picuser

Similar Threads

  1. Replies: 2
    Last Post: 2010-06-23, 11:33
  2. [defect report] carbide.cpp code formatter can't produce code conforming to s60 style
    By simo.salminen in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2008-10-27, 10:56
  3. acu error code -104011, state code -6 VPN Policy server
    By leyoo in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 2
    Last Post: 2008-09-05, 07:16
  4. Replies: 3
    Last Post: 2007-01-18, 11:27
  5. Replies: 0
    Last Post: 2003-09-26, 15:07

Posting Permissions

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