From: <svn...@op...> - 2009-04-15 12:30:56
|
Author: bellmich Date: Wed Apr 15 14:30:38 2009 New Revision: 1045 URL: http://libsyncml.opensync.org/changeset/1045 Log: committed patch from Henrik for ticket #228 Modified: trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/transports/obex_client.c trunk/libsyncml/transports/obex_client_internals.h trunk/libsyncml/transports/obex_server.c Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Wed Apr 15 14:08:41 2009 (r1044) +++ trunk/libsyncml/objects/sml_devinf_obj.c Wed Apr 15 14:30:38 2009 (r1045) @@ -29,7 +29,11 @@ #include <libsyncml/sml_command_internals.h> #include "libsyncml/sml_error_internals.h" +#ifdef WIN32 +#include <windef.h> +#else #include<sys/utsname.h> +#endif /* Design notice * @@ -371,6 +375,18 @@ smlDevInfSetModel(devinf, "libsyncml"); if (!smlDevInfGetOEM(devinf)) { +#ifdef WIN32 + smlDevInfSetOEM(devinf, "Windows"); + DWORD dwVersion = GetVersion(); + DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); + DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); + DWORD dwBuild = 0; + if (dwVersion < 0x80000000) dwBuild = (DWORD)(HIWORD(dwVersion)); + + char szVersion[1024]; + sprintf(szVersion, "%d.%d (%d)", dwMajorVersion, dwMinorVersion, dwBuild); + smlDevInfSetFirmwareVersion(devinf, szVersion); +#else struct utsname *buf = malloc(sizeof(struct utsname)); if (uname(buf) == 0) { @@ -378,6 +394,7 @@ smlDevInfSetFirmwareVersion(devinf, buf->release); } smlSafeFree((gpointer *)&buf); +#endif } if (!smlDevInfGetSoftwareVersion(devinf)) smlDevInfSetSoftwareVersion(devinf, VERSION); Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Wed Apr 15 14:08:41 2009 (r1044) +++ trunk/libsyncml/transports/obex_client.c Wed Apr 15 14:30:38 2009 (r1045) @@ -37,23 +37,27 @@ #endif #include <fcntl.h> +#ifndef WIN32 #include <sys/poll.h> #include <sys/stat.h> -#include <sys/types.h> #include <termios.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> - -#include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> +#include <netinet/in.h> +#endif + +#include <sys/types.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <netinet/in.h> #include <strings.h> +#ifndef WIN32 + static SmlBool obex_cable_at( SmlTransportObexClientEnv *userdata, const char *cmd, @@ -408,6 +412,8 @@ } +#endif + static void smlTransportObexClientEvent(obex_t *handle, obex_object_t *object, int mode, int event, int obex_cmd, int obex_rsp) { smlTrace(TRACE_ENTRY, "%s(%p, %p, %i, %i, %i, %i)", __func__, handle, object, mode, event, obex_cmd, obex_rsp); @@ -727,6 +733,7 @@ return FALSE; } +#ifndef WIN32 if (env->type == SML_TRANSPORT_CONNECTION_TYPE_SERIAL) { obex_ctrans_t cabletrans = { smlTransportObexClientCableConnect, @@ -735,9 +742,9 @@ smlTransportObexClientCableWrite, obex_cable_handleinput, env}; - OBEX_RegisterCTransport(env->obexhandle, &cabletrans); } +#endif smlTrace(TRACE_EXIT, "%s", __func__); return TRUE; @@ -978,6 +985,7 @@ smlTrace(TRACE_INTERNAL, "%s: IrDA connect done", __func__); } else { +#ifndef WIN32 struct termios tio; memset(&tio, 0, sizeof(tio)); @@ -1020,6 +1028,7 @@ goto error_unlock; } tcflush(fd, TCIFLUSH); +#endif } if (env->type != SML_TRANSPORT_CONNECTION_TYPE_USB @@ -1083,8 +1092,10 @@ error_transport_close: OBEX_Cleanup(env->obexhandle); error_unlock: +#ifndef WIN32 if (!lockf(fd, F_ULOCK, 0)) smlTrace(TRACE_ERROR, "%s: error_unlock failed.", __func__); +#endif error_close: close(fd); error: Modified: trunk/libsyncml/transports/obex_client_internals.h ============================================================================== --- trunk/libsyncml/transports/obex_client_internals.h Wed Apr 15 14:08:41 2009 (r1044) +++ trunk/libsyncml/transports/obex_client_internals.h Wed Apr 15 14:30:38 2009 (r1045) @@ -25,8 +25,10 @@ #include "obex_bluetooth.h" #include <openobex/obex.h> +#ifndef WIN32 #include <termios.h> #include <sys/ioctl.h> +#endif #define STREAM_CHUNK 4096 @@ -61,8 +63,9 @@ char *databuf; int *databuflen; int connected; +#ifndef WIN32 struct termios oldtio; - +#endif SmlBool busy; SmlBool error; SmlMimeType mimetype; Modified: trunk/libsyncml/transports/obex_server.c ============================================================================== --- trunk/libsyncml/transports/obex_server.c Wed Apr 15 14:08:41 2009 (r1044) +++ trunk/libsyncml/transports/obex_server.c Wed Apr 15 14:30:38 2009 (r1045) @@ -28,6 +28,7 @@ #include "obex_internals.h" #include "obex_server_internals.h" +#ifndef WIN32 #include <fcntl.h> #include <sys/poll.h> #include <sys/stat.h> @@ -36,6 +37,7 @@ #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> +#endif static gboolean _dispatch_obex(gpointer data) { |