×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    103

    Problems regarding bt_advertise_service

    I´m developing a application that must advertise a service through RFCOMM using socket library. My phone model is a N95 running python 1.4.4

    Here´s the code:

    Code:
    import appuifw 
    import socket
    
    class Dispositivo:
        def __init__(self):
            self.location = None # local em que se encontra o dispositivo
    
        def IniciarServico(self):
            self.server = socket.socket(socket.AF_BT, socket.SOCK_STREAM)
            p = socket.bt_rfcomm_get_available_server_channel(self.server)
            self.server.bind( ("", p) )
            self.server.listen( 1 )
            try:
                socket.bt_advertise_service( u"btpos", self.server, True, socket.RFCOMM )
            except:
                print "Error"
            socket.set_security(self.server, socket.AUTH)        
            connection, client_addr = self.server.accept()
    
        def ReceberLocalizacao(self):
            pass
        
        def Sair(self):
            self.server.close()
            
    App = Dispositivo()
    App.IniciarServico()
    appuifw.app.exit_key_handler = App.Sair()
    The program seems to run ok because all the 'standart' services are found such as Hands-Free, Audio Source and others, but the service I advertised couldn´t be found by the desktop application. I'm using the pybluez library. I have alse tried the code available at http://www.mobilenin.com/pys60/resou...comm_server.py, but still I wasn't able to locate the service. The code I tried is below:

    Code:
    import bluetooth
    
    list_service = bluetooth.find_service()
    
    for devices in list_service:
    	host = devices['host']
    	owner = bluetooth.lookup_name(host)
    	name = devices['name']
    	describe = devices['description']
    	print owner,"",name,"","",describe
    What am I missing here?
    Wiki Contributor of the Month (May).
    Winner of the May Contest on Wiki.

  2. #2
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    103

    Re: Problems regarding bt_advertise_service

    Anyone...?
    Wiki Contributor of the Month (May).
    Winner of the May Contest on Wiki.

  3. #3
    Regular Contributor
    Join Date
    Mar 2007
    Location
    Brazil
    Posts
    103

    Re: Problems regarding bt_advertise_service

    Somehow, the service was found when tested using Widcomm drivers on Windows. But still not been found on Linux... weird.
    Wiki Contributor of the Month (May).
    Winner of the May Contest on Wiki.

  4. #4
    Regular Contributor
    Join Date
    Aug 2008
    Posts
    87

    Re: Problems regarding bt_advertise_service

    I am also suffering from same problem. But couldn't find a proper answer here. If you find the answer please reply.

Similar Threads

  1. Problems about maemo 4.0.1 SDK installation.
    By fgg_maemo in forum General Development Questions
    Replies: 3
    Last Post: 2008-10-07, 14:26
  2. CTelephony Problems in N73
    By saji_iq in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-02-07, 07:57
  3. Several problems with NMIT 4.1 MMS
    By jtalviva in forum General Messaging
    Replies: 0
    Last Post: 2006-03-10, 11:03
  4. Several problems with NMIT 4.1
    By jtalviva in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2006-03-10, 10:59

Posting Permissions

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