×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    71

    Discovering Devices on mobile does not works

    Heloo all,
    I am facing a problem that when I installed small program which is discovering devices on Nokia N73 error ocurres said that the no module named bluetooth !!!!how the discovery will work then.and I think that N73 is new and it should have all the modules installed am I right or not
    so please could any one tell me what I should do???
    I didnot installe the program as sis file but as py file after I installed the shell and the runtime files and I have tried some other programs that works but this didnot work
    thank you

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Discovering Devices on mobile does not works

    Quote Originally Posted by programer_asal View Post
    I am facing a problem that when I installed small program which is discovering devices on Nokia N73 error ocurres said that the no module named bluetooth !!!!
    And it's right. There is no module named "bluetooth". "socket" is the closest thing.

    Quote Originally Posted by programer_asal View Post
    how the discovery will work then.
    From the PyS60 Library Reference, the "socket" section:

    bt_discover([address])
    Performs the Bluetooth device discovery (if the optional BT device address is not given) and the discovery of RFCOMM class services on the chosen device. Returns a pair: BT device address, dictionary of services, where Unicode service name is the key and the corresponding port is the value.
    Quote Originally Posted by programer_asal View Post
    and I think that N73 is new and it should have all the modules installed am I right or not
    It's not that new. Nokia N73 was announced (and launched I think) in 2006. But it doesn't matter how new it is. All PyS60 modules are usually avaiable across an entire Edition (S60 2nd Edition, 3rd Edition etc.)

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

    Re: Discovering Devices on mobile does not works

    Thank you a lot Mr.bogdan.galiceanu
    but I have tried
    bt_discover on the emulator and on the IDEL and it said that NameError: name 'bt_discover' is not defined
    what should I do??
    and I have tried this code for discovering in the IDEL with the bluetooth module and it works can not I use it on mobile????
    import bluetooth
    discover_devices = bluetooth.discover_devices()
    thank you again

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

    Re: Discovering Devices on mobile does not works

    Thank you a lot Mr.bogdan.galiceanu
    but I have tried
    bt_discover on the emulator and on the IDEL and it said that NameError: name 'bt_discover' is not defined
    what should I do??
    and I have tried this code for discovering in the IDEL with the bluetooth module and it works can not I use it on mobile????
    import bluetooth
    discover_devices = bluetooth.discover_devices()
    thank you again

  5. #5
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Discovering Devices on mobile does not works

    I wasn't talking about IDLE, if that's what you mean by IDEL. Just because something is available in standard Python doesn't necessarily mean it's available in Python for S60 or the other way around. I for one can't import the "bluetooth" module in IDLE...
    Last edited by bogdan.galiceanu; 2009-05-10 at 16:38.

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

    Re: Discovering Devices on mobile does not works

    I tried it now on the mobile and the same problem occure
    so what ??
    see what I have written

    import socket
    discover_devices = bt_discover()
    for devices in discover_devices:
    print bluetooth.lookup_name( devices )


    thanks

  7. #7
    Super Contributor
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Discovering Devices on mobile does not works

    That's because you have to specify the module that contains the function bt_discover.
    Code:
    discover_devices = socket.bt_discover()
    And unless you downloaded and installed some module named bluetooth and haven't said anything about it I don't see how "print bluetooth.lookup_name( devices )" can work.

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

    Re: Discovering Devices on mobile does not works

    thank you soooooooooooooooooooooooooooo much Mr.bogdan.galiceanu
    the code actually works now

  9. #9
    Registered User
    Join Date
    Apr 2009
    Posts
    10

    Re: Discovering Devices on mobile does not works

    I have tried this example (using both my N95 and E71) and although I see the "Discover bluetooth devices" dialogue, as soon as a choose one of the selections, the Python interpreter quits Is this a known problem, or am I doing something wrong?

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

    Re: Discovering Devices on mobile does not works

    hi Mr.benjeee
    the code just allow you to discover devices as I think ,it does not allow you to choose one and send some thing to him ,I guss there may be some events that allow you to do so. I am trying to that now
    one more thing to let you know I have written after this code the code of connection and it works when you run the program it will show you list of users and after you choose one it will perform the other steps on your program unless you make some event that do something when choosing one user. this is what I have and am not sure of it because am not Professional am just a novice if there are any correction I wish that the Professional on this fourm tell us

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

    Re: Discovering Devices on mobile does not works

    Hello all again I know that I ask a lot but I need your help
    can I ask you when we use
    discover_devices = socket.bt_discover()
    it returns two things the addresses of devices and the services on each device ,and as you know executing this code show I dialog and show all discovered devices ,but I donot want that I want to make my own interface and display special devices not all this is my idea and my question now is there any function that you give it the address and it gives you the name of the device???!!!there is one called lookup_name but this needs the bluetooth module and I donot have only the socket module
    is there any function do so???!!
    thank you and sorry for taking your time

  12. #12
    Registered User
    Join Date
    Apr 2009
    Posts
    10

    Re: Discovering Devices on mobile does not works

    Hi again,

    I have come across an updated AoSocket library for S60 3rd gen devices (e.g. N95).
    Many examples of "automatic device discovery" or discovery without the popup dialogue box use an old version of AoSocket which is not compatible with newer phones.

    The new port of this required lib is called pyaosocket and can be found at:
    http://www.hiit.fi/files/fi/da/pdis/pyaosocket/web/

    However: There is absolutely no documentation for it! I think you just have to guess what functions it uses... I am trying to find it's service_discovery function, however have not yet found it!

    I have got it discovering bluetooth devices without the popup dialogue tho, here is some example code!

    Code:
    from pyaosocket import AoResolver
    
    self.clientTimer = e32.Ao_timer()
    self.clientLock = e32.Ao_lock()
    self.clientConnected = False
    self.currentlySearching = False
    self.resolver = AoResolver() # Bluetooth Reader
    self.count = 0
    self.cont = None
    
    # Callback run from Aosocket BT resolver
        def callBack(self, error, mac, name, dummy):
            if error == -25: # KErrEof (no more devices)
                print "no more"
                self.cont = None
            elif error:
                raise
            else:
                self.count += 1
                print repr([mac, name, self.count])
                self.cont = self.resolver.next
            self.clientLock.signal()
    
        # Search local bluetooth devices using AoResolver
        def btSearch(self):
            try:
                self.resolver.open()
                print u"Bluetooth Search Start"
                self.currentlySearching = True
                self.cont = lambda: self.resolver.discover(self.callBack, None)
                while self.cont:
                    self.cont()
                    self.clientLock.wait()
            finally:
                self.resolver.close()
                self.currentlySearching = False
    
            print u"Search done"

Similar Threads

  1. [announce] eBook Publishing for Mobile Devices
    By devguide.net in forum News and Announcements
    Replies: 0
    Last Post: 2008-12-22, 01:37
  2. Programming games for mobile devices
    By PheW33 in forum General Development Questions
    Replies: 4
    Last Post: 2008-08-23, 00:36
  3. Problem in discovering Bluetooth devices
    By anummiah in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2005-08-15, 13:24
  4. XSLT with mobile devices
    By phannon in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2005-06-07, 08:08
  5. Nokia Mobile VPN Client
    By marcyl in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-12-01, 14:47

Posting Permissions

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