| Reply | « Previous Thread | Next Thread » |
|
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) |
|
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 |
|
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 |
|
Quote:
|
|
Quote:
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. |
|
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 :-) |
|
Quote:
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.
|
|
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 | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Rate This Thread | |
| 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 |