Am Sonntag 26 November 2006 09:07 schrieb Gál László:
> Is there an openobex for win project yet?
> If not, I am about to port openobex for windows, with bluetooth (with
> win api instead of bluez),
> usb and inet enabled. Is there any chance to succeed? All help welcome.

Yes, it is possible and I was about doing it, too. I do not run any Windows 
currently, though.
Bluetooth is definitely possible with the Microsoft Bluetooth Stack (widcomm 
possibly not). You can even cross-compile the result (e.g. from Linux) with 
mingw32 and the win32api add-on. You need 4 files from the Platform SDK for 
that:
-rwx------ 1 hendrik hendrik 49027 2005-04-14 18:54 BluetoothAPIs.h
-rwx------ 1 hendrik hendrik 41412 2005-04-14 18:54 bthdef.h
-rwx------ 1 hendrik hendrik  2523 2005-04-14 18:54 bthsdpdef.h
-rwx------ 1 hendrik hendrik 11433 2006-02-28 15:32 ws2bth.h

I'd rather see the functions that use "struct sockaddr" or "bdaddr_t" 
undefined in obex.h if other headers that define those are not included 
before obex.h is included. That would also get rid of that nasty:
#ifdef _WIN32
#include <winsock.h>
#else
#include <sys/socket.h>
#endif
#ifndef SOL_RFCOMM
typedef char* bdaddr_t;
#endif
Both are just hacks and winsock.h is even wrong on systems with bluetooth (on 
others it may be correct, e.g. Win9x).
I just don't know if changes to do that would be accepted for openobex-1.4.

Some name translations (bluez -> winbt) must be done by the application:
----------- winbt_bluez_compat.h --------------
#include <windows.h>
#include <winsock2.h>
#include <ws2bth.h>

#define bdaddr_t BTH_ADDR
#define sockaddr_rc _SOCKADDR_BTH
#define rc_family addressFamily
#define PF_BLUETOOTH PF_BTH
#define AF_BLUETOOTH PF_BLUETOOTH
#define BTPROTO_RFCOMM BTHPROTO_RFCOMM

//more here
---------------------------------------------
The return value of socket() must be check against  INVALID_SOCKET instead 
of -1.

For further hints:
http://scmxx.svn.sourceforge.net/viewvc/scmxx/trunk/scmxx/src/scmxx/tty_bluetooth.c?revision=545
(everyhthing masked by WINDOWS_API and WINDOWS_BLUETOOTH_API)
Not pretty but you can get the bits from it ;)
It implies that send()/recv() is used instead of write()/read() on the 
resulting socket!

HS

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to