You Are Here:

Community: Developer Discussion Boards

#1 Old Bluetooth OBEX - 2006-08-05, 12:00

Join Date: Jan 2006
Posts: 8
sammachin
Offline
Registered User
I'm trying to write a scrip thtat will receive a file via OBEX (eventually from my SU-1B) I think I've managed to get it running I can see the advertised service (OBEX2) on my PC but whe I send a file it always goes to the inbox.

Do i need to disable the normal OBEX listener first? IF so How????

Code attached :-) TIA

##############################
#obex receive script, Sam Machin 05/08/2006
from socket import *
s = socket(AF_BT, SOCK_STREAM)
f = u'C:\\receive'

#setup port
port = bt_rfcomm_get_available_server_channel(s._sock)
s.bind(("", port))

# advertise sockets ,et to AUTH
bt_advertise_service( u"OBEX2", s._sock, True, OBEX )
set_security(s._sock, AUTHOR)

# listen to socket
print("starting listening on Port: " + str(port))
s.listen(1)
print("waiting for connection...")

#accept connection request
myConnection, adress = s.accept()
print("connected to: " + adress + ", " + str(port))

#Recieve The File
bt_obex_receive(s, f)
Reply With Quote

#2 Old Re: Bluetooth OBEX - 2006-08-07, 16:58

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
What phone do you have? What version of PyS60?

What Bluetooth stack do you use on your PC? There are significant differences between stacks. How do you try to send the file over? Your PC could be sending the file to the standard OBEX file transfer service instead of the nonstandard one.

Also, don't need to use listen and accept with OBEX receives. See this example:

http://www.mobilenin.com/pys60/resources/obex_server.py
Reply With Quote

#3 Old Re: Bluetooth OBEX - 2006-08-08, 17:37

