From: Hendrik S. <sat...@gm...> - 2006-11-26 17:32:50
|
Am Sonntag 26 November 2006 09:07 schrieb G=C3=A1l L=C3=A1szl=C3=B3: > 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= =20 currently, though. Bluetooth is definitely possible with the Microsoft Bluetooth Stack (widcom= m=20 possibly not). You can even cross-compile the result (e.g. from Linux) with= =20 mingw32 and the win32api add-on. You need 4 files from the Platform SDK for= =20 that: =2Drwx------ 1 hendrik hendrik 49027 2005-04-14 18:54 BluetoothAPIs.h =2Drwx------ 1 hendrik hendrik 41412 2005-04-14 18:54 bthdef.h =2Drwx------ 1 hendrik hendrik 2523 2005-04-14 18:54 bthsdpdef.h =2Drwx------ 1 hendrik hendrik 11433 2006-02-28 15:32 ws2bth.h I'd rather see the functions that use "struct sockaddr" or "bdaddr_t"=20 undefined in obex.h if other headers that define those are not included=20 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=20 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: =2D---------- 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 =2D-------------------------------------------- The return value of socket() must be check against INVALID_SOCKET instead= =20 of -1. =46or further hints: http://scmxx.svn.sourceforge.net/viewvc/scmxx/trunk/scmxx/src/scmxx/tty_blu= etooth.c?revision=3D545 (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=20 resulting socket! HS |