Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Trying to locate an official api of this library, however to no avail. I reckon there is a quick way of doing it yourself, but I rather check first if there already exsists one.
Currently figuring out obexftp, however, it's hard to see what the different functions do if you don't have the api right in front of you.
Christian W. Zuckschwerdt
There are some examples in the wiki, e.g.
A little more info is in obexftp/client.h.
The HTML developer docs are still WIP, sorry.
Hmm... are there any examples for how to listen for a incomming request/transmission etc?
For example, a server waiting for a connection from a bluetooth device.
So far I've done a combo of Bluez for the sdp and obexftp for the file transfer from laptop to btd.. WIP I guess.
Meh, I'm getting the sense that obexftp can't pull data..
Christian W. Zuckschwerdt
The obexftp-0.22 (pre-release) offers simple sdp wrappers. Version 0.23 will offer a server API to complement the client API.
Heck, call me stupid. But where do I read about this sdp wrapper? And can obexftp receive data from a phone? If obexftp can receive data, how do you setup the listning part?
Btw, any eta on the 0.23? Would be very nifty to have =D
Just posted this though on the Bluez mailing list:
I'm been trying to develop a bluetooth software that can send and receive data from a server - client view. I'm doing the development in PyBluez (might have to change it if something else supports all the operations i need to do).
I want to create sort of an interactive bluetooth service, where the user operates the bluetooth device to interact with a server to get information. The data excahnged between the sides is either text or a image. My biggest problem is to be able to send data back and forth.
I've been looking at obexftp, however that library seems (to me at least) to only support push operation and not pull. I can't figure out how to send something from for example to my phone (client) and to my laptop (aka the server) and back.
I've been looking at the source code from several known programs, however, they confuse me more than help (due to the lack of comments ..).
I'm using bluez for the sdp query, mostly due to the fact I can't see anything similar in obexftp. Obexftp just detects devices as far as I can see (correct me if I'm wrong)
I know this is the mailing list for Bluez, I dunno how much you've been into obexftp. Any insight in the matter would anyway be quite nice.
The code I've written so far is:
## This example is a combo of what you may find at
## the bluez and the obexftp homepage..
SVC_HOST = 0
SVC_PROTOCOL = 1
SVC_PORT = 2
SVC_SERVICE_ID = 3
## Locates the bluetooth devices nearby and returns the
## the list of devices to locate_services
target_address = None
target_name = None
# doing a sdp query (to put it bluntly
nearby_devices = bluetooth.discover_devices()
for bdaddr in nearby_devices:
target_name = bluetooth.lookup_name(bdaddr)
print "Discovered: %s" % target_name
## Locates the services depending wheter there are
## are any devices nearby by using Bluez
## Might be done by obexftp, however obexftp does not
## indicate afaik the port
bt_devices = 
print "Searching for services.."
# Locate all the bluetooth devices in the area
btd = locate_btd()
if btd == None:
print "length of btd: %d" % len(btd)
for target in btd: services = bluetooth.find_service(address=target)
if len(services) == 0:
print "The device does not have the required service: %s" % bluetooth.lookup_name(target)
print " ----------------------------------- "
for svc in services:
if svc["name"] == "OBEX Object Push":
print "Found Required Service on Bluetooth Device"
print "____________________________________ "
print "Service Name: %s" % svc["name"]
print " Host: %s" % svc["host"]
print " Hostname: %s" % bluetooth.lookup_name(target)
print " Description: %s" % svc["description"]
print " Provided By: %s" % svc["provider"]
print " Protocol: %s" % svc["protocol"]
print " channel/PSM: %s" % svc["port"]
print " svc classes: %s "% svc["service-classes"]
print " profiles: %s "% svc["profiles"]
print " service id: %s "% svc["service-id"]
print ":::::::::::::::::::::::::::::::::::: "
# STORES THE DEVICES THAT HAS THE REQUIRED SERVICES
bt_devices.append((svc["host"], svc["protocol"], svc["port"], svc["service-id"]))
# Broadcast the bt device has been spotted
data_message = "You have been spotted by a bluetooth service detector"
i = 0
## just broadcasting after detecting devices..
while i < len(bt_devices):
client = obexftp.client(obexftp.BLUETOOTH)
if (client.connectpush(bt_devices[i][SVC_HOST], bt_devices[i][SVC_PORT])) != 1:
print "Could not send data to %s", bt_devices[i][SVC_HOST]
# can't use put_file() for some reason...
# must add extension to make it, hence the .txt at the end
if (client.put_data(data_message, "INFO.txt")) != 1:
print "error: breaking" i = i + 1
## Need to know wheter the service the clients provides
## supports the obex service...
# Are there any services
bt_devices = locate_services()
i = 0
# trying to connect
while i < len(bt_devices):
if bt_devices[i][SVC_PROTOCOL] != 'RFCOMM': print "The device %s has a mismatching protocol %s" % (bt_devices[i][SVC_HOST], bt_devices[i][SVC_PROTOCOL])
i = i + 1
Okay, so far I've figured out i need a texting program on the phone itself. Plus I need to figure out how I can receive files from a client upon request.
Any ideas, would be nice...
Christian W. Zuckschwerdt
If I get this right, this is what you want:
1) a client (phone, probably j2me midlet) to browse and upload/download
2) a server (linux box) supporting the above
If you are interested, obexftpd can do (2) and I once wrote a midlet doing (1).
http://zuckschwerdt.org/blueload/ -- most likely it needs an overhaul.
Close, but not entirely.
I'm creating a information service based on a bluetooth piconet. Where the clients connects and needs to use a text editor or a program that can create *.txt files which it sends to the server. The server prosses the text file from the client, and delivers a counterresponse.
1. A text editor that be used on most cellphones (would be nice if it had a send option too). Browsing is not needed. The reason why I need a text editor is mostly due to the fact that you can't send a sms directly through the bluetooth.
2. A server that can receive the messages as they come.
A J2ME Midlet text editor with BT OBEX send option should be straight forward.
For the server I'd recommend the nice and flexible sobexsrv.
btw: obexftp is the client part. obexftpd is a server.
I have little or no knowledge about J2ME, so the "A J2ME Midlet text editor with BT OBEX send option should be straight forward." feels like way over my head at the moment.
Obexftpd is a package or a program?
Well there is little choice when you want apps to run on the majority of phones. I'd say you need to learn Java and J2ME programming or get someone to do it for you.
The obexftpd server application is included with ObexFTP-0.22.
Also ObexFTP runs on Win32. http://triq.net/obexftp/obex-win32.zip use the static obexftpd.exe for quickest results.
Btw, how do you use obexftp for the server part?
Might sound like a weird question I know, but I think there is a obexftpd you can run. Sitting in Windows at the moment, so I can't check.
so it will be like
No, obexftpd is not what I am looking for. The obexftpd is a filesharing server, what I'm looking for is a way to let the server get the text directly from the client.
message = parse_text(text_data)
Realized Obexftp, though it has some functionality, it isn't what I'm looking for.
I think I have to use OpenObex, but the thing with OpenObex, is it's poorly documented usage. I'm having a hard time figuring out how it works. Been looking at the obexftp source without getting any real clue what to do.
On making obexftp-0.22 these errors appear :
obexftpd.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
obexftpd.c: In function ‘start_server’:
obexftpd.c:891: warning: implicit declaration of function ‘BtOBEX_ServerRegister’
obexftpd.c:891: error: ‘bt_src’ undeclared (first use in this function)
obexftpd.c:891: error: (Each undeclared identifier is reported only once
obexftpd.c:891: error: for each function it appears in.)
make: *** [obexftpd.o] Error 1
make: Leaving directory `/root/Desktop/obexftp-0.22/apps'
make: *** [all-recursive] Error 1
make: Leaving directory `/root/Desktop/obexftp-0.22'
make: *** [all] Error 2
How can these be avoided .