Join Date: Jan 2006
Posts: 8
sammachin
Offline
Registered User
Thanks for that,
I`ve now got it working with a little test script that sends a file to a port on the device, I`m running on a pair of 6680`s with S60Python 1.3.1.

Problem I now have is getting it to work with my SU-1B, the pen seems to prefer to send to the phones pre-existing OBEX port not the new one created by my script. I have had it working very occasioanlly by playing about with combinations of disabling bluetooth on teh phone first then re-pairing etc. But its far from relaiable. Any ideas how I can stop the phones standard OBEX reciever working??

Or is there any way I could grab the image out of the inbox once its been received, a bit like the sms inbox command but for messages received by bluetooth???

TIA
Sam
Reply With Quote

#4 Old Re: Bluetooth OBEX - 2006-08-09, 09:49

Join Date: Dec 2004
Posts: 646
jplauril's Avatar
jplauril
Offline
Forum Nokia Expert
Quote:
Originally Posted by sammachin
Or is there any way I could grab the image out of the inbox once its been received, a bit like the sms inbox command but for messages received by bluetooth???
Possibly by hacking the inbox module, if you're brave enough to dig into Symbian C++.
Reply With Quote

#5 Old Re: Bluetooth OBEX - 2006-08-09, 10:05

Join Date: Sep 2003
Posts: 209
Location: Finland
otsov
Offline
Regular Contributor
Quote:
Originally Posted by sammachin
Or is there any way I could grab the image out of the inbox once its been received, a bit like the sms inbox command but for messages received by bluetooth???
The device inbox is located at "c:\system\mail" (or under e:\, depends on your settings), you can iterate over it with normal file operations. Note that you can most probably corrupt the whole directory hierarchy by modifications so be careful.

Note that this will not work on 3rd Edition devices as the device inbox location is data caged and not accessible without certain capabilities. For 3rdEd the suggested addition to PyS60 "inbox" extension is needed.
Reply With Quote

#6 Old Re: Bluetooth OBEX - 2006-08-09, 11:46

Join Date: Jan 2006
Posts: 8
sammachin
Offline
Registered User
Thanks for the responses guys, dont think trying to parse the inbox is going to be that easy for me, plus how would you know when a message has arrived.

Hacking the inbox module would seem like the best option but its too bigger task for me, I've never done any C++. Any volunteers???

I'm going to persist with the bluetooth obex from python as I have had it working intermittently. I think I need to get the SU-1B pen to pair directly with the python app.

2 things I need for this:

Is there any way to answer a pair request in python, you put the pen into pairing mode and it starts searching then connects to a phone and asks for the passcode.

I also believe I need to offer a DUN service as the pen issues some AT commands, I found this code via google whcih looks like its on the right lines but I can't quite see how to port it to S60
http://times.usefulinc.com/legacy/2004/06/pair-su1b.py

TIA
Sam :-)
Reply With Quote

#7 Old Re: Bluetooth OBEX - 2006-11-14, 21:34

Join Date: Aug 2004
Posts: 14
bhima
Offline
Registered User
Quote:
Originally Posted by sammachin
I'm going to persist with the bluetooth obex from python as I have had it working intermittently. I think I need to get the SU-1B pen to pair directly with the python app.

2 things I need for this:

Is there any way to answer a pair request in python, you put the pen into pairing mode and it starts searching then connects to a phone and asks for the passcode.

I also believe I need to offer a DUN service as the pen issues some AT commands, I found this code via google whcih looks like its on the right lines but I can't quite see how to port it to S60
You pair with a device, not a service. Pairing happens before either end really has any concept of a service.

Once they're paired, the pen does an SDP (service discovery protocol) request, to find out what services are offered.

That's where, I believe, things are going wrong. It finds two services that will work. I'm not sure how it chooses which one to use.

I haven't tested this out yet, but if you look at this document:
http://partner.anoto.com/obj/docpart/441e86100fdff.pdf

...you'll find that creating an RFCOMM serial service named "ANOTO OBEX" may, in fact, solve your problem. I'm not sure - it may only work for PGC files, which aren't what you want unless you've decoded the PGC file format. PGC files contain raw, un-encrypted vector data for the strokes, and are thus extremely handy.

What I did just notice on my E70 is that Y-Browser can show me the attachments that are present in my Inbox - so, if I can figure out how to do that in Python, I can just poll every minute or two, and grab the PGC files, and upload them to my system.

EDIT: My first-pass attempt to use "ANOTO OBEX" as a service failed. I have Python code sitting and advertising it as a BT service, but the pen still sends even PGC documents to my Inbox. I tried re-pairing the pen with the phone, same result. I need a Linux box around to try with minimal BT services.

Also, I forgot to mention, the pairing script you mentioned won't really solve any problems. It's needed if your pen won't pair with your device - your phone _already_ responds with the right stuff to make the pen happy. In addition, you'll encounter the same problem you're already finding, where the pre-existing DUN server is likely to be chosen over yours, even if you did port it.

Making the ANOTO OBEX RFCOMM service work, or accessing the Inbox are your most likely solutions.
Last edited by bhima : 2006-11-14 at 21:44.
Reply With Quote

#8 Old Re: Bluetooth OBEX - 2008-05-06, 11:39

Join Date: Mar 2003
Posts: 564
cassioli's Avatar
cassioli
Offline
Super Contributor
is it possible for the phone to "intercept" OBEX received data before they're written to phone filesystem, to save time?
I mean, "grabbing" data directly from usb rather than reading a file after it has been created on phone by the system after receiving data from PC.
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
Bluetooth Profiles over Symbian OBEX jimdeal General Symbian C++ 2 2006-09-15 09:30
Can not send any Obex Objects to a billionton bluetooth hoy_cpe Symbian Networking & Messaging 3 2006-08-01 08:28
SyncML over OBEX and Bluetooth HWM OMA DM/DS/CP 13 2006-05-19 19:47
Bluetooth and OBEX example TD-A Mobile Java Networking & Messaging & Security 0 2005-06-29 18:51
Nokia 7650 support Bluetooth audo? ovjo12 Bluetooth Technology 5 2003-07-17 19:50

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