Dev
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- 637 discussions
Hi Michael,
anbei schicke ich dir eine patch reihe. Die patches beinhalten im wesentlichen die posix Implementierung in der libwlocate.
Ich habe es sowohl für Linux und Windows getestet.
Du kannst die patches über den Befehl git am --ignore-whitespace <patch file> hinzufügen nachdem du sie heruntergeladen hast.
Den ersten Patch solltest du mit git am --ignore-whitespace --scissors <patch file> anwenden um diese Nachricht nicht mit in der commitmessage zu haben.
Schöne Grüße
Tarek
-- >8 --
Signed-off-by: Jan-Tarek Butt <tarek(a)ring0.de>
---
master/connect.c | 532 +++++------
master/connect.h | 36 +-
master/iwlist.c | 962 ++++++++++----------
master/libwlocate.dsp | 254 +++---
master/libwlocate.dsw | 106 +--
master/libwlocate.sln | 62 +-
master/libwlocate.vcproj | 602 ++++++-------
master/locdemo/LocDemoApp.cpp | 92 +-
master/locdemo/LocDemoApp.h | 60 +-
master/locdemo/LocDemoWin.cpp | 1052 +++++++++++-----------
master/locdemo/LocDemoWin.h | 112 +--
master/locdemo/Makefile | 60 +-
master/locdemo/Makefile.QNX | 60 +-
master/locdemo/README | 34 +-
master/locdemo/locdemo.dsp | 222 ++---
master/locdemo/locdemo.dsw | 58 +-
master/locdemo/setup_data/LocDemo/DEBIAN/preinst | 16 +-
master/locdemo/setup_data/LocDemo/DEBIAN/prerm | 18 +-
master/locdemo/win_setup.nsi | 184 ++--
master/trace.dsp | 204 ++---
master/trace.dsw | 58 +-
master/wlan.c | 510 +++++------
master/wlan.h | 48 +-
23 files changed, 2671 insertions(+), 2671 deletions(-)
diff --git a/master/connect.c b/master/connect.c
index 4d91e34..793bdd2 100755
--- a/master/connect.c
+++ b/master/connect.c
@@ -1,266 +1,266 @@
-/**
- * libwlocate - WLAN-based location service
- * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-#include <stdio.h>
-#include <math.h>
-
-#ifdef ENV_WINDOWS
- #include <winsock2.h>
- #define MSG_NOSIGNAL 0
-#else
- #include <sys/socket.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <unistd.h>
- #include <netdb.h>
-#endif
-
-#ifndef ENV_WINDOWSCE
- #include <fcntl.h>
- #include <errno.h>
-#else
- #ifndef EAGIAN
- #define EAGAIN 11 // really the correct value? there is no errno.h for WinCE
- #endif
-#endif
-
-
-#ifdef ENV_QNX
- #define MSG_NOSIGNAL 0
-#endif
-
-
-static int util_thread_sleep(int msecs)
-{
-#ifdef ENV_WINDOWS
- Sleep(msecs);
-#else
- usleep(msecs*1000);
-#endif
- return msecs;
-}
-
-
-
-/**
-Receive data from a socket connection
-@param[in] sock the identifier of the opened socket connection
-@param[in] data the memory area where the received data have to be stored into
-@param[in] len the maximum length of data that have to be read
-@param[in] termStr an optional termination string; when this value is not NULL and the character
- defined here is received the function returns
-@param[in] timeout when this time is exceeded the function returns also if not all data could
- be read; this parameter is valid only in case the socket is non-blocking
-*/
-int tcp_recv(int sock,char *data, int len,const char *termStr,long timeout)
-{
- long /*size_t*/ rc;
- long ctr=0,readLen=0;
- #ifdef ENV_WINDOWS
- long err;
- #endif
-
- // data from source client side
- while (readLen<len)
- {
- rc = recv(sock,data+readLen,1/*len-readLen*/,MSG_NOSIGNAL);
- if (rc>0)
- {
- readLen+=rc;
- if (termStr)
- {
- if (readLen+1<len) data[readLen+1]=0;
- if (strstr(data,termStr)) return readLen;
- }
- if (readLen>=len) return readLen;
- }
- else if (rc==0) return readLen;
- else
- {
-#ifdef ENV_WINDOWS
- err=GetLastError();
- if ((err!=EAGAIN) && (err!=WSAEWOULDBLOCK))
-#else
- if ((errno!=EAGAIN) && (errno!=EINPROGRESS) && (errno!=0))
-#endif
- return readLen;
- ctr+=10;
- util_thread_sleep(10);
- }
- if (ctr>timeout) break;
- }
- return readLen;
-}
-
-
-
-/**
-Send data to a socket connection
-@param[in] sock the identifier of the opened socket connection
-@param[in] msg the data that have to be send
-@param[in] len the length of the data
-@param[in] msecs when this time is exceeded the function returns also if not all data could
- be sent; this parameter is valid only in case the socket is non-blocking
-*/
-int tcp_send(int sock, const char *msg,int len,int msecs)
-{
- int rlen=0;
- int ctr=0,val;
-#ifdef ENV_WINDOWS
- int errno;
-#else
-
- errno=0;
-#endif
- while ((rlen<len) && (ctr<msecs))
- {
-#ifdef ENV_LINUX
- val=send(sock,msg+rlen,len-rlen,MSG_NOSIGNAL);
-#else
- val=send(sock,msg+rlen,len-rlen,0);
-#endif
- if (val>=0) rlen+=val;
- else
- {
-#ifndef ENV_WINDOWS
- if (errno==EAGAIN) ctr-=2; // in case of eagain we expect a longer send-timeout
-#else
- errno=WSAGetLastError();
- if (errno==WSAEWOULDBLOCK) ctr-=2; // in case of eagain we expect a longer send-timeout
-#endif
- else if (errno!=0)
- {
- rlen=-1;
- break;
- }
-#ifndef ENV_WINDOWS
- errno=0;
-#endif
- }
- if (rlen<len)
- {
- util_thread_sleep(2);
- ctr+=2;
- }
- if ((rlen==0) && (ctr>msecs/2)) break;
- }
- return rlen;
-}
-
-
-
-/**
-Closes an opened socket connection
-@param[in] sock the socket that has to be closed
-*/
-void tcp_closesocket (int sock)
-{
-#ifdef ENV_WINDOWS
- shutdown(sock,SD_SEND);
- shutdown(sock,SD_RECEIVE);
- closesocket(sock);
-#else
- shutdown(sock,SHUT_WR);
- shutdown(sock,SHUT_RD);
- if (close (sock)<0) perror("close failed");
-#endif
-}
-
-
-
-/**
-Tries to establish a client connection to a (remote) server socket
-@param[in] address address of the remote server in style a.b.c.d or www.domain.tld
-@param[in] port number to connect with
-@return the socket identifier of the established connection or a value <=0 in case of an
- error
-*/
-int tcp_connect_to(const char *address,unsigned short connect_port)
-{
- struct sockaddr_in a;
- struct hostent *host;
- int s;
- unsigned long nl;
-
- s = socket (AF_INET, SOCK_STREAM, 0);
- if (s<0)
- {
-#ifndef ENV_WINDOWSCE
- perror("Can't create socket");
-#endif
- return -1;
- }
-
- memset (&a, 0, sizeof (a));
- a.sin_port = htons (connect_port);
- a.sin_family = AF_INET;
- a.sin_addr.s_addr =inet_addr(address);
- if (a.sin_addr.s_addr==INADDR_NONE)
- {
- host = gethostbyname (address); // deprecated by posix standard?
- if (host)
- {
- memcpy (&nl, host->h_addr, sizeof(unsigned long));
- a.sin_addr.s_addr = nl;
- }
- else
- {
-#ifndef ENV_WINDOWSCE
- perror("Getting hostname");
-#endif
- tcp_closesocket(s);
- return -1;
- }
- }
- if (connect (s, (struct sockaddr *) &a, sizeof (a)) < 0)
- {
-#ifndef ENV_WINDOWSCE
- perror("No connection");
-#endif
- tcp_closesocket (s);
- return -1;
- }
- return s;
-}
-
-
-
-/**
-Configures the blocking mode of an opened socket
-@param[in] sock identifier of the socket to configure
-@param[in] block 1 to set the socket to blocking mode, 0 to set it to non-blocking
-*/
-void tcp_set_blocking(int sock,char block)
-{
- int flags;
-
-#ifndef ENV_WINDOWS
- flags=fcntl(sock,F_GETFL, 0);
- if (block) flags&=~O_NONBLOCK;
- else flags|=O_NONBLOCK;
- fcntl(sock,F_SETFL, flags);
-#else
- if (block) flags=0;
- else flags=13;
- ioctlsocket(sock,FIONBIO,(unsigned long*)&flags);
-#endif
-}
-
+/**
+ * libwlocate - WLAN-based location service
+ * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <math.h>
+
+#ifdef ENV_WINDOWS
+ #include <winsock2.h>
+ #define MSG_NOSIGNAL 0
+#else
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <sys/ioctl.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <unistd.h>
+ #include <netdb.h>
+#endif
+
+#ifndef ENV_WINDOWSCE
+ #include <fcntl.h>
+ #include <errno.h>
+#else
+ #ifndef EAGIAN
+ #define EAGAIN 11 // really the correct value? there is no errno.h for WinCE
+ #endif
+#endif
+
+
+#ifdef ENV_QNX
+ #define MSG_NOSIGNAL 0
+#endif
+
+
+static int util_thread_sleep(int msecs)
+{
+#ifdef ENV_WINDOWS
+ Sleep(msecs);
+#else
+ usleep(msecs*1000);
+#endif
+ return msecs;
+}
+
+
+
+/**
+Receive data from a socket connection
+@param[in] sock the identifier of the opened socket connection
+@param[in] data the memory area where the received data have to be stored into
+@param[in] len the maximum length of data that have to be read
+@param[in] termStr an optional termination string; when this value is not NULL and the character
+ defined here is received the function returns
+@param[in] timeout when this time is exceeded the function returns also if not all data could
+ be read; this parameter is valid only in case the socket is non-blocking
+*/
+int tcp_recv(int sock,char *data, int len,const char *termStr,long timeout)
+{
+ long /*size_t*/ rc;
+ long ctr=0,readLen=0;
+ #ifdef ENV_WINDOWS
+ long err;
+ #endif
+
+ // data from source client side
+ while (readLen<len)
+ {
+ rc = recv(sock,data+readLen,1/*len-readLen*/,MSG_NOSIGNAL);
+ if (rc>0)
+ {
+ readLen+=rc;
+ if (termStr)
+ {
+ if (readLen+1<len) data[readLen+1]=0;
+ if (strstr(data,termStr)) return readLen;
+ }
+ if (readLen>=len) return readLen;
+ }
+ else if (rc==0) return readLen;
+ else
+ {
+#ifdef ENV_WINDOWS
+ err=GetLastError();
+ if ((err!=EAGAIN) && (err!=WSAEWOULDBLOCK))
+#else
+ if ((errno!=EAGAIN) && (errno!=EINPROGRESS) && (errno!=0))
+#endif
+ return readLen;
+ ctr+=10;
+ util_thread_sleep(10);
+ }
+ if (ctr>timeout) break;
+ }
+ return readLen;
+}
+
+
+
+/**
+Send data to a socket connection
+@param[in] sock the identifier of the opened socket connection
+@param[in] msg the data that have to be send
+@param[in] len the length of the data
+@param[in] msecs when this time is exceeded the function returns also if not all data could
+ be sent; this parameter is valid only in case the socket is non-blocking
+*/
+int tcp_send(int sock, const char *msg,int len,int msecs)
+{
+ int rlen=0;
+ int ctr=0,val;
+#ifdef ENV_WINDOWS
+ int errno;
+#else
+
+ errno=0;
+#endif
+ while ((rlen<len) && (ctr<msecs))
+ {
+#ifdef ENV_LINUX
+ val=send(sock,msg+rlen,len-rlen,MSG_NOSIGNAL);
+#else
+ val=send(sock,msg+rlen,len-rlen,0);
+#endif
+ if (val>=0) rlen+=val;
+ else
+ {
+#ifndef ENV_WINDOWS
+ if (errno==EAGAIN) ctr-=2; // in case of eagain we expect a longer send-timeout
+#else
+ errno=WSAGetLastError();
+ if (errno==WSAEWOULDBLOCK) ctr-=2; // in case of eagain we expect a longer send-timeout
+#endif
+ else if (errno!=0)
+ {
+ rlen=-1;
+ break;
+ }
+#ifndef ENV_WINDOWS
+ errno=0;
+#endif
+ }
+ if (rlen<len)
+ {
+ util_thread_sleep(2);
+ ctr+=2;
+ }
+ if ((rlen==0) && (ctr>msecs/2)) break;
+ }
+ return rlen;
+}
+
+
+
+/**
+Closes an opened socket connection
+@param[in] sock the socket that has to be closed
+*/
+void tcp_closesocket (int sock)
+{
+#ifdef ENV_WINDOWS
+ shutdown(sock,SD_SEND);
+ shutdown(sock,SD_RECEIVE);
+ closesocket(sock);
+#else
+ shutdown(sock,SHUT_WR);
+ shutdown(sock,SHUT_RD);
+ if (close (sock)<0) perror("close failed");
+#endif
+}
+
+
+
+/**
+Tries to establish a client connection to a (remote) server socket
+@param[in] address address of the remote server in style a.b.c.d or www.domain.tld
+@param[in] port number to connect with
+@return the socket identifier of the established connection or a value <=0 in case of an
+ error
+*/
+int tcp_connect_to(const char *address,unsigned short connect_port)
+{
+ struct sockaddr_in a;
+ struct hostent *host;
+ int s;
+ unsigned long nl;
+
+ s = socket (AF_INET, SOCK_STREAM, 0);
+ if (s<0)
+ {
+#ifndef ENV_WINDOWSCE
+ perror("Can't create socket");
+#endif
+ return -1;
+ }
+
+ memset (&a, 0, sizeof (a));
+ a.sin_port = htons (connect_port);
+ a.sin_family = AF_INET;
+ a.sin_addr.s_addr =inet_addr(address);
+ if (a.sin_addr.s_addr==INADDR_NONE)
+ {
+ host = gethostbyname (address); // deprecated by posix standard?
+ if (host)
+ {
+ memcpy (&nl, host->h_addr, sizeof(unsigned long));
+ a.sin_addr.s_addr = nl;
+ }
+ else
+ {
+#ifndef ENV_WINDOWSCE
+ perror("Getting hostname");
+#endif
+ tcp_closesocket(s);
+ return -1;
+ }
+ }
+ if (connect (s, (struct sockaddr *) &a, sizeof (a)) < 0)
+ {
+#ifndef ENV_WINDOWSCE
+ perror("No connection");
+#endif
+ tcp_closesocket (s);
+ return -1;
+ }
+ return s;
+}
+
+
+
+/**
+Configures the blocking mode of an opened socket
+@param[in] sock identifier of the socket to configure
+@param[in] block 1 to set the socket to blocking mode, 0 to set it to non-blocking
+*/
+void tcp_set_blocking(int sock,char block)
+{
+ int flags;
+
+#ifndef ENV_WINDOWS
+ flags=fcntl(sock,F_GETFL, 0);
+ if (block) flags&=~O_NONBLOCK;
+ else flags|=O_NONBLOCK;
+ fcntl(sock,F_SETFL, flags);
+#else
+ if (block) flags=0;
+ else flags=13;
+ ioctlsocket(sock,FIONBIO,(unsigned long*)&flags);
+#endif
+}
+
diff --git a/master/connect.h b/master/connect.h
index e4a05e5..114ecb7 100755
--- a/master/connect.h
+++ b/master/connect.h
@@ -1,21 +1,21 @@
-/**
- * libwlocate - WLAN-based location service
- * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
+/**
+ * libwlocate - WLAN-based location service
+ * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#ifndef CONNECT_H
#define CONNECT_H
diff --git a/master/iwlist.c b/master/iwlist.c
index 5d1b130..e1a731a 100755
--- a/master/iwlist.c
+++ b/master/iwlist.c
@@ -1,481 +1,481 @@
-/*
- * Wireless Tools
- *
- * Jean II - HPLB '99 - HPL 99->07
- *
- * This tool can access various piece of information on the card
- * not part of iwconfig...
- * You need to link this code against "iwlist.c" and "-lm".
- *
- * This file is released under the GPL license.
- * Copyright (c) 1997-2007 Jean Tourrilhes <jt(a)hpl.hp.com>
- */
-
-#include "iwlib.h" /* Header */
-#include "libwlocate.h"
-#include <sys/time.h>
-
-static struct wloc_req *g_request;
-static struct iwscan_state state;
-
-/****************************** TYPES ******************************/
-
-/*
- * Scan state and meta-information, used to decode events...
- */
-typedef struct iwscan_state
-{
- /* State */
- int ap_num; /* Access Point number 1->N */
- int val_index; /* Value in table 0->(N-1) */
-} iwscan_state;
-
-/*
- * Bit to name mapping
- */
-typedef struct iwmask_name
-{
- unsigned int mask; /* bit mask for the value */
- const char * name; /* human readable name for the value */
-} iwmask_name;
-
-/*
- * Types of authentication parameters
- */
-typedef struct iw_auth_descr
-{
- int value; /* Type of auth value */
- const char * label; /* User readable version */
- const struct iwmask_name * names; /* Names for this value */
- const int num_names; /* Number of names */
-} iw_auth_descr;
-
-/**************************** CONSTANTS ****************************/
-
-#define IW_SCAN_HACK 0x8000
-
-#define IW_EXTKEY_SIZE (sizeof(struct iw_encode_ext) + IW_ENCODING_TOKEN_MAX)
-
-
-
-/***************************** SCANNING *****************************/
-/*
- * This one behave quite differently from the others
- *
- * Note that we don't use the scanning capability of iwlib (functions
- * iw_process_scan() and iw_scan()). The main reason is that
- * iw_process_scan() return only a subset of the scan data to the caller,
- * for example custom elements and bitrates are ommited. Here, we
- * do the complete job...
- */
-
-/*------------------------------------------------------------------*/
-/*
- * Print one element from the scanning results
- */
-static inline void
-print_scanning_token(struct stream_descr * stream, /* Stream of events */
- struct iw_event * event, /* Extracted token */
- struct iwscan_state * state,
- struct iw_range * iw_range, /* Range info */
- int has_range)
-{
- int i;
- char buffer[128];
-
- if (state->ap_num>=WLOC_MAX_NETWORKS)
- return;
- /* Now, let's decode the event */
- switch(event->cmd)
- {
- case SIOCGIWAP:
-// printf(" Cell %02d - Address: %s\n", state->ap_num, iw_saether_ntop(&event->u.ap_addr, buffer));
- state->ap_num++;
- for (i=0; i<6; i++)
- g_request->bssids[state->ap_num-1][i]=(event->u.ap_addr.sa_data[i] & 0xFF);
- break;
- case IWEVQUAL:
- {
-// if (iw_range->max_qual.qual==0) g_request->signal[state->ap_num-1]=abs(event->u.qual.qual);
-// else g_request->signal[state->ap_num-1]=100.0*event->u.qual.qual/iw_range->max_qual.qual;
-// printf(" Signal: %d\n",g_request->signal[state->ap_num-1]);
- break;
- }
- default:
- break;
- } /* switch(event->cmd) */
-}
-
-/*------------------------------------------------------------------*/
-/*
- * Perform a scanning on one device
- */
-static int
-print_scanning_info(int skfd,
- char * ifname,
- char * args[], /* Command line args */
- int count) /* Args count */
-{
- struct iwreq wrq;
- struct iw_scan_req scanopt; /* Options for 'set' */
- int scanflags = 0; /* Flags for scan */
- unsigned char * buffer = NULL; /* Results */
- int buflen = IW_SCAN_MAX_DATA; /* Min for compat WE<17 */
- struct iw_range range;
- int has_range;
- struct timeval tv; /* Select timeout */
- int timeout = 15000000; /* 15s */
-
- /* Avoid "Unused parameter" warning */
- args = args; count = count;
-
- /* Debugging stuff */
-/* if((IW_EV_LCP_PK2_LEN != IW_EV_LCP_PK_LEN) || (IW_EV_POINT_PK2_LEN != IW_EV_POINT_PK_LEN))
- {
- fprintf(stderr, "*** Please report to jt(a)hpl.hp.com your platform details\n");
- fprintf(stderr, "*** and the following line :\n");
- fprintf(stderr, "*** IW_EV_LCP_PK2_LEN = %zu ; IW_EV_POINT_PK2_LEN = %zu\n\n",
- IW_EV_LCP_PK2_LEN, IW_EV_POINT_PK2_LEN);
- }*/
-
- /* Get range stuff */
- has_range = (iw_get_range_info(skfd, ifname, &range) >= 0);
-
- /* Check if the interface could support scanning. */
- if (range.we_version_compiled==0) range.we_version_compiled=29;
- if((!has_range) || (range.we_version_compiled < 14))
- {
- fprintf(stderr, "%-8.16s Interface doesn't support scanning.\n\n",
- ifname);
- return(-1);
- }
-
- /* Init timeout value -> 250ms between set and first get */
- tv.tv_sec = 0;
- tv.tv_usec = 250000;
-
- /* Clean up set args */
- memset(&scanopt, 0, sizeof(scanopt));
-
- /* Parse command line arguments and extract options.
- * Note : when we have enough options, we should use the parser
- * from iwconfig... */
-/* while(count > 0)
- {
-
- count--;
-
- if(!strncmp(args[0], "essid", 5))
- {
- if(count < 1)
- {
- fprintf(stderr, "Too few arguments for scanning option [%s]\n",
- args[0]);
- return(-1);
- }
- args++;
- count--;
-
- scanopt.essid_len = strlen(args[0]);
- memcpy(scanopt.essid, args[0], scanopt.essid_len);
- if(scanopt.bssid.sa_family == 0)
- {
- scanopt.bssid.sa_family = ARPHRD_ETHER;
- memset(scanopt.bssid.sa_data, 0xff, ETH_ALEN);
- }
- scanflags |= IW_SCAN_THIS_ESSID;
- }
- else
- if(!strncmp(args[0], "last", 4))
- {
- scanflags |= IW_SCAN_HACK;
- }
- else
- {
- fprintf(stderr, "Invalid scanning option [%s]\n", args[0]);
- return(-1);
- }
-
- args++;
- }*/
-
- /* Check if we have scan options */
-/* if(scanflags)
- {
- wrq.u.data.pointer = (caddr_t) &scanopt;
- wrq.u.data.length = sizeof(scanopt);
- wrq.u.data.flags = scanflags;
- }
- else*/
- {
- wrq.u.data.pointer = NULL;
- wrq.u.data.flags = 0;
- wrq.u.data.length = 0;
- }
-
- /* If only 'last' was specified on command line, don't trigger a scan */
-/* if(scanflags == IW_SCAN_HACK)
- {
- tv.tv_usec = 0;
- }
- else*/
- {
- /* Initiate Scanning */
- if(iw_set_ext(skfd, ifname, SIOCSIWSCAN, &wrq) < 0)
- {
- if((errno != EPERM) || (scanflags != 0))
- {
- fprintf(stderr, "%-8.16s Interface doesn't support scanning : %s\n\n",
- ifname, strerror(errno));
- return(-1);
- }
- /* If we don't have the permission to initiate the scan, we may
- * still have permission to read left-over results.
- * But, don't wait !!! */
-#if 0
- /* Not cool, it display for non wireless interfaces... */
- fprintf(stderr, "%-8.16s (Could not trigger scanning, just reading left-over results)\n", ifname);
-#endif
- tv.tv_usec = 0;
- }
- }
- timeout -= tv.tv_usec;
-
- /* Forever */
- while(1)
- {
- fd_set rfds; /* File descriptors for select */
- int last_fd; /* Last fd */
- int ret;
-
- /* Guess what ? We must re-generate rfds each time */
- FD_ZERO(&rfds);
- last_fd = -1;
-
- /* In here, add the rtnetlink fd in the list */
-
- /* Wait until something happens */
- ret = select(last_fd + 1, &rfds, NULL, NULL, &tv);
-
- /* Check if there was an error */
- if(ret < 0)
- {
- if(errno == EAGAIN || errno == EINTR)
- continue;
- fprintf(stderr, "Unhandled signal - exiting...\n");
- return(-1);
- }
-
- /* Check if there was a timeout */
- if(ret == 0)
- {
- unsigned char * newbuf;
-
- realloc:
- /* (Re)allocate the buffer - realloc(NULL, len) == malloc(len) */
- newbuf = (unsigned char*)realloc(buffer, buflen);
- if(newbuf == NULL)
- {
- if(buffer)
- free(buffer);
- fprintf(stderr, "%s: Allocation failed\n", __FUNCTION__);
- return(-1);
- }
- buffer = newbuf;
-
- /* Try to read the results */
- wrq.u.data.pointer = buffer;
- wrq.u.data.flags = 0;
- wrq.u.data.length = buflen;
- if(iw_get_ext(skfd, ifname, SIOCGIWSCAN, &wrq) < 0)
- {
- /* Check if buffer was too small (WE-17 only) */
- if((errno == E2BIG) && (range.we_version_compiled > 16))
- {
- /* Some driver may return very large scan results, either
- * because there are many cells, or because they have many
- * large elements in cells (like IWEVCUSTOM). Most will
- * only need the regular sized buffer. We now use a dynamic
- * allocation of the buffer to satisfy everybody. Of course,
- * as we don't know in advance the size of the array, we try
- * various increasing sizes. Jean II */
-
- /* Check if the driver gave us any hints. */
- if(wrq.u.data.length > buflen)
- buflen = wrq.u.data.length;
- else
- buflen *= 2;
-
- /* Try again */
- goto realloc;
- }
-
- /* Check if results not available yet */
- if(errno == EAGAIN)
- {
- /* Restart timer for only 100ms*/
- tv.tv_sec = 0;
- tv.tv_usec = 100000;
- timeout -= tv.tv_usec;
- if(timeout > 0)
- continue; /* Try again later */
- }
-
- /* Bad error */
- free(buffer);
- fprintf(stderr, "%-8.16s Failed to read scan data : %s\n\n",
- ifname, strerror(errno));
- return(-2);
- }
- else
- /* We have the results, go to process them */
- break;
- }
-
- /* In here, check if event and event type
- * if scan event, read results. All errors bad & no reset timeout */
- }
-
- if(wrq.u.data.length)
- {
- struct iw_event iwe;
- struct stream_descr stream;
- int ret;
-
- state.ap_num = 0;
- state.val_index = 0;
-#ifdef DEBUG
- /* Debugging code. In theory useless, because it's debugged ;-) */
- int i;
- printf("Scan result %d [%02X", wrq.u.data.length, buffer[0]);
- for(i = 1; i < wrq.u.data.length; i++)
- printf(":%02X", buffer[i]);
- printf("]\n");
-#endif
- printf("%-8.16s Scan completed :\n", ifname);
- iw_init_event_stream(&stream, (char *) buffer, wrq.u.data.length);
- do
- {
- /* Extract an event and print it */
- ret = iw_extract_event_stream(&stream, &iwe,
- range.we_version_compiled);
- if(ret > 0)
- print_scanning_token(&stream, &iwe, &state,
- &range, has_range);
- }
- while(ret > 0);
- printf("\n");
- }
- else
- printf("%-8.16s No scan results\n\n", ifname);
-
- free(buffer);
- return(0);
-}
-
-/*********************** FREQUENCIES/CHANNELS ***********************/
-
-/*------------------------------------------------------------------*/
-/*
- * Power Management types of values
- */
-static const unsigned int pm_type_flags[] = {
- IW_POWER_PERIOD,
- IW_POWER_TIMEOUT,
- IW_POWER_SAVING,
-};
-static const int pm_type_flags_size = (sizeof(pm_type_flags)/sizeof(pm_type_flags[0]));
-
-
-
-/************************* COMMON UTILITIES *************************/
-/*
- * This section was initially written by Michael Tokarev <mjt(a)tls.msk.ru>
- * but heavily modified by me ;-)
- */
-
-/*------------------------------------------------------------------*/
-/*
- * Map command line arguments to the proper procedure...
- */
-typedef struct iwlist_entry {
- const char * cmd; /* Command line shorthand */
- iw_enum_handler fn; /* Subroutine */
- int max_count;
- const char * argsname; /* Args as human readable string */
-} iwlist_cmd;
-
-static const struct iwlist_entry iwlist_cmds[] = {
- { "scanning", print_scanning_info, -1, "[essid NNN] [last]" },
- { NULL, NULL, 0, 0 },
-};
-
-/*------------------------------------------------------------------*/
-/*
- * Find the most appropriate command matching the command line
- */
-static inline const iwlist_cmd *
-find_command(const char * cmd)
-{
- const iwlist_cmd * found = NULL;
- int ambig = 0;
- unsigned int len = strlen(cmd);
- int i;
-
- /* Go through all commands */
- for(i = 0; iwlist_cmds[i].cmd != NULL; ++i)
- {
- /* No match -> next one */
- if(strncasecmp(iwlist_cmds[i].cmd, cmd, len) != 0)
- continue;
-
- /* Exact match -> perfect */
- if(len == strlen(iwlist_cmds[i].cmd))
- return &iwlist_cmds[i];
-
- /* Partial match */
- if(found == NULL)
- /* First time */
- found = &iwlist_cmds[i];
- else
- /* Another time */
- if (iwlist_cmds[i].fn != found->fn)
- ambig = 1;
- }
-
- if(found == NULL)
- {
- fprintf(stderr, "iwlist: unknown command `%s' (check 'iwlist --help').\n", cmd);
- return NULL;
- }
-
- if(ambig)
- {
- fprintf(stderr, "iwlist: command `%s' is ambiguous (check 'iwlist --help').\n", cmd);
- return NULL;
- }
-
- return found;
-}
-
-
-
-int iw_fill_structure(struct wloc_req *request)
-{
- int skfd;
- /* Create a channel to the NET kernel. */
- if((skfd = iw_sockets_open()) < 0)
- {
- perror("socket");
- return -1;
- }
- g_request=request;
-
- /* do the actual work */
- iw_enum_devices(skfd,print_scanning_info,NULL,-1);
-
- /* Close the socket. */
- iw_sockets_close(skfd);
-
- return state.ap_num;
-}
+/*
+ * Wireless Tools
+ *
+ * Jean II - HPLB '99 - HPL 99->07
+ *
+ * This tool can access various piece of information on the card
+ * not part of iwconfig...
+ * You need to link this code against "iwlist.c" and "-lm".
+ *
+ * This file is released under the GPL license.
+ * Copyright (c) 1997-2007 Jean Tourrilhes <jt(a)hpl.hp.com>
+ */
+
+#include "iwlib.h" /* Header */
+#include "libwlocate.h"
+#include <sys/time.h>
+
+static struct wloc_req *g_request;
+static struct iwscan_state state;
+
+/****************************** TYPES ******************************/
+
+/*
+ * Scan state and meta-information, used to decode events...
+ */
+typedef struct iwscan_state
+{
+ /* State */
+ int ap_num; /* Access Point number 1->N */
+ int val_index; /* Value in table 0->(N-1) */
+} iwscan_state;
+
+/*
+ * Bit to name mapping
+ */
+typedef struct iwmask_name
+{
+ unsigned int mask; /* bit mask for the value */
+ const char * name; /* human readable name for the value */
+} iwmask_name;
+
+/*
+ * Types of authentication parameters
+ */
+typedef struct iw_auth_descr
+{
+ int value; /* Type of auth value */
+ const char * label; /* User readable version */
+ const struct iwmask_name * names; /* Names for this value */
+ const int num_names; /* Number of names */
+} iw_auth_descr;
+
+/**************************** CONSTANTS ****************************/
+
+#define IW_SCAN_HACK 0x8000
+
+#define IW_EXTKEY_SIZE (sizeof(struct iw_encode_ext) + IW_ENCODING_TOKEN_MAX)
+
+
+
+/***************************** SCANNING *****************************/
+/*
+ * This one behave quite differently from the others
+ *
+ * Note that we don't use the scanning capability of iwlib (functions
+ * iw_process_scan() and iw_scan()). The main reason is that
+ * iw_process_scan() return only a subset of the scan data to the caller,
+ * for example custom elements and bitrates are ommited. Here, we
+ * do the complete job...
+ */
+
+/*------------------------------------------------------------------*/
+/*
+ * Print one element from the scanning results
+ */
+static inline void
+print_scanning_token(struct stream_descr * stream, /* Stream of events */
+ struct iw_event * event, /* Extracted token */
+ struct iwscan_state * state,
+ struct iw_range * iw_range, /* Range info */
+ int has_range)
+{
+ int i;
+ char buffer[128];
+
+ if (state->ap_num>=WLOC_MAX_NETWORKS)
+ return;
+ /* Now, let's decode the event */
+ switch(event->cmd)
+ {
+ case SIOCGIWAP:
+// printf(" Cell %02d - Address: %s\n", state->ap_num, iw_saether_ntop(&event->u.ap_addr, buffer));
+ state->ap_num++;
+ for (i=0; i<6; i++)
+ g_request->bssids[state->ap_num-1][i]=(event->u.ap_addr.sa_data[i] & 0xFF);
+ break;
+ case IWEVQUAL:
+ {
+// if (iw_range->max_qual.qual==0) g_request->signal[state->ap_num-1]=abs(event->u.qual.qual);
+// else g_request->signal[state->ap_num-1]=100.0*event->u.qual.qual/iw_range->max_qual.qual;
+// printf(" Signal: %d\n",g_request->signal[state->ap_num-1]);
+ break;
+ }
+ default:
+ break;
+ } /* switch(event->cmd) */
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Perform a scanning on one device
+ */
+static int
+print_scanning_info(int skfd,
+ char * ifname,
+ char * args[], /* Command line args */
+ int count) /* Args count */
+{
+ struct iwreq wrq;
+ struct iw_scan_req scanopt; /* Options for 'set' */
+ int scanflags = 0; /* Flags for scan */
+ unsigned char * buffer = NULL; /* Results */
+ int buflen = IW_SCAN_MAX_DATA; /* Min for compat WE<17 */
+ struct iw_range range;
+ int has_range;
+ struct timeval tv; /* Select timeout */
+ int timeout = 15000000; /* 15s */
+
+ /* Avoid "Unused parameter" warning */
+ args = args; count = count;
+
+ /* Debugging stuff */
+/* if((IW_EV_LCP_PK2_LEN != IW_EV_LCP_PK_LEN) || (IW_EV_POINT_PK2_LEN != IW_EV_POINT_PK_LEN))
+ {
+ fprintf(stderr, "*** Please report to jt(a)hpl.hp.com your platform details\n");
+ fprintf(stderr, "*** and the following line :\n");
+ fprintf(stderr, "*** IW_EV_LCP_PK2_LEN = %zu ; IW_EV_POINT_PK2_LEN = %zu\n\n",
+ IW_EV_LCP_PK2_LEN, IW_EV_POINT_PK2_LEN);
+ }*/
+
+ /* Get range stuff */
+ has_range = (iw_get_range_info(skfd, ifname, &range) >= 0);
+
+ /* Check if the interface could support scanning. */
+ if (range.we_version_compiled==0) range.we_version_compiled=29;
+ if((!has_range) || (range.we_version_compiled < 14))
+ {
+ fprintf(stderr, "%-8.16s Interface doesn't support scanning.\n\n",
+ ifname);
+ return(-1);
+ }
+
+ /* Init timeout value -> 250ms between set and first get */
+ tv.tv_sec = 0;
+ tv.tv_usec = 250000;
+
+ /* Clean up set args */
+ memset(&scanopt, 0, sizeof(scanopt));
+
+ /* Parse command line arguments and extract options.
+ * Note : when we have enough options, we should use the parser
+ * from iwconfig... */
+/* while(count > 0)
+ {
+
+ count--;
+
+ if(!strncmp(args[0], "essid", 5))
+ {
+ if(count < 1)
+ {
+ fprintf(stderr, "Too few arguments for scanning option [%s]\n",
+ args[0]);
+ return(-1);
+ }
+ args++;
+ count--;
+
+ scanopt.essid_len = strlen(args[0]);
+ memcpy(scanopt.essid, args[0], scanopt.essid_len);
+ if(scanopt.bssid.sa_family == 0)
+ {
+ scanopt.bssid.sa_family = ARPHRD_ETHER;
+ memset(scanopt.bssid.sa_data, 0xff, ETH_ALEN);
+ }
+ scanflags |= IW_SCAN_THIS_ESSID;
+ }
+ else
+ if(!strncmp(args[0], "last", 4))
+ {
+ scanflags |= IW_SCAN_HACK;
+ }
+ else
+ {
+ fprintf(stderr, "Invalid scanning option [%s]\n", args[0]);
+ return(-1);
+ }
+
+ args++;
+ }*/
+
+ /* Check if we have scan options */
+/* if(scanflags)
+ {
+ wrq.u.data.pointer = (caddr_t) &scanopt;
+ wrq.u.data.length = sizeof(scanopt);
+ wrq.u.data.flags = scanflags;
+ }
+ else*/
+ {
+ wrq.u.data.pointer = NULL;
+ wrq.u.data.flags = 0;
+ wrq.u.data.length = 0;
+ }
+
+ /* If only 'last' was specified on command line, don't trigger a scan */
+/* if(scanflags == IW_SCAN_HACK)
+ {
+ tv.tv_usec = 0;
+ }
+ else*/
+ {
+ /* Initiate Scanning */
+ if(iw_set_ext(skfd, ifname, SIOCSIWSCAN, &wrq) < 0)
+ {
+ if((errno != EPERM) || (scanflags != 0))
+ {
+ fprintf(stderr, "%-8.16s Interface doesn't support scanning : %s\n\n",
+ ifname, strerror(errno));
+ return(-1);
+ }
+ /* If we don't have the permission to initiate the scan, we may
+ * still have permission to read left-over results.
+ * But, don't wait !!! */
+#if 0
+ /* Not cool, it display for non wireless interfaces... */
+ fprintf(stderr, "%-8.16s (Could not trigger scanning, just reading left-over results)\n", ifname);
+#endif
+ tv.tv_usec = 0;
+ }
+ }
+ timeout -= tv.tv_usec;
+
+ /* Forever */
+ while(1)
+ {
+ fd_set rfds; /* File descriptors for select */
+ int last_fd; /* Last fd */
+ int ret;
+
+ /* Guess what ? We must re-generate rfds each time */
+ FD_ZERO(&rfds);
+ last_fd = -1;
+
+ /* In here, add the rtnetlink fd in the list */
+
+ /* Wait until something happens */
+ ret = select(last_fd + 1, &rfds, NULL, NULL, &tv);
+
+ /* Check if there was an error */
+ if(ret < 0)
+ {
+ if(errno == EAGAIN || errno == EINTR)
+ continue;
+ fprintf(stderr, "Unhandled signal - exiting...\n");
+ return(-1);
+ }
+
+ /* Check if there was a timeout */
+ if(ret == 0)
+ {
+ unsigned char * newbuf;
+
+ realloc:
+ /* (Re)allocate the buffer - realloc(NULL, len) == malloc(len) */
+ newbuf = (unsigned char*)realloc(buffer, buflen);
+ if(newbuf == NULL)
+ {
+ if(buffer)
+ free(buffer);
+ fprintf(stderr, "%s: Allocation failed\n", __FUNCTION__);
+ return(-1);
+ }
+ buffer = newbuf;
+
+ /* Try to read the results */
+ wrq.u.data.pointer = buffer;
+ wrq.u.data.flags = 0;
+ wrq.u.data.length = buflen;
+ if(iw_get_ext(skfd, ifname, SIOCGIWSCAN, &wrq) < 0)
+ {
+ /* Check if buffer was too small (WE-17 only) */
+ if((errno == E2BIG) && (range.we_version_compiled > 16))
+ {
+ /* Some driver may return very large scan results, either
+ * because there are many cells, or because they have many
+ * large elements in cells (like IWEVCUSTOM). Most will
+ * only need the regular sized buffer. We now use a dynamic
+ * allocation of the buffer to satisfy everybody. Of course,
+ * as we don't know in advance the size of the array, we try
+ * various increasing sizes. Jean II */
+
+ /* Check if the driver gave us any hints. */
+ if(wrq.u.data.length > buflen)
+ buflen = wrq.u.data.length;
+ else
+ buflen *= 2;
+
+ /* Try again */
+ goto realloc;
+ }
+
+ /* Check if results not available yet */
+ if(errno == EAGAIN)
+ {
+ /* Restart timer for only 100ms*/
+ tv.tv_sec = 0;
+ tv.tv_usec = 100000;
+ timeout -= tv.tv_usec;
+ if(timeout > 0)
+ continue; /* Try again later */
+ }
+
+ /* Bad error */
+ free(buffer);
+ fprintf(stderr, "%-8.16s Failed to read scan data : %s\n\n",
+ ifname, strerror(errno));
+ return(-2);
+ }
+ else
+ /* We have the results, go to process them */
+ break;
+ }
+
+ /* In here, check if event and event type
+ * if scan event, read results. All errors bad & no reset timeout */
+ }
+
+ if(wrq.u.data.length)
+ {
+ struct iw_event iwe;
+ struct stream_descr stream;
+ int ret;
+
+ state.ap_num = 0;
+ state.val_index = 0;
+#ifdef DEBUG
+ /* Debugging code. In theory useless, because it's debugged ;-) */
+ int i;
+ printf("Scan result %d [%02X", wrq.u.data.length, buffer[0]);
+ for(i = 1; i < wrq.u.data.length; i++)
+ printf(":%02X", buffer[i]);
+ printf("]\n");
+#endif
+ printf("%-8.16s Scan completed :\n", ifname);
+ iw_init_event_stream(&stream, (char *) buffer, wrq.u.data.length);
+ do
+ {
+ /* Extract an event and print it */
+ ret = iw_extract_event_stream(&stream, &iwe,
+ range.we_version_compiled);
+ if(ret > 0)
+ print_scanning_token(&stream, &iwe, &state,
+ &range, has_range);
+ }
+ while(ret > 0);
+ printf("\n");
+ }
+ else
+ printf("%-8.16s No scan results\n\n", ifname);
+
+ free(buffer);
+ return(0);
+}
+
+/*********************** FREQUENCIES/CHANNELS ***********************/
+
+/*------------------------------------------------------------------*/
+/*
+ * Power Management types of values
+ */
+static const unsigned int pm_type_flags[] = {
+ IW_POWER_PERIOD,
+ IW_POWER_TIMEOUT,
+ IW_POWER_SAVING,
+};
+static const int pm_type_flags_size = (sizeof(pm_type_flags)/sizeof(pm_type_flags[0]));
+
+
+
+/************************* COMMON UTILITIES *************************/
+/*
+ * This section was initially written by Michael Tokarev <mjt(a)tls.msk.ru>
+ * but heavily modified by me ;-)
+ */
+
+/*------------------------------------------------------------------*/
+/*
+ * Map command line arguments to the proper procedure...
+ */
+typedef struct iwlist_entry {
+ const char * cmd; /* Command line shorthand */
+ iw_enum_handler fn; /* Subroutine */
+ int max_count;
+ const char * argsname; /* Args as human readable string */
+} iwlist_cmd;
+
+static const struct iwlist_entry iwlist_cmds[] = {
+ { "scanning", print_scanning_info, -1, "[essid NNN] [last]" },
+ { NULL, NULL, 0, 0 },
+};
+
+/*------------------------------------------------------------------*/
+/*
+ * Find the most appropriate command matching the command line
+ */
+static inline const iwlist_cmd *
+find_command(const char * cmd)
+{
+ const iwlist_cmd * found = NULL;
+ int ambig = 0;
+ unsigned int len = strlen(cmd);
+ int i;
+
+ /* Go through all commands */
+ for(i = 0; iwlist_cmds[i].cmd != NULL; ++i)
+ {
+ /* No match -> next one */
+ if(strncasecmp(iwlist_cmds[i].cmd, cmd, len) != 0)
+ continue;
+
+ /* Exact match -> perfect */
+ if(len == strlen(iwlist_cmds[i].cmd))
+ return &iwlist_cmds[i];
+
+ /* Partial match */
+ if(found == NULL)
+ /* First time */
+ found = &iwlist_cmds[i];
+ else
+ /* Another time */
+ if (iwlist_cmds[i].fn != found->fn)
+ ambig = 1;
+ }
+
+ if(found == NULL)
+ {
+ fprintf(stderr, "iwlist: unknown command `%s' (check 'iwlist --help').\n", cmd);
+ return NULL;
+ }
+
+ if(ambig)
+ {
+ fprintf(stderr, "iwlist: command `%s' is ambiguous (check 'iwlist --help').\n", cmd);
+ return NULL;
+ }
+
+ return found;
+}
+
+
+
+int iw_fill_structure(struct wloc_req *request)
+{
+ int skfd;
+ /* Create a channel to the NET kernel. */
+ if((skfd = iw_sockets_open()) < 0)
+ {
+ perror("socket");
+ return -1;
+ }
+ g_request=request;
+
+ /* do the actual work */
+ iw_enum_devices(skfd,print_scanning_info,NULL,-1);
+
+ /* Close the socket. */
+ iw_sockets_close(skfd);
+
+ return state.ap_num;
+}
diff --git a/master/libwlocate.dsp b/master/libwlocate.dsp
index a0bdac8..01b1809 100755
--- a/master/libwlocate.dsp
+++ b/master/libwlocate.dsp
@@ -1,127 +1,127 @@
-# Microsoft Developer Studio Project File - Name="libwlocate" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=libwlocate - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libwlocate.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libwlocate.mak" CFG="libwlocate - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libwlocate - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "libwlocate - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libwlocate - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /D "ENV_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "libwlocate - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Zp1 /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /D "ENV_WINDOWS" /FR /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Cmds=copy Debug\libwlocate.dll C:\Windows\system32
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "libwlocate - Win32 Release"
-# Name "libwlocate - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\connect.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\libwlocate.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\wlan.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\wlan.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\wlanapi_cust.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="libwlocate" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=libwlocate - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "libwlocate.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "libwlocate.mak" CFG="libwlocate - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "libwlocate - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "libwlocate - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "libwlocate - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /D "ENV_WINDOWS" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "libwlocate - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /Zp1 /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBWLOCATE_EXPORTS" /D "ENV_WINDOWS" /FR /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Cmds=copy Debug\libwlocate.dll C:\Windows\system32
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "libwlocate - Win32 Release"
+# Name "libwlocate - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\connect.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\libwlocate.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\wlan.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\wlan.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\wlanapi_cust.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/master/libwlocate.dsw b/master/libwlocate.dsw
index 66166cd..b7e5b72 100755
--- a/master/libwlocate.dsw
+++ b/master/libwlocate.dsw
@@ -1,53 +1,53 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libwlocate"=.\libwlocate.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "locdemo"=.\locdemo\locdemo.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "trace"=.\trace.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "libwlocate"=.\libwlocate.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "locdemo"=.\locdemo\locdemo.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "trace"=.\trace.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/master/libwlocate.sln b/master/libwlocate.sln
index 2c737a4..74b9a82 100755
--- a/master/libwlocate.sln
+++ b/master/libwlocate.sln
@@ -1,31 +1,31 @@
-?
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2012
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libwlocate", "libwlocate.vcxproj", "{123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "trace", "trace.vcxproj", "{751B5C2A-5743-443F-8CA6-0A9287C39758}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- Template|Win32 = Template|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Debug|Win32.ActiveCfg = Debug|Win32
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Debug|Win32.Build.0 = Debug|Win32
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Release|Win32.ActiveCfg = Release|Win32
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Release|Win32.Build.0 = Release|Win32
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Template|Win32.ActiveCfg = Release|Win32
- {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Template|Win32.Build.0 = Release|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Debug|Win32.ActiveCfg = Debug|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Debug|Win32.Build.0 = Debug|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Release|Win32.ActiveCfg = Release|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Release|Win32.Build.0 = Release|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Template|Win32.ActiveCfg = Template|Win32
- {751B5C2A-5743-443F-8CA6-0A9287C39758}.Template|Win32.Build.0 = Template|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libwlocate", "libwlocate.vcxproj", "{123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "trace", "trace.vcxproj", "{751B5C2A-5743-443F-8CA6-0A9287C39758}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ Template|Win32 = Template|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Debug|Win32.ActiveCfg = Debug|Win32
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Debug|Win32.Build.0 = Debug|Win32
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Release|Win32.ActiveCfg = Release|Win32
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Release|Win32.Build.0 = Release|Win32
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Template|Win32.ActiveCfg = Release|Win32
+ {123462F3-4EA1-4F63-B1BC-0A2B52DAB9DB}.Template|Win32.Build.0 = Release|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Debug|Win32.ActiveCfg = Debug|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Debug|Win32.Build.0 = Debug|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Release|Win32.ActiveCfg = Release|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Release|Win32.Build.0 = Release|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Template|Win32.ActiveCfg = Template|Win32
+ {751B5C2A-5743-443F-8CA6-0A9287C39758}.Template|Win32.Build.0 = Template|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/master/libwlocate.vcproj b/master/libwlocate.vcproj
index 5bf63ed..70afa1c 100755
--- a/master/libwlocate.vcproj
+++ b/master/libwlocate.vcproj
@@ -1,301 +1,301 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8,00"
- Name="libwlocate"
- ProjectGUID="{409710FC-8708-4C87-B387-69F6A1E33DF7}"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory=".\Debug"
- IntermediateDirectory=".\Debug"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="_DEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Debug/libwlocate.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS,ENV_WINDOWS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- StructMemberAlignment="1"
- PrecompiledHeaderFile=".\Debug/libwlocate.pch"
- AssemblerListingLocation=".\Debug/"
- ObjectFile=".\Debug/"
- ProgramDataBaseFileName=".\Debug/"
- BrowseInformation="1"
- WarningLevel="3"
- SuppressStartupBanner="true"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="_DEBUG"
- Culture="1031"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib"
- OutputFile=".\Debug/libwlocate.dll"
- LinkIncremental="2"
- SuppressStartupBanner="true"
- GenerateDebugInformation="true"
- ProgramDatabaseFile=".\Debug/libwlocate.pdb"
- ImportLibrary=".\Debug/libwlocate.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Debug/libwlocate.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory=".\Release"
- IntermediateDirectory=".\Release"
- ConfigurationType="2"
- InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
- UseOfMFC="0"
- ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- PreprocessorDefinitions="NDEBUG"
- MkTypLibCompatible="true"
- SuppressStartupBanner="true"
- TargetEnvironment="1"
- TypeLibraryName=".\Release/libwlocate.tlb"
- HeaderFileName=""
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- InlineFunctionExpansion="1"
- PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS,ENV_WINDOWS"
- StringPooling="true"
- RuntimeLibrary="0"
- EnableFunctionLevelLinking="true"
- PrecompiledHeaderFile=".\Release/libwlocate.pch"
- AssemblerListingLocation=".\Release/"
- ObjectFile=".\Release/"
- ProgramDataBaseFileName=".\Release/"
- WarningLevel="3"
- SuppressStartupBanner="true"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- PreprocessorDefinitions="NDEBUG"
- Culture="1031"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib"
- OutputFile=".\Release/libwlocate.dll"
- LinkIncremental="1"
- SuppressStartupBanner="true"
- ProgramDatabaseFile=".\Release/libwlocate.pdb"
- ImportLibrary=".\Release/libwlocate.lib"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- SuppressStartupBanner="true"
- OutputFile=".\Release/libwlocate.bsc"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- >
- <File
- RelativePath="connect.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="libwlocate.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath="wlan.c"
- >
- <FileConfiguration
- Name="Debug|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- PreprocessorDefinitions=""
- />
- </FileConfiguration>
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl"
- >
- <File
- RelativePath=".\libwlocate.h"
- >
- </File>
- <File
- RelativePath="wlan.h"
- >
- </File>
- <File
- RelativePath=".\wlanapi_cust.h"
- >
- </File>
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="libwlocate"
+ ProjectGUID="{409710FC-8708-4C87-B387-69F6A1E33DF7}"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/libwlocate.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS,ENV_WINDOWS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ StructMemberAlignment="1"
+ PrecompiledHeaderFile=".\Debug/libwlocate.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib"
+ OutputFile=".\Debug/libwlocate.dll"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/libwlocate.pdb"
+ ImportLibrary=".\Debug/libwlocate.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/libwlocate.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="2"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/libwlocate.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS,ENV_WINDOWS"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/libwlocate.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1031"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib"
+ OutputFile=".\Release/libwlocate.dll"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/libwlocate.pdb"
+ ImportLibrary=".\Release/libwlocate.lib"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/libwlocate.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="connect.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="libwlocate.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="wlan.c"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath=".\libwlocate.h"
+ >
+ </File>
+ <File
+ RelativePath="wlan.h"
+ >
+ </File>
+ <File
+ RelativePath=".\wlanapi_cust.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/master/locdemo/LocDemoApp.cpp b/master/locdemo/LocDemoApp.cpp
index 947fdac..10e2211 100755
--- a/master/locdemo/LocDemoApp.cpp
+++ b/master/locdemo/LocDemoApp.cpp
@@ -1,46 +1,46 @@
-/**
- * LocDemo - a demo GUI application that uses libwlocate to display the
- * current geographic position
- * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "LocDemoApp.h"
-#include "LocDemoWin.h"
-
-#include <wx/socket.h>
-
-
-
-IMPLEMENT_APP(LocDemoApp)
-
-
-
-bool LocDemoApp::OnInit()
-{
- LocDemoWin *myWin;
-
- wxLog::EnableLogging(false);
- wxInitAllImageHandlers();
- wxSocketBase::Initialize();
-
- myWin = new LocDemoWin(wxT("OpenWLANMap Location Demo"));
- if (!wxApp::OnInit()) return false;
- myWin->Show(true);
- return true;
-}
-
-
-
+/**
+ * LocDemo - a demo GUI application that uses libwlocate to display the
+ * current geographic position
+ * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "LocDemoApp.h"
+#include "LocDemoWin.h"
+
+#include <wx/socket.h>
+
+
+
+IMPLEMENT_APP(LocDemoApp)
+
+
+
+bool LocDemoApp::OnInit()
+{
+ LocDemoWin *myWin;
+
+ wxLog::EnableLogging(false);
+ wxInitAllImageHandlers();
+ wxSocketBase::Initialize();
+
+ myWin = new LocDemoWin(wxT("OpenWLANMap Location Demo"));
+ if (!wxApp::OnInit()) return false;
+ myWin->Show(true);
+ return true;
+}
+
+
+
diff --git a/master/locdemo/LocDemoApp.h b/master/locdemo/LocDemoApp.h
index 1a17ffa..9c3c635 100755
--- a/master/locdemo/LocDemoApp.h
+++ b/master/locdemo/LocDemoApp.h
@@ -1,30 +1,30 @@
-/**
- * LocDemo - a demo GUI application that uses libwlocate to display the
- * current geographic position
- * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <wx/wx.h>
-
-class LocDemoApp : public wxApp
-{
-public:
- virtual bool OnInit();
-
-private:
- wxString m_mac;
-};
-
+/**
+ * LocDemo - a demo GUI application that uses libwlocate to display the
+ * current geographic position
+ * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <wx/wx.h>
+
+class LocDemoApp : public wxApp
+{
+public:
+ virtual bool OnInit();
+
+private:
+ wxString m_mac;
+};
+
diff --git a/master/locdemo/LocDemoWin.cpp b/master/locdemo/LocDemoWin.cpp
index 2403d72..76fa8ad 100755
--- a/master/locdemo/LocDemoWin.cpp
+++ b/master/locdemo/LocDemoWin.cpp
@@ -1,526 +1,526 @@
-/**
- * LocDemo - a demo GUI application that uses libwlocate to display the
- * current geographic position
- * Copyright (C) 2010-2014 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <list>
-
-#include "LocDemoWin.h"
-
-#include <wx/sstream.h>
-#include <wx/protocol/http.h>
-#include <wx/file.h>
-#include <wx/sizer.h>
-#include <wx/stdpaths.h>
-#include <wx/filename.h>
-#include <wx/timer.h>
-
-#include "libwlocate.h"
-
-using namespace std;
-
-#define X_OFFSET 162
-
-extern "C"
-{
- extern int get_position(struct wloc_req *request,double *lat,double *lon,char *quality,short *ccode);
-}
-
-IMPLEMENT_CLASS(LocDemoWin, wxFrame)
-
-BEGIN_EVENT_TABLE(LocDemoWin, wxFrame)
- EVT_BUTTON(wxID_ANY,LocDemoWin::OnButton)
- EVT_PAINT(LocDemoWin::OnPaint)
- EVT_TIMER(1,LocDemoWin::OnTimer)
-END_EVENT_TABLE()
-
-
-/**
-* Main constructor, here the window and the ui-elements on the left are created and added to some sizers
-*/
-LocDemoWin::LocDemoWin(const wxString& title)
- :wxFrame(NULL, wxID_ANY, title, wxPoint(20,0), wxSize(930,768),wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxCLIP_CHILDREN)
-{
- wxInt32 x,y;
-
- for (x=-1; x<=1; x++)
- for (y=-1; y<=1; y++) locTile[x+1][y+1]=NULL;
-
- m_zoom=17;
- m_traceMode=false;
-
- SetBackgroundColour(*wxWHITE);
- wxFlexGridSizer *fSizer=new wxFlexGridSizer(1,2,2,2);
- this->SetSizer(fSizer);
- fSizer->AddGrowableCol(0,1);
- fSizer->AddGrowableCol(1,10);
- wxPanel *rootPanel=new wxPanel(this);//,WXID_ANY,wxDefaultPos,wxSize(X_OFFSET,750));
- fSizer->Add(rootPanel);
-
- wxGridSizer *gSizer=new wxGridSizer(12,1,2,2);
- rootPanel->SetBackgroundColour(*wxWHITE);
- rootPanel->SetSizer(gSizer);
-
- wxStaticText *text=new wxStaticText(rootPanel,wxID_ANY,_T(""));
- gSizer->Add(text,0,wxALIGN_LEFT);
- updateButton=new wxButton(rootPanel,wxID_ANY,_T("Update Position"));
- gSizer->Add(updateButton,1,wxEXPAND);
-
- text=new wxStaticText(rootPanel,wxID_ANY,_T("Latitude:"));
- gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
- m_latField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
- gSizer->Add(m_latField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
-
- text=new wxStaticText(rootPanel,wxID_ANY,_T("Longitude:"));
- gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
- m_lonField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
- gSizer->Add(m_lonField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
-
- text=new wxStaticText(rootPanel,wxID_ANY,_T("Quality:"));
- gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
- m_qualityField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
- gSizer->Add(m_qualityField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
-
- text=new wxStaticText(rootPanel,wxID_ANY,_T("Country:"));
- gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
- m_countryField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
- gSizer->Add(m_countryField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
-
- m_followPathCB=new wxCheckBox(rootPanel,wxID_ANY,_T("Update cyclically"));
- gSizer->Add(m_followPathCB,1,wxEXPAND);
-
- zoomInButton=new wxButton(rootPanel,wxID_ANY,_T("Zoom In"));
- gSizer->Add(zoomInButton,1,wxEXPAND);
- zoomOutButton=new wxButton(rootPanel,wxID_ANY,_T("Zoom Out"));
- gSizer->Add(zoomOutButton,1,wxEXPAND);
-
- traceButton=new wxButton(rootPanel,wxID_ANY,_T("Load Tracefile"));
- gSizer->Add(traceButton,1,wxEXPAND);
-
- infoButton=new wxButton(rootPanel,wxID_ANY,_T("About"));
- gSizer->Add(infoButton,1,wxEXPAND);
-
- SetDoubleBuffered(true);
-
- getLocation(false,NULL);
-
- m_timer = new wxTimer(this,1);
- m_timer->Start(8000);
-}
-
-
-
-LocDemoWin::~LocDemoWin()
-{
- wxInt32 x,y;
-
- for (x=-1; x<=1; x++)
- for (y=-1; y<=1; y++) if (locTile[x+1][y+1]) delete locTile[x+1][y+1];
-}
-
-
-/**
- * Timer callback function, it is called cyclically and in case the m_followPathCB check box is
- * checked it updates the current position by calling getLocation()
- */
-void LocDemoWin::OnTimer(wxTimerEvent& WXUNUSED(event))
-{
- if (m_followPathCB->GetValue())
- {
- m_timer->Stop();
- getLocation(true,NULL);
- Refresh();
- m_timer->Start();
- }
-}
-
-
-
-/**
- * Gets the horizontal part of a tile number out of a given position
- * @param[in] lon the longitude to get the tile number for
- * @param[in] z the zoom level to get the tile number for
- * @return the tiles x number
- */
-static int long2tilex(double lon, int z)
-{
- return (int)(floor((lon + 180.0) / 360.0 * pow(2.0, z)));
-}
-
-
-
-/**
- * Gets the vertical part of a tile number out of a given position
- * @param[in] lat the latitude to get the tile number for
- * @param[in] z the zoom level to get the tile number for
- * @return the tiles y number
- */
-static int lat2tiley(double lat, int z)
-{
- return (int)(floor((1.0 - log( tan(lat * M_PI/180.0) + 1.0 / cos(lat * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, z)));
-}
-
-
-
-/**
- * Gets the longitude of the side edge of a tile out of a given horizontal
- * tile number
- * @param[in] x the horizontal tile number
- * @param[in] z the zoom level to get the tile number for
- * @return the longitude of the left position of the tile
- */
-static double tilex2long(int x, int z)
-{
- return x / pow(2.0, z) * 360.0 - 180;
-}
-
-
-
-/**
- * Gets the latitude of the upper side of a tile out of a given vertical
- * tile number
- * @param[in] y the vertical tile number
- * @param[in] z the zoom level to get the tile number for
- * @return the latitude of the upper position of the tile
- */
-static double tiley2lat(int y, int z)
-{
- double n = M_PI - 2.0 * M_PI * y / pow(2.0, z);
- return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)));
-}
-
-
-
-/**
- * The paint callback, here the map tiles, the path (if it has a size >=2)
- * and the current position including its deviation are drawn
- */
-void LocDemoWin::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
- wxInt32 x,y;
- double tileLat1,tileLon1,tileLat2,tileLon2;
- wxPaintDC dc(this);
- wxPen borderPen(*wxRED,3);
- wxPen pathPen(*wxBLUE,2);
- list<double>::iterator itLat,itLon;
-
- for (x=-1; x<=1; x++)
- for (y=-1; y<=1; y++)
- {
- if (locTile[x+1][y+1])
- {
- dc.DrawBitmap(*locTile[x+1][y+1],((x+1)*256)+X_OFFSET,(y+1)*256,false);
- }
- }
-
- tileLat1=tiley2lat(m_tileY,m_zoom);
- tileLat2=tiley2lat(m_tileY+1,m_zoom);
- tileLon1=tilex2long(m_tileX,m_zoom);
- tileLon2=tilex2long(m_tileX+1,m_zoom);
-
- dc.SetBrush(*wxTRANSPARENT_BRUSH);
- if (m_latList.size()>1)
- {
- double currY,currX,prevY,prevX;
-
- dc.SetPen(pathPen);
- itLat=m_latList.begin(); itLat++;
- itLon=m_lonList.begin(); itLon++;
- prevY=256+ (256.0*(*itLat-tileLat1)/(tileLat2-tileLat1));
- prevX=256+X_OFFSET+(256.0*(*itLon-tileLon1)/(tileLon2-tileLon1));
- for ( ; itLat!= m_latList.end(); itLat++ )
- {
- currY=256+ (256.0*(*itLat-tileLat1)/(tileLat2-tileLat1));
- currX=256+X_OFFSET+(256.0*(*itLon-tileLon1)/(tileLon2-tileLon1));
- dc.DrawLine(prevX,prevY,currX,currY);
- prevY=currY;
- prevX=currX;
- itLon++;
- }
- }
-
- y=256+ (256.0*(m_lat-tileLat1)/(tileLat2-tileLat1));
- x=256+X_OFFSET+(256.0*(m_lon-tileLon1)/(tileLon2-tileLon1));
-
- if ((x!=0) && (y!=0))
- {
- wxFloat64 zoomFactor;
-
- dc.SetPen(borderPen);
- if (m_quality>0)
- {
- zoomFactor=pow(2.0,(17.0-m_zoom));
- dc.DrawCircle(x,y,(120-m_quality)/zoomFactor);
- }
- else
- {
- zoomFactor=pow(2.0,(10.0-m_zoom));
- dc.DrawCircle(x,y,130/zoomFactor);
- }
- }
-}
-
-
-
-/**
- * This method updates the internal locTile array that holds bitmaps of the tiles that have to be
- * displayed currently. To get the tile images it first tries to load a local PNG image. In case
- * that fails the TAH server is connected to download and save a tile image in PNG format. Then it
- * tries again to load the local PNG image - now it should be successful because it was downloaded
- * just one step before.
- * @param[in] lat the latitude of the current position which has to be displayed in center tile
- * @param[in] lon the longitude of the current position which has to be displayed in center tile
- */
-void LocDemoWin::updateTiles(wxFloat64 lat,wxFloat64 lon)
-{
- wxInt32 x,y;
- wxHTTP *get;
- wxString path;
- wxInputStream *httpStream;
- wxImage *tmpImage;
-
- m_tileX=long2tilex(lon,m_zoom);
- m_tileY=lat2tiley(lat,m_zoom);
-
- for (x=-1; x<=1; x++)
- for (y=-1; y<=1; y++)
- {
- if (locTile[x+1][y+1]) delete locTile[x+1][y+1];
- locTile[x+1][y+1]=NULL;
-
- if (!wxFile::Exists(wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y)))
- {
- get=new wxHTTP();
- get->SetTimeout(10); // 10 seconds of timeout instead of 10 minutes ...
- get->SetHeader(_T("User-Agent"),_T("LocDemo libwlocate demo application"));
- while (!get->Connect(_T("a.tile.openstreetmap.org")))
- wxSleep(5);
-
- path=wxString::Format(_T("/%d/%d/%d.png"),m_zoom,m_tileX+x,m_tileY+y);
- httpStream = get->GetInputStream(path);
- if (get->GetError() == wxPROTO_NOERR)
- {
- wxFile *FHandle;
-
- wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir());
- path=wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y);
- FHandle=new wxFile(path,wxFile::write);
- if ((FHandle) && (FHandle->IsOpened()))
- {
- void *mem;
-
- mem=malloc(httpStream->GetSize());
- if (mem)
- {
- httpStream->Read(mem,httpStream->GetSize());
- FHandle->Write(mem,httpStream->GetSize());
- delete FHandle;
- free(mem);
- }
- }
- wxDELETE(httpStream);
- }
- get->Close();
- delete get;
- }
- path=wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y);
- tmpImage=new wxImage(path,wxBITMAP_TYPE_PNG);
- if ((tmpImage) && (tmpImage->Ok()))
- {
- locTile[x+1][y+1]=new wxBitmap(*tmpImage);
- delete tmpImage;
- }
- }
-}
-
-
-
-/**
- * Here the current geolocation is evaluated by calling the related function of libwlocate.
- * Afterwards the tiles are updated and drawn.
- * @param[in] silent if this value is set to true no splash screen is displayed during
- * position and tile update
- */
-void LocDemoWin::getLocation(bool silent,struct wloc_req *requestData)
-{
- wxInt32 ret;
- wxFrame *splash=NULL;
-
- if (!silent)
- {
- splash = new wxFrame(NULL,wxID_ANY,_T("Getting Position Data and Map"),wxDefaultPosition,wxSize(500,80),wxSTAY_ON_TOP|wxFRAME_NO_TASKBAR|wxCAPTION);
- new wxStaticText(splash,wxID_ANY,_T("Operation in progress, please wait..."),wxPoint(20,30));
- splash->Center();
-#ifndef _DEBUG
- splash->Show();
-#endif
- }
-
- m_lat=0;
- m_lon=0;
- m_quality=0;
- if (!requestData) ret=wloc_get_location(&m_lat,&m_lon,&m_quality,&m_ccode);
- else
- {
- ret=get_position(requestData,&m_lat,&m_lon,&m_quality,&m_ccode);
- if (ret!=WLOC_OK) printf("Loading trace location failed...");
- }
- if (ret==WLOC_OK)
- {
- char country[3]={0,0,0};
- wxMBConvUTF8 conv;
- wchar_t wc[3];
-
- m_latField->SetValue(_T("")); *m_latField<<m_lat;
- m_lonField->SetValue(_T("")); *m_lonField<<m_lon;
- if (m_quality<0) m_quality=1;
- if (m_quality>0)
- {
- m_latList.push_back(m_lat);
- m_lonList.push_back(m_lon);
- }
- else if (m_traceMode) return; // do not use IP-Data only in case of trace mode
-
- m_qualityField->SetValue(_T("")); *m_qualityField<<m_quality;
- if (!m_followPathCB->GetValue())
- {
- if (m_quality==0) m_zoom=10;
- else
- {
- if (!m_traceMode) m_zoom=17;
- }
- }
- if (wloc_get_country_from_code(m_ccode,country)==WLOC_OK)
- {
- conv.MB2WC(wc,country,3);
- m_countryField->SetValue(_T("")); *m_countryField<<wc;
- }
- else m_countryField->SetValue(_T("?"));
-
- updateTiles(m_lat,m_lon);
- if (!silent) splash->Close();
- delete splash;
- }
- else if (!requestData)
- {
- m_latField->SetValue(_T("---"));
- m_lonField->SetValue(_T("---"));
- m_qualityField->SetValue(_T("---"));
- m_countryField->SetValue(_T("--"));
- splash->Close();
- delete splash;
- if (ret==WLOC_CONNECTION_ERROR)
- wxMessageBox(_T("Could not connect to server and retrieve data!"),_T("Error"),wxOK|wxICON_ERROR);
- else if (ret==WLOC_LOCATION_ERROR)
- wxMessageBox(_T("Could not retrieve location, no data available for your position!"),_T("Error"),wxOK|wxICON_ERROR);
- else
- wxMessageBox(_T("Could not retrieve location, an unidentified error happened :-("),_T("Error"),wxOK|wxICON_ERROR);
- }
-}
-
-
-
-/**
- * The button event handler, here the functionality of the zoom and about buttons are managed
- */
-void LocDemoWin::OnButton(wxCommandEvent &event)
-{
- if (event.GetId()==updateButton->GetId())
- {
- getLocation(false,NULL);
- Refresh();
- }
- else if (event.GetId()==zoomOutButton->GetId())
- {
- if (m_zoom>2) m_zoom--;
- updateTiles(m_lat,m_lon);
- Refresh();
- }
- else if (event.GetId()==zoomInButton->GetId())
- {
- if (m_zoom<17) m_zoom++;
- updateTiles(m_lat,m_lon);
- Refresh();
- }
- else if (event.GetId()==traceButton->GetId())
- {
- FILE *FHandle;
- wxInt32 i,ret=1;
- struct wloc_req requestData,prevData;
- wxPaintEvent pEvent;
-
- wxFileDialog* openFileDialog=new wxFileDialog( this,_T("Load trace file"),wxEmptyString,wxEmptyString,_T("Trace-File |*.trace|All files|*.*"),wxFD_OPEN, wxDefaultPosition);
- if ( openFileDialog->ShowModal() == wxID_OK )
- {
- wxString path;
- wxMBConvLibc conv;
- char cPath[300+1];
-
- path=openFileDialog->GetDirectory()+wxFileName::GetPathSeparator()+openFileDialog->GetFilename();
- conv.WC2MB(cPath,path,300);
- memset(&requestData,0,sizeof(struct wloc_req));
- memset(&prevData,0,sizeof(struct wloc_req));
- m_followPathCB->SetValue(false);
- m_latList.clear();
- m_lonList.clear();
- Refresh();
- FHandle=fopen(cPath,"rb");
- if (FHandle)
- {
- m_traceMode=true;
- memset(&requestData,0,sizeof(struct wloc_req));
- while (ret>0)
- {
- for (i=0; i<WLOC_MAX_NETWORKS; i++)
- {
- char signal_unused;
-
- fread(&requestData.bssids[i],1,sizeof(requestData.bssids[i]),FHandle);
- ret=fread(&signal_unused,1,1,FHandle);
- }
- if (notEqual(&requestData,&prevData)) getLocation(true,&requestData);
- prevData=requestData;
- OnPaint(pEvent);
- }
- fclose(FHandle);
- }
- else wxMessageBox(_T("Could not find trace file!"),_T("Error"),wxOK|wxICON_ERROR);
- m_traceMode=false;
- }
- }
- else if (event.GetId()==infoButton->GetId()) wxMessageBox(_T("LocDemo Version 2.0 is (c) 2010-2014 by Oxy/VWP\nIt demonstrates the usage of libwlocate and is available under the terms of the GNU Public License\nFor more details please refer to http://www.openwlanmap.org"),_T("Information"),wxOK|wxICON_INFORMATION);
-}
-
-
-
-bool LocDemoWin::notEqual(struct wloc_req *data1,struct wloc_req *data2)
-{
- wxUint32 i,j;
-
- for (i=0; i<WLOC_MAX_NETWORKS; i++)
- {
-// if (data1->signal[i]!=data2->signal[i]) return true;
- for (j=0; j<6; j++)
- {
- if (data1->bssids[i][j]!=data2->bssids[i][j]) return true;
- }
- }
- return false;
-}
-
-
-
+/**
+ * LocDemo - a demo GUI application that uses libwlocate to display the
+ * current geographic position
+ * Copyright (C) 2010-2014 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <list>
+
+#include "LocDemoWin.h"
+
+#include <wx/sstream.h>
+#include <wx/protocol/http.h>
+#include <wx/file.h>
+#include <wx/sizer.h>
+#include <wx/stdpaths.h>
+#include <wx/filename.h>
+#include <wx/timer.h>
+
+#include "libwlocate.h"
+
+using namespace std;
+
+#define X_OFFSET 162
+
+extern "C"
+{
+ extern int get_position(struct wloc_req *request,double *lat,double *lon,char *quality,short *ccode);
+}
+
+IMPLEMENT_CLASS(LocDemoWin, wxFrame)
+
+BEGIN_EVENT_TABLE(LocDemoWin, wxFrame)
+ EVT_BUTTON(wxID_ANY,LocDemoWin::OnButton)
+ EVT_PAINT(LocDemoWin::OnPaint)
+ EVT_TIMER(1,LocDemoWin::OnTimer)
+END_EVENT_TABLE()
+
+
+/**
+* Main constructor, here the window and the ui-elements on the left are created and added to some sizers
+*/
+LocDemoWin::LocDemoWin(const wxString& title)
+ :wxFrame(NULL, wxID_ANY, title, wxPoint(20,0), wxSize(930,768),wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxCLIP_CHILDREN)
+{
+ wxInt32 x,y;
+
+ for (x=-1; x<=1; x++)
+ for (y=-1; y<=1; y++) locTile[x+1][y+1]=NULL;
+
+ m_zoom=17;
+ m_traceMode=false;
+
+ SetBackgroundColour(*wxWHITE);
+ wxFlexGridSizer *fSizer=new wxFlexGridSizer(1,2,2,2);
+ this->SetSizer(fSizer);
+ fSizer->AddGrowableCol(0,1);
+ fSizer->AddGrowableCol(1,10);
+ wxPanel *rootPanel=new wxPanel(this);//,WXID_ANY,wxDefaultPos,wxSize(X_OFFSET,750));
+ fSizer->Add(rootPanel);
+
+ wxGridSizer *gSizer=new wxGridSizer(12,1,2,2);
+ rootPanel->SetBackgroundColour(*wxWHITE);
+ rootPanel->SetSizer(gSizer);
+
+ wxStaticText *text=new wxStaticText(rootPanel,wxID_ANY,_T(""));
+ gSizer->Add(text,0,wxALIGN_LEFT);
+ updateButton=new wxButton(rootPanel,wxID_ANY,_T("Update Position"));
+ gSizer->Add(updateButton,1,wxEXPAND);
+
+ text=new wxStaticText(rootPanel,wxID_ANY,_T("Latitude:"));
+ gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+ m_latField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
+ gSizer->Add(m_latField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+
+ text=new wxStaticText(rootPanel,wxID_ANY,_T("Longitude:"));
+ gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+ m_lonField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
+ gSizer->Add(m_lonField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+
+ text=new wxStaticText(rootPanel,wxID_ANY,_T("Quality:"));
+ gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+ m_qualityField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
+ gSizer->Add(m_qualityField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+
+ text=new wxStaticText(rootPanel,wxID_ANY,_T("Country:"));
+ gSizer->Add(text,0,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+ m_countryField=new wxTextCtrl(rootPanel,wxID_ANY,wxEmptyString,wxDefaultPosition,wxDefaultSize,wxTE_READONLY);
+ gSizer->Add(m_countryField,1,wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
+
+ m_followPathCB=new wxCheckBox(rootPanel,wxID_ANY,_T("Update cyclically"));
+ gSizer->Add(m_followPathCB,1,wxEXPAND);
+
+ zoomInButton=new wxButton(rootPanel,wxID_ANY,_T("Zoom In"));
+ gSizer->Add(zoomInButton,1,wxEXPAND);
+ zoomOutButton=new wxButton(rootPanel,wxID_ANY,_T("Zoom Out"));
+ gSizer->Add(zoomOutButton,1,wxEXPAND);
+
+ traceButton=new wxButton(rootPanel,wxID_ANY,_T("Load Tracefile"));
+ gSizer->Add(traceButton,1,wxEXPAND);
+
+ infoButton=new wxButton(rootPanel,wxID_ANY,_T("About"));
+ gSizer->Add(infoButton,1,wxEXPAND);
+
+ SetDoubleBuffered(true);
+
+ getLocation(false,NULL);
+
+ m_timer = new wxTimer(this,1);
+ m_timer->Start(8000);
+}
+
+
+
+LocDemoWin::~LocDemoWin()
+{
+ wxInt32 x,y;
+
+ for (x=-1; x<=1; x++)
+ for (y=-1; y<=1; y++) if (locTile[x+1][y+1]) delete locTile[x+1][y+1];
+}
+
+
+/**
+ * Timer callback function, it is called cyclically and in case the m_followPathCB check box is
+ * checked it updates the current position by calling getLocation()
+ */
+void LocDemoWin::OnTimer(wxTimerEvent& WXUNUSED(event))
+{
+ if (m_followPathCB->GetValue())
+ {
+ m_timer->Stop();
+ getLocation(true,NULL);
+ Refresh();
+ m_timer->Start();
+ }
+}
+
+
+
+/**
+ * Gets the horizontal part of a tile number out of a given position
+ * @param[in] lon the longitude to get the tile number for
+ * @param[in] z the zoom level to get the tile number for
+ * @return the tiles x number
+ */
+static int long2tilex(double lon, int z)
+{
+ return (int)(floor((lon + 180.0) / 360.0 * pow(2.0, z)));
+}
+
+
+
+/**
+ * Gets the vertical part of a tile number out of a given position
+ * @param[in] lat the latitude to get the tile number for
+ * @param[in] z the zoom level to get the tile number for
+ * @return the tiles y number
+ */
+static int lat2tiley(double lat, int z)
+{
+ return (int)(floor((1.0 - log( tan(lat * M_PI/180.0) + 1.0 / cos(lat * M_PI/180.0)) / M_PI) / 2.0 * pow(2.0, z)));
+}
+
+
+
+/**
+ * Gets the longitude of the side edge of a tile out of a given horizontal
+ * tile number
+ * @param[in] x the horizontal tile number
+ * @param[in] z the zoom level to get the tile number for
+ * @return the longitude of the left position of the tile
+ */
+static double tilex2long(int x, int z)
+{
+ return x / pow(2.0, z) * 360.0 - 180;
+}
+
+
+
+/**
+ * Gets the latitude of the upper side of a tile out of a given vertical
+ * tile number
+ * @param[in] y the vertical tile number
+ * @param[in] z the zoom level to get the tile number for
+ * @return the latitude of the upper position of the tile
+ */
+static double tiley2lat(int y, int z)
+{
+ double n = M_PI - 2.0 * M_PI * y / pow(2.0, z);
+ return 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n)));
+}
+
+
+
+/**
+ * The paint callback, here the map tiles, the path (if it has a size >=2)
+ * and the current position including its deviation are drawn
+ */
+void LocDemoWin::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxInt32 x,y;
+ double tileLat1,tileLon1,tileLat2,tileLon2;
+ wxPaintDC dc(this);
+ wxPen borderPen(*wxRED,3);
+ wxPen pathPen(*wxBLUE,2);
+ list<double>::iterator itLat,itLon;
+
+ for (x=-1; x<=1; x++)
+ for (y=-1; y<=1; y++)
+ {
+ if (locTile[x+1][y+1])
+ {
+ dc.DrawBitmap(*locTile[x+1][y+1],((x+1)*256)+X_OFFSET,(y+1)*256,false);
+ }
+ }
+
+ tileLat1=tiley2lat(m_tileY,m_zoom);
+ tileLat2=tiley2lat(m_tileY+1,m_zoom);
+ tileLon1=tilex2long(m_tileX,m_zoom);
+ tileLon2=tilex2long(m_tileX+1,m_zoom);
+
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ if (m_latList.size()>1)
+ {
+ double currY,currX,prevY,prevX;
+
+ dc.SetPen(pathPen);
+ itLat=m_latList.begin(); itLat++;
+ itLon=m_lonList.begin(); itLon++;
+ prevY=256+ (256.0*(*itLat-tileLat1)/(tileLat2-tileLat1));
+ prevX=256+X_OFFSET+(256.0*(*itLon-tileLon1)/(tileLon2-tileLon1));
+ for ( ; itLat!= m_latList.end(); itLat++ )
+ {
+ currY=256+ (256.0*(*itLat-tileLat1)/(tileLat2-tileLat1));
+ currX=256+X_OFFSET+(256.0*(*itLon-tileLon1)/(tileLon2-tileLon1));
+ dc.DrawLine(prevX,prevY,currX,currY);
+ prevY=currY;
+ prevX=currX;
+ itLon++;
+ }
+ }
+
+ y=256+ (256.0*(m_lat-tileLat1)/(tileLat2-tileLat1));
+ x=256+X_OFFSET+(256.0*(m_lon-tileLon1)/(tileLon2-tileLon1));
+
+ if ((x!=0) && (y!=0))
+ {
+ wxFloat64 zoomFactor;
+
+ dc.SetPen(borderPen);
+ if (m_quality>0)
+ {
+ zoomFactor=pow(2.0,(17.0-m_zoom));
+ dc.DrawCircle(x,y,(120-m_quality)/zoomFactor);
+ }
+ else
+ {
+ zoomFactor=pow(2.0,(10.0-m_zoom));
+ dc.DrawCircle(x,y,130/zoomFactor);
+ }
+ }
+}
+
+
+
+/**
+ * This method updates the internal locTile array that holds bitmaps of the tiles that have to be
+ * displayed currently. To get the tile images it first tries to load a local PNG image. In case
+ * that fails the TAH server is connected to download and save a tile image in PNG format. Then it
+ * tries again to load the local PNG image - now it should be successful because it was downloaded
+ * just one step before.
+ * @param[in] lat the latitude of the current position which has to be displayed in center tile
+ * @param[in] lon the longitude of the current position which has to be displayed in center tile
+ */
+void LocDemoWin::updateTiles(wxFloat64 lat,wxFloat64 lon)
+{
+ wxInt32 x,y;
+ wxHTTP *get;
+ wxString path;
+ wxInputStream *httpStream;
+ wxImage *tmpImage;
+
+ m_tileX=long2tilex(lon,m_zoom);
+ m_tileY=lat2tiley(lat,m_zoom);
+
+ for (x=-1; x<=1; x++)
+ for (y=-1; y<=1; y++)
+ {
+ if (locTile[x+1][y+1]) delete locTile[x+1][y+1];
+ locTile[x+1][y+1]=NULL;
+
+ if (!wxFile::Exists(wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y)))
+ {
+ get=new wxHTTP();
+ get->SetTimeout(10); // 10 seconds of timeout instead of 10 minutes ...
+ get->SetHeader(_T("User-Agent"),_T("LocDemo libwlocate demo application"));
+ while (!get->Connect(_T("a.tile.openstreetmap.org")))
+ wxSleep(5);
+
+ path=wxString::Format(_T("/%d/%d/%d.png"),m_zoom,m_tileX+x,m_tileY+y);
+ httpStream = get->GetInputStream(path);
+ if (get->GetError() == wxPROTO_NOERR)
+ {
+ wxFile *FHandle;
+
+ wxFileName::Mkdir(wxStandardPaths::Get().GetUserDataDir());
+ path=wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y);
+ FHandle=new wxFile(path,wxFile::write);
+ if ((FHandle) && (FHandle->IsOpened()))
+ {
+ void *mem;
+
+ mem=malloc(httpStream->GetSize());
+ if (mem)
+ {
+ httpStream->Read(mem,httpStream->GetSize());
+ FHandle->Write(mem,httpStream->GetSize());
+ delete FHandle;
+ free(mem);
+ }
+ }
+ wxDELETE(httpStream);
+ }
+ get->Close();
+ delete get;
+ }
+ path=wxStandardPaths::Get().GetUserDataDir()+wxFileName::GetPathSeparator()+wxString::Format(_T("tile_%d_%d_%d.png"),m_zoom,m_tileX+x,m_tileY+y);
+ tmpImage=new wxImage(path,wxBITMAP_TYPE_PNG);
+ if ((tmpImage) && (tmpImage->Ok()))
+ {
+ locTile[x+1][y+1]=new wxBitmap(*tmpImage);
+ delete tmpImage;
+ }
+ }
+}
+
+
+
+/**
+ * Here the current geolocation is evaluated by calling the related function of libwlocate.
+ * Afterwards the tiles are updated and drawn.
+ * @param[in] silent if this value is set to true no splash screen is displayed during
+ * position and tile update
+ */
+void LocDemoWin::getLocation(bool silent,struct wloc_req *requestData)
+{
+ wxInt32 ret;
+ wxFrame *splash=NULL;
+
+ if (!silent)
+ {
+ splash = new wxFrame(NULL,wxID_ANY,_T("Getting Position Data and Map"),wxDefaultPosition,wxSize(500,80),wxSTAY_ON_TOP|wxFRAME_NO_TASKBAR|wxCAPTION);
+ new wxStaticText(splash,wxID_ANY,_T("Operation in progress, please wait..."),wxPoint(20,30));
+ splash->Center();
+#ifndef _DEBUG
+ splash->Show();
+#endif
+ }
+
+ m_lat=0;
+ m_lon=0;
+ m_quality=0;
+ if (!requestData) ret=wloc_get_location(&m_lat,&m_lon,&m_quality,&m_ccode);
+ else
+ {
+ ret=get_position(requestData,&m_lat,&m_lon,&m_quality,&m_ccode);
+ if (ret!=WLOC_OK) printf("Loading trace location failed...");
+ }
+ if (ret==WLOC_OK)
+ {
+ char country[3]={0,0,0};
+ wxMBConvUTF8 conv;
+ wchar_t wc[3];
+
+ m_latField->SetValue(_T("")); *m_latField<<m_lat;
+ m_lonField->SetValue(_T("")); *m_lonField<<m_lon;
+ if (m_quality<0) m_quality=1;
+ if (m_quality>0)
+ {
+ m_latList.push_back(m_lat);
+ m_lonList.push_back(m_lon);
+ }
+ else if (m_traceMode) return; // do not use IP-Data only in case of trace mode
+
+ m_qualityField->SetValue(_T("")); *m_qualityField<<m_quality;
+ if (!m_followPathCB->GetValue())
+ {
+ if (m_quality==0) m_zoom=10;
+ else
+ {
+ if (!m_traceMode) m_zoom=17;
+ }
+ }
+ if (wloc_get_country_from_code(m_ccode,country)==WLOC_OK)
+ {
+ conv.MB2WC(wc,country,3);
+ m_countryField->SetValue(_T("")); *m_countryField<<wc;
+ }
+ else m_countryField->SetValue(_T("?"));
+
+ updateTiles(m_lat,m_lon);
+ if (!silent) splash->Close();
+ delete splash;
+ }
+ else if (!requestData)
+ {
+ m_latField->SetValue(_T("---"));
+ m_lonField->SetValue(_T("---"));
+ m_qualityField->SetValue(_T("---"));
+ m_countryField->SetValue(_T("--"));
+ splash->Close();
+ delete splash;
+ if (ret==WLOC_CONNECTION_ERROR)
+ wxMessageBox(_T("Could not connect to server and retrieve data!"),_T("Error"),wxOK|wxICON_ERROR);
+ else if (ret==WLOC_LOCATION_ERROR)
+ wxMessageBox(_T("Could not retrieve location, no data available for your position!"),_T("Error"),wxOK|wxICON_ERROR);
+ else
+ wxMessageBox(_T("Could not retrieve location, an unidentified error happened :-("),_T("Error"),wxOK|wxICON_ERROR);
+ }
+}
+
+
+
+/**
+ * The button event handler, here the functionality of the zoom and about buttons are managed
+ */
+void LocDemoWin::OnButton(wxCommandEvent &event)
+{
+ if (event.GetId()==updateButton->GetId())
+ {
+ getLocation(false,NULL);
+ Refresh();
+ }
+ else if (event.GetId()==zoomOutButton->GetId())
+ {
+ if (m_zoom>2) m_zoom--;
+ updateTiles(m_lat,m_lon);
+ Refresh();
+ }
+ else if (event.GetId()==zoomInButton->GetId())
+ {
+ if (m_zoom<17) m_zoom++;
+ updateTiles(m_lat,m_lon);
+ Refresh();
+ }
+ else if (event.GetId()==traceButton->GetId())
+ {
+ FILE *FHandle;
+ wxInt32 i,ret=1;
+ struct wloc_req requestData,prevData;
+ wxPaintEvent pEvent;
+
+ wxFileDialog* openFileDialog=new wxFileDialog( this,_T("Load trace file"),wxEmptyString,wxEmptyString,_T("Trace-File |*.trace|All files|*.*"),wxFD_OPEN, wxDefaultPosition);
+ if ( openFileDialog->ShowModal() == wxID_OK )
+ {
+ wxString path;
+ wxMBConvLibc conv;
+ char cPath[300+1];
+
+ path=openFileDialog->GetDirectory()+wxFileName::GetPathSeparator()+openFileDialog->GetFilename();
+ conv.WC2MB(cPath,path,300);
+ memset(&requestData,0,sizeof(struct wloc_req));
+ memset(&prevData,0,sizeof(struct wloc_req));
+ m_followPathCB->SetValue(false);
+ m_latList.clear();
+ m_lonList.clear();
+ Refresh();
+ FHandle=fopen(cPath,"rb");
+ if (FHandle)
+ {
+ m_traceMode=true;
+ memset(&requestData,0,sizeof(struct wloc_req));
+ while (ret>0)
+ {
+ for (i=0; i<WLOC_MAX_NETWORKS; i++)
+ {
+ char signal_unused;
+
+ fread(&requestData.bssids[i],1,sizeof(requestData.bssids[i]),FHandle);
+ ret=fread(&signal_unused,1,1,FHandle);
+ }
+ if (notEqual(&requestData,&prevData)) getLocation(true,&requestData);
+ prevData=requestData;
+ OnPaint(pEvent);
+ }
+ fclose(FHandle);
+ }
+ else wxMessageBox(_T("Could not find trace file!"),_T("Error"),wxOK|wxICON_ERROR);
+ m_traceMode=false;
+ }
+ }
+ else if (event.GetId()==infoButton->GetId()) wxMessageBox(_T("LocDemo Version 2.0 is (c) 2010-2014 by Oxy/VWP\nIt demonstrates the usage of libwlocate and is available under the terms of the GNU Public License\nFor more details please refer to http://www.openwlanmap.org"),_T("Information"),wxOK|wxICON_INFORMATION);
+}
+
+
+
+bool LocDemoWin::notEqual(struct wloc_req *data1,struct wloc_req *data2)
+{
+ wxUint32 i,j;
+
+ for (i=0; i<WLOC_MAX_NETWORKS; i++)
+ {
+// if (data1->signal[i]!=data2->signal[i]) return true;
+ for (j=0; j<6; j++)
+ {
+ if (data1->bssids[i][j]!=data2->bssids[i][j]) return true;
+ }
+ }
+ return false;
+}
+
+
+
diff --git a/master/locdemo/LocDemoWin.h b/master/locdemo/LocDemoWin.h
index ecc8c5b..3e50464 100755
--- a/master/locdemo/LocDemoWin.h
+++ b/master/locdemo/LocDemoWin.h
@@ -1,56 +1,56 @@
-/**
- * LocDemo - a demo GUI application that uses libwlocate to display the
- * current geographic position
- * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <wx/wx.h>
-#include <wx/spinctrl.h>
-
-#include <list>
-
-class LocDemoWin : public wxFrame
-{
-public:
- LocDemoWin(const wxString& title);
- virtual ~LocDemoWin();
-
-private:
- void OnButton(wxCommandEvent &event);
- void OnPaint(wxPaintEvent& event);
- void OnTimer(wxTimerEvent& event);
- void updateTiles(wxFloat64 lat,wxFloat64 lon);
- void getLocation(bool silent,struct wloc_req *requestData);
- bool notEqual(struct wloc_req *data1,struct wloc_req *prevData);
-
-
- wxButton *updateButton,*infoButton,*zoomInButton,*zoomOutButton,*traceButton;
- wxBitmap *locTile[3][3];
- wxInt32 m_tileX,m_tileY;
- wxTextCtrl *m_latField,*m_lonField,*m_qualityField,*m_countryField;
- wxCheckBox *m_followPathCB;
- double m_lat,m_lon;
- char m_quality;
- short m_ccode;
- wxByte m_zoom;
- wxTimer *m_timer;
- std::list<double> m_latList,m_lonList;
- bool m_traceMode;
-
- DECLARE_CLASS(LocDemoWin)
- DECLARE_EVENT_TABLE()
-};
-
+/**
+ * LocDemo - a demo GUI application that uses libwlocate to display the
+ * current geographic position
+ * Copyright (C) 2010 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <wx/wx.h>
+#include <wx/spinctrl.h>
+
+#include <list>
+
+class LocDemoWin : public wxFrame
+{
+public:
+ LocDemoWin(const wxString& title);
+ virtual ~LocDemoWin();
+
+private:
+ void OnButton(wxCommandEvent &event);
+ void OnPaint(wxPaintEvent& event);
+ void OnTimer(wxTimerEvent& event);
+ void updateTiles(wxFloat64 lat,wxFloat64 lon);
+ void getLocation(bool silent,struct wloc_req *requestData);
+ bool notEqual(struct wloc_req *data1,struct wloc_req *prevData);
+
+
+ wxButton *updateButton,*infoButton,*zoomInButton,*zoomOutButton,*traceButton;
+ wxBitmap *locTile[3][3];
+ wxInt32 m_tileX,m_tileY;
+ wxTextCtrl *m_latField,*m_lonField,*m_qualityField,*m_countryField;
+ wxCheckBox *m_followPathCB;
+ double m_lat,m_lon;
+ char m_quality;
+ short m_ccode;
+ wxByte m_zoom;
+ wxTimer *m_timer;
+ std::list<double> m_latList,m_lonList;
+ bool m_traceMode;
+
+ DECLARE_CLASS(LocDemoWin)
+ DECLARE_EVENT_TABLE()
+};
+
diff --git a/master/locdemo/Makefile b/master/locdemo/Makefile
index cc469c0..a38075a 100755
--- a/master/locdemo/Makefile
+++ b/master/locdemo/Makefile
@@ -1,32 +1,32 @@
-PROGRAM = LocDemo
-
-INCLUDEDIRS = -I/usr/X11R6/include -I.. $(shell wx-config --cflags) $(shell pkg-config gtk+-2.0 --cflags)
-
+PROGRAM = LocDemo
+
+INCLUDEDIRS = -I/usr/X11R6/include -I.. $(shell wx-config --cflags) $(shell pkg-config gtk+-2.0 --cflags)
+
LIBDIRS = -L/usr/X11R6/lib -L/usr/lib -L..
-LIBS = $(shell wx-config --libs) -lwlocate
-
-DBGFLAGS = -O2 -g0 -DNDEBUG
-STRIP=strip
-ifeq ($(DEBUG),1)
-DBGFLAGS = -O0 -g3 -DNOSPLASH
-STRIP=ls -al
-endif
-
-CXXSOURCES = LocDemoApp.cpp LocDemoWin.cpp
-
-CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
-CXXFLAGS = -Wall -Wno-unused-local-typedefs -DESRI_UNIX -DENV_LINUX $(INCLUDEDIRS) $(DBGFLAGS)
-CXX = g++
-
-LDFLAGS = $(LIBDIRS) $(LIBS)
-
-all: $(PROGRAM)
-
-$(PROGRAM): $(CXXOBJECTS)
- $(CXX) -o $@ $(CXXOBJECTS) $(LDFLAGS)
- $(STRIP) $(PROGRAM)
-
-clean:
- $(RM) -f $(CXXOBJECTS) $(PROGRAM)
-
+LIBS = $(shell wx-config --libs) -lwlocate
+
+DBGFLAGS = -O2 -g0 -DNDEBUG
+STRIP=strip
+ifeq ($(DEBUG),1)
+DBGFLAGS = -O0 -g3 -DNOSPLASH
+STRIP=ls -al
+endif
+
+CXXSOURCES = LocDemoApp.cpp LocDemoWin.cpp
+
+CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
+CXXFLAGS = -Wall -Wno-unused-local-typedefs -DESRI_UNIX -DENV_LINUX $(INCLUDEDIRS) $(DBGFLAGS)
+CXX = g++
+
+LDFLAGS = $(LIBDIRS) $(LIBS)
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(CXXOBJECTS)
+ $(CXX) -o $@ $(CXXOBJECTS) $(LDFLAGS)
+ $(STRIP) $(PROGRAM)
+
+clean:
+ $(RM) -f $(CXXOBJECTS) $(PROGRAM)
+
diff --git a/master/locdemo/Makefile.QNX b/master/locdemo/Makefile.QNX
index eff9e5c..4f4d446 100755
--- a/master/locdemo/Makefile.QNX
+++ b/master/locdemo/Makefile.QNX
@@ -1,30 +1,30 @@
-PROGRAM = LocDemo
-
-INCLUDEDIRS = -I/usr/X11R6/include -I.. $(shell wx-config --cflags) $(shell pkg-config gtk+-2.0 --cflags)
-
-LIBDIRS = -L/usr/X11R6/lib -L/usr/lib
-
-LIBS = $(shell wx-config --libs) -lph -lwlocate
-
-DBGFLAGS = -O2 -g0 -DNDEBUG
-ifeq ($(DEBUG),1)
-DBGFLAGS = -O0 -g3 -DNOSPLASH
-endif
-
-CXXSOURCES = LocDemoApp.cpp LocDemoWin.cpp
-
-CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
-CXXFLAGS = -Wall -DESRI_UNIX -DENV_QNX $(INCLUDEDIRS) $(DBGFLAGS)
-CXX = g++
-
-LDFLAGS = $(LIBDIRS) $(LIBS)
-
-all: $(PROGRAM)
-
-$(PROGRAM): $(CXXOBJECTS)
- $(CXX) -o $@ $(CXXOBJECTS) $(LDFLAGS)
- strip $(PROGRAM)
-
-clean:
- $(RM) -f $(CXXOBJECTS) $(PROGRAM)
-
+PROGRAM = LocDemo
+
+INCLUDEDIRS = -I/usr/X11R6/include -I.. $(shell wx-config --cflags) $(shell pkg-config gtk+-2.0 --cflags)
+
+LIBDIRS = -L/usr/X11R6/lib -L/usr/lib
+
+LIBS = $(shell wx-config --libs) -lph -lwlocate
+
+DBGFLAGS = -O2 -g0 -DNDEBUG
+ifeq ($(DEBUG),1)
+DBGFLAGS = -O0 -g3 -DNOSPLASH
+endif
+
+CXXSOURCES = LocDemoApp.cpp LocDemoWin.cpp
+
+CXXOBJECTS = $(CXXSOURCES:.cpp=.o)
+CXXFLAGS = -Wall -DESRI_UNIX -DENV_QNX $(INCLUDEDIRS) $(DBGFLAGS)
+CXX = g++
+
+LDFLAGS = $(LIBDIRS) $(LIBS)
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(CXXOBJECTS)
+ $(CXX) -o $@ $(CXXOBJECTS) $(LDFLAGS)
+ strip $(PROGRAM)
+
+clean:
+ $(RM) -f $(CXXOBJECTS) $(PROGRAM)
+
diff --git a/master/locdemo/README b/master/locdemo/README
index 4836144..ccafaaa 100755
--- a/master/locdemo/README
+++ b/master/locdemo/README
@@ -1,17 +1,17 @@
-This is a demo application that makes use of libwlocate. It uses this library
-to get the current geographic position, then downloads the related map tiles
-from the OpenStreetMap project (please refer to http://www.openstreetmap.org
-for detail) and displays them within the main screen. The calculated geographic
-position is highlighted with a red circle. Its radius differs and depends on
-the quality of the returned location result.
-
-Additionally it can be used to load a libwlocate.trace file as generated by the
-command line tool lwtrace to track the positions where a user has been. This
-file contains WLAN data which are converted to geographic positions by LocDemo.
-These positions form a path that are drawn into the LocDemo map. This function
-can be used to track positions a user has been.
-
-This application uses the wxWidgets toolkit (from http://www.wxwidgets.org )
-for the user interface. To compile it from source the related wxWidgets
-development files are required.
-
+This is a demo application that makes use of libwlocate. It uses this library
+to get the current geographic position, then downloads the related map tiles
+from the OpenStreetMap project (please refer to http://www.openstreetmap.org
+for detail) and displays them within the main screen. The calculated geographic
+position is highlighted with a red circle. Its radius differs and depends on
+the quality of the returned location result.
+
+Additionally it can be used to load a libwlocate.trace file as generated by the
+command line tool lwtrace to track the positions where a user has been. This
+file contains WLAN data which are converted to geographic positions by LocDemo.
+These positions form a path that are drawn into the LocDemo map. This function
+can be used to track positions a user has been.
+
+This application uses the wxWidgets toolkit (from http://www.wxwidgets.org )
+for the user interface. To compile it from source the related wxWidgets
+development files are required.
+
diff --git a/master/locdemo/locdemo.dsp b/master/locdemo/locdemo.dsp
index a1af5f7..a38508b 100755
--- a/master/locdemo/locdemo.dsp
+++ b/master/locdemo/locdemo.dsp
@@ -1,111 +1,111 @@
-# Microsoft Developer Studio Project File - Name="locdemo" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Application" 0x0101
-
-CFG=locdemo - Win32 DLL Unicode Release
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "locdemo.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "locdemo.mak" CFG="locdemo - Win32 DLL Unicode Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "locdemo - Win32 DLL Unicode Release" (based on "Win32 (x86) Application")
-!MESSAGE "locdemo - Win32 DLL Unicode Debug" (based on "Win32 (x86) Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "locdemo - Win32 DLL Unicode Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "vc_mswudll"
-# PROP BASE Intermediate_Dir "vc_mswudll\locdemo"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "vc_mswudll"
-# PROP Intermediate_Dir "vc_mswudll\locdemo"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MD /W4 /GR /O2 /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswudll\locdemo.pdb" /FD /EHsc /c
-# ADD CPP /nologo /MD /W4 /GR /O2 /I "C:\wxWidgets-2.8\lib\vc_dll\mswu" /I ".\..\..\lib\vc_dll\mswu" /I "C:\wxWidgets-2.8\include" /I "." /I ".." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /D "ENV_WINDOWS" /D "ENV_EDITOR" /FR /Fd"vc_mswudll\locdemo.pdb" /FD /EHsc /c
-# ADD BASE MTL /nologo /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
-# ADD MTL /nologo /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "__WXMSW__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
-# ADD RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "__WXMSW__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 wxmsw28u_core.lib wxbase28u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /machine:I386 /libpath:".\..\..\lib\vc_dll"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 wxbase28u_net.lib wxmsw28u_xrc.lib wxbase28u_xml.lib wxmsw28u_adv.lib wxmsw28u_core.lib wxbase28u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib netapi32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib ../Release/libwlocate.lib /nologo /subsystem:windows /machine:I386 /out:"LocDemo.exe" /libpath:"..\Release\\" /libpath:"C:\wxWidgets-2.8\lib\vc_dll"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "locdemo - Win32 DLL Unicode Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "vc_mswuddll"
-# PROP BASE Intermediate_Dir "vc_mswuddll\locdemo"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "vc_mswuddll"
-# PROP Intermediate_Dir "vc_mswuddll\locdemo"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswuddll\locdemo.pdb" /FD /EHsc /c
-# ADD CPP /nologo /MDd /W4 /Gm /GR /ZI /Od /I "C:\wxWidgets-2.8\lib\vc_dll\mswud" /I "C:\wxWidgets-2.8\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /D "ENV_EDITOR" /D "ENV_WINDOWS" /FR /Fd"vc_mswuddll\locdemo.pdb" /FD /EHsc /c
-# ADD BASE MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
-# ADD MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
-# ADD BASE RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
-# ADD RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_dll"
-# SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 wxmsw28ud_xrc.lib wxbase28ud_xml.lib wxmsw28ud_adv.lib wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib netapi32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib libwlocate.lib wxbase28ud_net.lib /nologo /subsystem:windows /debug /machine:I386 /out:"LocDemo.exe" /libpath:"..\Debug\\" /libpath:"C:\wxWidgets-2.8\lib\vc_dll"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "locdemo - Win32 DLL Unicode Release"
-# Name "locdemo - Win32 DLL Unicode Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LocDemoApp.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\LocDemoWin.cpp
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\icon.ico
-# End Source File
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="locdemo" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=locdemo - Win32 DLL Unicode Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "locdemo.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "locdemo.mak" CFG="locdemo - Win32 DLL Unicode Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "locdemo - Win32 DLL Unicode Release" (based on "Win32 (x86) Application")
+!MESSAGE "locdemo - Win32 DLL Unicode Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "locdemo - Win32 DLL Unicode Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "vc_mswudll"
+# PROP BASE Intermediate_Dir "vc_mswudll\locdemo"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "vc_mswudll"
+# PROP Intermediate_Dir "vc_mswudll\locdemo"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W4 /GR /O2 /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswudll\locdemo.pdb" /FD /EHsc /c
+# ADD CPP /nologo /MD /W4 /GR /O2 /I "C:\wxWidgets-2.8\lib\vc_dll\mswu" /I ".\..\..\lib\vc_dll\mswu" /I "C:\wxWidgets-2.8\include" /I "." /I ".." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /D "ENV_WINDOWS" /D "ENV_EDITOR" /FR /Fd"vc_mswudll\locdemo.pdb" /FD /EHsc /c
+# ADD BASE MTL /nologo /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
+# ADD MTL /nologo /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "__WXMSW__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
+# ADD RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "__WXMSW__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 wxmsw28u_core.lib wxbase28u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /machine:I386 /libpath:".\..\..\lib\vc_dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 wxbase28u_net.lib wxmsw28u_xrc.lib wxbase28u_xml.lib wxmsw28u_adv.lib wxmsw28u_core.lib wxbase28u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib netapi32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib ../Release/libwlocate.lib /nologo /subsystem:windows /machine:I386 /out:"LocDemo.exe" /libpath:"..\Release\\" /libpath:"C:\wxWidgets-2.8\lib\vc_dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "locdemo - Win32 DLL Unicode Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "vc_mswuddll"
+# PROP BASE Intermediate_Dir "vc_mswuddll\locdemo"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "vc_mswuddll"
+# PROP Intermediate_Dir "vc_mswuddll\locdemo"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswuddll\locdemo.pdb" /FD /EHsc /c
+# ADD CPP /nologo /MDd /W4 /Gm /GR /ZI /Od /I "C:\wxWidgets-2.8\lib\vc_dll\mswud" /I "C:\wxWidgets-2.8\include" /I "." /I ".." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /D "ENV_EDITOR" /D "ENV_WINDOWS" /FR /Fd"vc_mswuddll\locdemo.pdb" /FD /EHsc /c
+# ADD BASE MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
+# ADD MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
+# ADD RSC /l 0x409 /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /i ".\..\..\samples" /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /d "WXUSINGDLL" /d "_WINDOWS" /d "NOPCH"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 wxmsw28ud_xrc.lib wxbase28ud_xml.lib wxmsw28ud_adv.lib wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib netapi32.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib libwlocate.lib wxbase28ud_net.lib /nologo /subsystem:windows /debug /machine:I386 /out:"LocDemo.exe" /libpath:"..\Debug\\" /libpath:"C:\wxWidgets-2.8\lib\vc_dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "locdemo - Win32 DLL Unicode Release"
+# Name "locdemo - Win32 DLL Unicode Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\LocDemoApp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\LocDemoWin.cpp
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\icon.ico
+# End Source File
+# End Target
+# End Project
diff --git a/master/locdemo/locdemo.dsw b/master/locdemo/locdemo.dsw
index 7f49b9b..673a097 100755
--- a/master/locdemo/locdemo.dsw
+++ b/master/locdemo/locdemo.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "bombs"=.\locdemo.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "bombs"=.\locdemo.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/master/locdemo/setup_data/LocDemo/DEBIAN/preinst b/master/locdemo/setup_data/LocDemo/DEBIAN/preinst
index 82b6c88..e66b659 100755
--- a/master/locdemo/setup_data/LocDemo/DEBIAN/preinst
+++ b/master/locdemo/setup_data/LocDemo/DEBIAN/preinst
@@ -1,8 +1,8 @@
-#!/bin/sh
-
-if [ -x /sbin/LocDemo ]; then
- rm -f /sbin/LocDemo
-fi
-if [ -x /etc/init.d/wlocd ]; then
- /etc/init.d/wlocd stop
-fi
+#!/bin/sh
+
+if [ -x /sbin/LocDemo ]; then
+ rm -f /sbin/LocDemo
+fi
+if [ -x /etc/init.d/wlocd ]; then
+ /etc/init.d/wlocd stop
+fi
diff --git a/master/locdemo/setup_data/LocDemo/DEBIAN/prerm b/master/locdemo/setup_data/LocDemo/DEBIAN/prerm
index b099c40..e926d95 100755
--- a/master/locdemo/setup_data/LocDemo/DEBIAN/prerm
+++ b/master/locdemo/setup_data/LocDemo/DEBIAN/prerm
@@ -1,9 +1,9 @@
-#!/bin/sh
-
-/etc/init.d/wlocd stop
-rm /etc/rc5.d/S99wlocd
-rm /etc/rc5.d/K01wlocd
-rm /etc/rc3.d/S99wlocd
-rm /etc/rc3.d/K01wlocd
-rm /etc/rc2.d/S99wlocd
-rm /etc/rc2.d/K01wlocd
+#!/bin/sh
+
+/etc/init.d/wlocd stop
+rm /etc/rc5.d/S99wlocd
+rm /etc/rc5.d/K01wlocd
+rm /etc/rc3.d/S99wlocd
+rm /etc/rc3.d/K01wlocd
+rm /etc/rc2.d/S99wlocd
+rm /etc/rc2.d/K01wlocd
diff --git a/master/locdemo/win_setup.nsi b/master/locdemo/win_setup.nsi
index d02ceae..9480bd1 100755
--- a/master/locdemo/win_setup.nsi
+++ b/master/locdemo/win_setup.nsi
@@ -1,92 +1,92 @@
-!include Library.nsh
-var ALREADY_INSTALLED
-
-Name "LocDemo - WLAN location demo"
-OutFile "locdemo_install.exe"
-
-SetCompress auto
-SetDatablockOptimize on
-CRCCheck on
-; AutoCloseWindow false ; (can be true for the window go away automatically at end)
-ShowInstDetails nevershow ; (can be show to have them shown, or nevershow to disable)
-; SetDateSave off ; (can be on to have files restored to their orginal date)
-
-LicenseText "Please read the license agreement before installing and using the software:"
-LicenseData "../COPYING"
-
-InstallDir "$PROGRAMFILES\LocDemo"
-DirText "Select the directory to install the LocDemo software into:"
-
-InstProgressFlags smooth
-
-Section "" ; (default section)
-
-SetOutPath "$INSTDIR"
-File "LocDemo.exe"
-File "..\Release\lwtrace.exe"
-File "icon.ico"
-
-File "CAcert_Root_Certificates.msi"
-ExecWait '"msiexec" /quiet /i "$INSTDIR\CAcert_Root_Certificates.msi"'
-
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "..\Release\libwlocate.dll" "$SYSDIR\libwlocate.dll" "$SYSDIR"
-
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_net_vc_custom.dll" "$SYSDIR\wxbase28u_net_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_odbc_vc_custom.dll" "$SYSDIR\wxbase28u_odbc_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_vc_custom.dll" "$SYSDIR\wxbase28u_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_xml_vc_custom.dll" "$SYSDIR\wxbase28u_xml_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_adv_vc_custom.dll" "$SYSDIR\wxmsw28u_adv_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_aui_vc_custom.dll" "$SYSDIR\wxmsw28u_aui_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_core_vc_custom.dll" "$SYSDIR\wxmsw28u_core_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_gl_vc_custom.dll" "$SYSDIR\wxmsw28u_gl_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_html_vc_custom.dll" "$SYSDIR\wxmsw28u_html_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_media_vc_custom.dll" "$SYSDIR\wxmsw28u_media_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_richtext_vc_custom.dll" "$SYSDIR\wxmsw28u_richtext_vc_custom.dll" "$SYSDIR"
-!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_xrc_vc_custom.dll" "$SYSDIR\wxmsw28u_xrc_vc_custom.dll" "$SYSDIR"
-
-; write out uninstaller
-WriteUninstaller "$INSTDIR\uninstall.exe"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo" "DisplayName" "LocDemo"
-WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo" "UninstallString" "$INSTDIR\uninstall.exe"
-
-Sectionend
-
-Section -startmenu
-
-CreateDirectory "$SMPROGRAMS\LocDemo"
-CreateShortCut "$SMPROGRAMS\LocDemo\LocDemo.lnk" "$INSTDIR\LocDemo.exe" "" "$INSTDIR\icon.ico" 0
-CreateShortCut "$SMPROGRAMS\LocDemo\trace.lnk" "$INSTDIR\trace.exe" "" "" 0
-CreateShortCut "$SMPROGRAMS\LocDemo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
-
-Sectionend
-
-
-; begin uninstall settings/section
-UninstallText "This will uninstall the LocDemo software from your system"
-
-Section Uninstall
-
-DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo"
-
-Delete "$INSTDIR\*.*"
-RMDir /r $INSTDIR
-Delete "$SMPROGRAMS\LocDemo\*.*"
-RMDir "$SMPROGRAMS\LocDemo"
-
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\libwlocate.dll"
-
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_net_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_odbc_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_xml_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_adv_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_aui_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_core_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_gl_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_html_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_media_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_richtext_vc_custom.dll"
-!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_xrc_vc_custom.dll"
-
-SectionEnd ; end of uninstall section
-
+!include Library.nsh
+var ALREADY_INSTALLED
+
+Name "LocDemo - WLAN location demo"
+OutFile "locdemo_install.exe"
+
+SetCompress auto
+SetDatablockOptimize on
+CRCCheck on
+; AutoCloseWindow false ; (can be true for the window go away automatically at end)
+ShowInstDetails nevershow ; (can be show to have them shown, or nevershow to disable)
+; SetDateSave off ; (can be on to have files restored to their orginal date)
+
+LicenseText "Please read the license agreement before installing and using the software:"
+LicenseData "../COPYING"
+
+InstallDir "$PROGRAMFILES\LocDemo"
+DirText "Select the directory to install the LocDemo software into:"
+
+InstProgressFlags smooth
+
+Section "" ; (default section)
+
+SetOutPath "$INSTDIR"
+File "LocDemo.exe"
+File "..\Release\lwtrace.exe"
+File "icon.ico"
+
+File "CAcert_Root_Certificates.msi"
+ExecWait '"msiexec" /quiet /i "$INSTDIR\CAcert_Root_Certificates.msi"'
+
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "..\Release\libwlocate.dll" "$SYSDIR\libwlocate.dll" "$SYSDIR"
+
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_net_vc_custom.dll" "$SYSDIR\wxbase28u_net_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_odbc_vc_custom.dll" "$SYSDIR\wxbase28u_odbc_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_vc_custom.dll" "$SYSDIR\wxbase28u_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxbase28u_xml_vc_custom.dll" "$SYSDIR\wxbase28u_xml_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_adv_vc_custom.dll" "$SYSDIR\wxmsw28u_adv_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_aui_vc_custom.dll" "$SYSDIR\wxmsw28u_aui_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_core_vc_custom.dll" "$SYSDIR\wxmsw28u_core_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_gl_vc_custom.dll" "$SYSDIR\wxmsw28u_gl_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_html_vc_custom.dll" "$SYSDIR\wxmsw28u_html_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_media_vc_custom.dll" "$SYSDIR\wxmsw28u_media_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_richtext_vc_custom.dll" "$SYSDIR\wxmsw28u_richtext_vc_custom.dll" "$SYSDIR"
+!insertmacro InstallLib DLL $ALREADY_INSTALLED REBOOT_NOTPROTECTED "C:\wxWidgets-2.8\lib\vc_dll\wxmsw28u_xrc_vc_custom.dll" "$SYSDIR\wxmsw28u_xrc_vc_custom.dll" "$SYSDIR"
+
+; write out uninstaller
+WriteUninstaller "$INSTDIR\uninstall.exe"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo" "DisplayName" "LocDemo"
+WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo" "UninstallString" "$INSTDIR\uninstall.exe"
+
+Sectionend
+
+Section -startmenu
+
+CreateDirectory "$SMPROGRAMS\LocDemo"
+CreateShortCut "$SMPROGRAMS\LocDemo\LocDemo.lnk" "$INSTDIR\LocDemo.exe" "" "$INSTDIR\icon.ico" 0
+CreateShortCut "$SMPROGRAMS\LocDemo\trace.lnk" "$INSTDIR\trace.exe" "" "" 0
+CreateShortCut "$SMPROGRAMS\LocDemo\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
+
+Sectionend
+
+
+; begin uninstall settings/section
+UninstallText "This will uninstall the LocDemo software from your system"
+
+Section Uninstall
+
+DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LocDemo"
+
+Delete "$INSTDIR\*.*"
+RMDir /r $INSTDIR
+Delete "$SMPROGRAMS\LocDemo\*.*"
+RMDir "$SMPROGRAMS\LocDemo"
+
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\libwlocate.dll"
+
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_net_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_odbc_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxbase28u_xml_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_adv_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_aui_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_core_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_gl_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_html_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_media_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_richtext_vc_custom.dll"
+!insertmacro UnInstallLib DLL SHARED REBOOT_NOTPROTECTED "$SYSDIR\wxmsw28u_xrc_vc_custom.dll"
+
+SectionEnd ; end of uninstall section
+
diff --git a/master/trace.dsp b/master/trace.dsp
index 03e875a..588b0c6 100755
--- a/master/trace.dsp
+++ b/master/trace.dsp
@@ -1,102 +1,102 @@
-# Microsoft Developer Studio Project File - Name="trace" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=trace - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "trace.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "trace.mak" CFG="trace - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "trace - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "trace - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "trace - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ENV_WINDOWS" /YX /FD /c
-# ADD BASE RSC /l 0x407 /d "NDEBUG"
-# ADD RSC /l 0x407 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 Release/libwlocate.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"Release/lwtrace.exe"
-
-!ELSEIF "$(CFG)" == "trace - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "trace___Win32_Debug"
-# PROP BASE Intermediate_Dir "trace___Win32_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "trace___Win32_Debug"
-# PROP Intermediate_Dir "trace___Win32_Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ENV_WINDOWS" /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x407 /d "_DEBUG"
-# ADD RSC /l 0x407 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 Debug/libwlocate.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"trace___Win32_Debug/lwtrace.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "trace - Win32 Release"
-# Name "trace - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\trace.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="trace" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=trace - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "trace.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "trace.mak" CFG="trace - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "trace - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "trace - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "trace - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ENV_WINDOWS" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 Release/libwlocate.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"Release/lwtrace.exe"
+
+!ELSEIF "$(CFG)" == "trace - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "trace___Win32_Debug"
+# PROP BASE Intermediate_Dir "trace___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "trace___Win32_Debug"
+# PROP Intermediate_Dir "trace___Win32_Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ENV_WINDOWS" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 Debug/libwlocate.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /out:"trace___Win32_Debug/lwtrace.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "trace - Win32 Release"
+# Name "trace - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\trace.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/master/trace.dsw b/master/trace.dsw
index b88d807..aeab66f 100755
--- a/master/trace.dsw
+++ b/master/trace.dsw
@@ -1,29 +1,29 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "trace"=.\trace.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "trace"=.\trace.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/master/wlan.c b/master/wlan.c
index 0cd32b1..754af7e 100755
--- a/master/wlan.c
+++ b/master/wlan.c
@@ -1,255 +1,255 @@
-/**
- * libwlocate - WLAN-based location service
- * Copyright (C) 2010-2012 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef ENV_WINDOWS
-#include <windows.h>
-#include <objbase.h>
-#include <wtypes.h>
-
-#if (_MSC_VER>1400)
- #include <wlanapi.h>
- #pragma comment(lib, "wlanapi.lib")
-#endif
-#include "wlanapi_cust.h"
-#endif
-
-#include "libwlocate.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef ENV_WINDOWS
-/**
- * Works with Windows Vista and newer
- */
-static int WinMethod1(struct wloc_req *request)
-{
-#if (_MSC_VER<=1400)
- static HINSTANCE wlan_library=NULL;
-#endif
- HANDLE hClient = NULL;
- DWORD dwCurVersion = 0;
- DWORD dwResult = 0;
- int iRet = 0,i,j,cnt;
- WCHAR GuidString[40] = {0};
- PWLAN_INTERFACE_INFO_LIST pIfList = NULL;
- PWLAN_INTERFACE_INFO pIfInfo = NULL;
- PWLAN_BSS_LIST pBssList=NULL;
- PWLAN_BSS_ENTRY pBssEntry=NULL;
-
-#if (_MSC_VER<=1400)
- if (!wlan_library)
- {
- wlan_library = LoadLibrary("wlanapi");
- if (!wlan_library) return 0;
- WlanOpenHandle = (WlanOpenHandleFunction)GetProcAddress(wlan_library, "WlanOpenHandle");
- WlanEnumInterfaces = (WlanEnumInterfacesFunction)GetProcAddress(wlan_library, "WlanEnumInterfaces");
- WlanGetNetworkBssList = (WlanGetNetworkBssListFunction)GetProcAddress(wlan_library, "WlanGetNetworkBssList");
- WlanCloseHandle = (WlanCloseHandleFunction)GetProcAddress(wlan_library, "WlanCloseHandle");
- WlanFreeMemory = (WlanFreeMemoryFunction)GetProcAddress(wlan_library, "WlanFreeMemory");
- if ((!WlanOpenHandle) || (!WlanEnumInterfaces) || (!WlanGetNetworkBssList) ||
- (!WlanCloseHandle) || (!WlanFreeMemory))
- {
- FreeLibrary(wlan_library);
- wlan_library=NULL;
- return 0;
- }
- }
-#endif
- dwResult = WlanOpenHandle(1, NULL, &dwCurVersion, &hClient);
- if (dwResult != ERROR_SUCCESS) return 0;
-
- dwResult = WlanEnumInterfaces(hClient, NULL, &pIfList);
- if (dwResult != ERROR_SUCCESS)
- {
- WlanCloseHandle(hClient,NULL);
- return 0;
- }
- cnt=-1;
- for (i = 0; i < (int) pIfList->dwNumberOfItems; i++)
- {
- pIfInfo = (WLAN_INTERFACE_INFO *) &pIfList->InterfaceInfo[i];
- dwResult=WlanGetNetworkBssList(hClient,&pIfInfo->InterfaceGuid,NULL,dot11_BSS_type_any,FALSE,NULL,&pBssList);
- if (dwResult!=ERROR_SUCCESS) continue;
- for (j=0; j<(int)pBssList->dwNumberOfItems; j++)
- {
- char *c;
-
- cnt++;
- pBssEntry=&pBssList->wlanBssEntries[j];
- c=(char*)&pBssList->wlanBssEntries[j];
- memcpy(request->bssids[cnt],pBssEntry->dot11Bssid,6);
-// request->signal[cnt]=(char)pBssEntry->uLinkQuality;
- if (cnt>=WLOC_MAX_NETWORKS) break;
- }
- if (pBssList != NULL) WlanFreeMemory(pBssList); // ???
- if (cnt>=WLOC_MAX_NETWORKS) break;
- }
- if (pIfList != NULL) WlanFreeMemory(pIfList);
- WlanCloseHandle(hClient,NULL);
- return cnt+1;
-}
-
-
-/**
- * Works with Windows XP >=SP2 and newer, outdated with Windows Vista and newer
- */
-static int WinMethod2(struct wloc_req *request)
-{
- static HINSTANCE wzc_library=NULL;
- INTFS_KEY_TABLE interface_list;
- ADAPTER_INFO adapter_info;
- INTF_ENTRY interface_data;
- DWORD result,dwOutFlags;
- int i,j,length,cnt,data_until_padding;
- PNDIS_802_11_BSSID_LIST pList;
- const unsigned char *buffer_end;
- PNDIS_WLAN_BSSID pBssid;
-
- if (wzc_library==NULL)
- {
- wzc_library = LoadLibrary("wzcsapi");
- if (!wzc_library) return 0;
- WZCEnumInterfaces = (WZCEnumInterfacesFunction)GetProcAddress(wzc_library, "WZCEnumInterfaces");
- WZCQueryInterface = (WZCQueryInterfaceFunction)GetProcAddress(wzc_library, "WZCQueryInterface");
-#if (_MSC_VER<=1400)
- WZCRefreshInterface = (WZCRefreshInterfaceFunction)GetProcAddress(wzc_library, "WZCRefreshInterface");
-
- if ((!WZCEnumInterfaces) || (!WZCQueryInterface) || (!WZCRefreshInterface))
-#else
- if ((!WZCEnumInterfaces) || (!WZCQueryInterface))
-#endif
- {
- FreeLibrary(wzc_library);
- wzc_library=0;
- return 0;
- }
- }
-
- memset(&interface_list, 0, sizeof(INTFS_KEY_TABLE));
- result = WZCEnumInterfaces(NULL, &interface_list);
- if (result != ERROR_SUCCESS) return 0;
- cnt=-1;
- for (i = 0; i<(int)interface_list.dwNumIntfs; ++i)
- {
- memset(&interface_data, 0, sizeof(INTF_ENTRY));
- interface_data.wszGuid = interface_list.pIntfs[i].wszGuid;
- dwOutFlags = 1;
- result = WZCQueryInterface(NULL, INTF_DESCR, &interface_data, &dwOutFlags);
- if (result != ERROR_SUCCESS)
- {
- LocalFree(interface_list.pIntfs);
- return 0;
- }
- length = wcslen(interface_list.pIntfs[i].wszGuid);
- if (length > 0 && length < ADAPTER_NAME_LENGTH)
- {
- memset(&adapter_info, 0, sizeof(adapter_info));
- wcscpy(adapter_info.name, interface_list.pIntfs[i].wszGuid);
- length = wcslen(interface_data.wszDescr);
- if (length > 0 && length < ADAPTER_DESCRIPTION_LENGTH) wcscpy(adapter_info.description, interface_data.wszDescr);
-
- memset(&interface_data, 0, sizeof(INTF_ENTRY));
- interface_data.wszGuid =interface_list.pIntfs[i].wszGuid;
-
- result = WZCQueryInterface(NULL, INTF_BSSIDLIST | INTF_LIST_SCAN, &interface_data, &dwOutFlags);
- if (result != ERROR_SUCCESS)
- {
- LocalFree(interface_list.pIntfs);
- return 0;
- }
- if ((dwOutFlags & INTF_BSSIDLIST) != INTF_BSSIDLIST)
- {
- printf("WZC: Interface query consistency failure: incorrect flags\n");
- LocalFree(interface_list.pIntfs);
- return 0;
- }
- if (interface_data.rdBSSIDList.dwDataLen == 0 || interface_data.rdBSSIDList.dwDataLen < sizeof(NDIS_802_11_BSSID_LIST))
- {
- data_until_padding = (UCHAR*)&interface_data.padding1 - (UCHAR*)&interface_data;
-
- // this is a hack to support Windows XP SP2 with WLAN Hotfix and SP3
- memmove((UCHAR*)&interface_data + data_until_padding, (UCHAR*)&interface_data + data_until_padding + 8, sizeof(interface_data) - data_until_padding - 8);
- if (interface_data.rdBSSIDList.dwDataLen == 0 || interface_data.rdBSSIDList.dwDataLen < sizeof(NDIS_802_11_BSSID_LIST))
- {
- // cleanup
- printf("WZC: Interface query consistency failure: no data or incorrect data length (length: %ld)\n", interface_data.rdBSSIDList.dwDataLen);
- LocalFree(interface_list.pIntfs);
- LocalFree(interface_data.rdBSSIDList.pData);
- return 0;
- }
- }
- pList =(NDIS_802_11_BSSID_LIST*)(interface_data.rdBSSIDList.pData);
- pBssid =(PNDIS_WLAN_BSSID)(&pList->Bssid[0]);
- buffer_end =(unsigned char*)(pBssid) + interface_data.rdBSSIDList.dwDataLen;
- for (j= 0; j<(int)pList->NumberOfItems; j++)
- {
- cnt++;
- if (pBssid->Length < sizeof(NDIS_WLAN_BSSID) || ((unsigned char*)(pBssid) + pBssid->Length > buffer_end))
- {
- // cleanup
- LocalFree(interface_list.pIntfs);
- LocalFree(interface_data.rdBSSIDList.pData);
- printf("WZC: Bssid structure looks odd. Break!\n");
- return cnt;
- }
- memcpy(request->bssids[cnt],pBssid->MacAddress,6);
-// request->signal[cnt]=(char)((100+pBssid->Rssi)*1.6); // is this really the correct calculation for a signal strength in percent?
- pBssid=(PNDIS_WLAN_BSSID)((unsigned char*)(pBssid) + pBssid->Length);
- }
- LocalFree(interface_data.rdBSSIDList.pData);
- }
- }
- LocalFree(interface_list.pIntfs);
-
- return cnt+1;
-}
-#endif
-
-
-
-#ifdef ENV_LINUX
-extern int iw_fill_structure(struct wloc_req *request);
-#endif
-
-WLOC_EXT_API int wloc_get_wlan_data(struct wloc_req *request)
-{
-#ifdef ENV_WINDOWS
- int ret;
-
- // here we have to try which one of the methods works because there is no stable and standardised API
- // available on Windows that could be used securely
- ret=WinMethod1(request);
- if (ret==0) ret=WinMethod2(request);
-
- return ret;
-#else
- #ifdef ENV_LINUX
- return iw_fill_structure(request);
- #else
- #ifdef ENV_QNX
- #warning WLAN functionality not implemented, library will never use the more exact WLAN positioning!
- #else
- #error Not supported!
- #endif
- #endif
-#endif
- return 0; // no networks found
-}
-
-
+/**
+ * libwlocate - WLAN-based location service
+ * Copyright (C) 2010-2012 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef ENV_WINDOWS
+#include <windows.h>
+#include <objbase.h>
+#include <wtypes.h>
+
+#if (_MSC_VER>1400)
+ #include <wlanapi.h>
+ #pragma comment(lib, "wlanapi.lib")
+#endif
+#include "wlanapi_cust.h"
+#endif
+
+#include "libwlocate.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef ENV_WINDOWS
+/**
+ * Works with Windows Vista and newer
+ */
+static int WinMethod1(struct wloc_req *request)
+{
+#if (_MSC_VER<=1400)
+ static HINSTANCE wlan_library=NULL;
+#endif
+ HANDLE hClient = NULL;
+ DWORD dwCurVersion = 0;
+ DWORD dwResult = 0;
+ int iRet = 0,i,j,cnt;
+ WCHAR GuidString[40] = {0};
+ PWLAN_INTERFACE_INFO_LIST pIfList = NULL;
+ PWLAN_INTERFACE_INFO pIfInfo = NULL;
+ PWLAN_BSS_LIST pBssList=NULL;
+ PWLAN_BSS_ENTRY pBssEntry=NULL;
+
+#if (_MSC_VER<=1400)
+ if (!wlan_library)
+ {
+ wlan_library = LoadLibrary("wlanapi");
+ if (!wlan_library) return 0;
+ WlanOpenHandle = (WlanOpenHandleFunction)GetProcAddress(wlan_library, "WlanOpenHandle");
+ WlanEnumInterfaces = (WlanEnumInterfacesFunction)GetProcAddress(wlan_library, "WlanEnumInterfaces");
+ WlanGetNetworkBssList = (WlanGetNetworkBssListFunction)GetProcAddress(wlan_library, "WlanGetNetworkBssList");
+ WlanCloseHandle = (WlanCloseHandleFunction)GetProcAddress(wlan_library, "WlanCloseHandle");
+ WlanFreeMemory = (WlanFreeMemoryFunction)GetProcAddress(wlan_library, "WlanFreeMemory");
+ if ((!WlanOpenHandle) || (!WlanEnumInterfaces) || (!WlanGetNetworkBssList) ||
+ (!WlanCloseHandle) || (!WlanFreeMemory))
+ {
+ FreeLibrary(wlan_library);
+ wlan_library=NULL;
+ return 0;
+ }
+ }
+#endif
+ dwResult = WlanOpenHandle(1, NULL, &dwCurVersion, &hClient);
+ if (dwResult != ERROR_SUCCESS) return 0;
+
+ dwResult = WlanEnumInterfaces(hClient, NULL, &pIfList);
+ if (dwResult != ERROR_SUCCESS)
+ {
+ WlanCloseHandle(hClient,NULL);
+ return 0;
+ }
+ cnt=-1;
+ for (i = 0; i < (int) pIfList->dwNumberOfItems; i++)
+ {
+ pIfInfo = (WLAN_INTERFACE_INFO *) &pIfList->InterfaceInfo[i];
+ dwResult=WlanGetNetworkBssList(hClient,&pIfInfo->InterfaceGuid,NULL,dot11_BSS_type_any,FALSE,NULL,&pBssList);
+ if (dwResult!=ERROR_SUCCESS) continue;
+ for (j=0; j<(int)pBssList->dwNumberOfItems; j++)
+ {
+ char *c;
+
+ cnt++;
+ pBssEntry=&pBssList->wlanBssEntries[j];
+ c=(char*)&pBssList->wlanBssEntries[j];
+ memcpy(request->bssids[cnt],pBssEntry->dot11Bssid,6);
+// request->signal[cnt]=(char)pBssEntry->uLinkQuality;
+ if (cnt>=WLOC_MAX_NETWORKS) break;
+ }
+ if (pBssList != NULL) WlanFreeMemory(pBssList); // ???
+ if (cnt>=WLOC_MAX_NETWORKS) break;
+ }
+ if (pIfList != NULL) WlanFreeMemory(pIfList);
+ WlanCloseHandle(hClient,NULL);
+ return cnt+1;
+}
+
+
+/**
+ * Works with Windows XP >=SP2 and newer, outdated with Windows Vista and newer
+ */
+static int WinMethod2(struct wloc_req *request)
+{
+ static HINSTANCE wzc_library=NULL;
+ INTFS_KEY_TABLE interface_list;
+ ADAPTER_INFO adapter_info;
+ INTF_ENTRY interface_data;
+ DWORD result,dwOutFlags;
+ int i,j,length,cnt,data_until_padding;
+ PNDIS_802_11_BSSID_LIST pList;
+ const unsigned char *buffer_end;
+ PNDIS_WLAN_BSSID pBssid;
+
+ if (wzc_library==NULL)
+ {
+ wzc_library = LoadLibrary("wzcsapi");
+ if (!wzc_library) return 0;
+ WZCEnumInterfaces = (WZCEnumInterfacesFunction)GetProcAddress(wzc_library, "WZCEnumInterfaces");
+ WZCQueryInterface = (WZCQueryInterfaceFunction)GetProcAddress(wzc_library, "WZCQueryInterface");
+#if (_MSC_VER<=1400)
+ WZCRefreshInterface = (WZCRefreshInterfaceFunction)GetProcAddress(wzc_library, "WZCRefreshInterface");
+
+ if ((!WZCEnumInterfaces) || (!WZCQueryInterface) || (!WZCRefreshInterface))
+#else
+ if ((!WZCEnumInterfaces) || (!WZCQueryInterface))
+#endif
+ {
+ FreeLibrary(wzc_library);
+ wzc_library=0;
+ return 0;
+ }
+ }
+
+ memset(&interface_list, 0, sizeof(INTFS_KEY_TABLE));
+ result = WZCEnumInterfaces(NULL, &interface_list);
+ if (result != ERROR_SUCCESS) return 0;
+ cnt=-1;
+ for (i = 0; i<(int)interface_list.dwNumIntfs; ++i)
+ {
+ memset(&interface_data, 0, sizeof(INTF_ENTRY));
+ interface_data.wszGuid = interface_list.pIntfs[i].wszGuid;
+ dwOutFlags = 1;
+ result = WZCQueryInterface(NULL, INTF_DESCR, &interface_data, &dwOutFlags);
+ if (result != ERROR_SUCCESS)
+ {
+ LocalFree(interface_list.pIntfs);
+ return 0;
+ }
+ length = wcslen(interface_list.pIntfs[i].wszGuid);
+ if (length > 0 && length < ADAPTER_NAME_LENGTH)
+ {
+ memset(&adapter_info, 0, sizeof(adapter_info));
+ wcscpy(adapter_info.name, interface_list.pIntfs[i].wszGuid);
+ length = wcslen(interface_data.wszDescr);
+ if (length > 0 && length < ADAPTER_DESCRIPTION_LENGTH) wcscpy(adapter_info.description, interface_data.wszDescr);
+
+ memset(&interface_data, 0, sizeof(INTF_ENTRY));
+ interface_data.wszGuid =interface_list.pIntfs[i].wszGuid;
+
+ result = WZCQueryInterface(NULL, INTF_BSSIDLIST | INTF_LIST_SCAN, &interface_data, &dwOutFlags);
+ if (result != ERROR_SUCCESS)
+ {
+ LocalFree(interface_list.pIntfs);
+ return 0;
+ }
+ if ((dwOutFlags & INTF_BSSIDLIST) != INTF_BSSIDLIST)
+ {
+ printf("WZC: Interface query consistency failure: incorrect flags\n");
+ LocalFree(interface_list.pIntfs);
+ return 0;
+ }
+ if (interface_data.rdBSSIDList.dwDataLen == 0 || interface_data.rdBSSIDList.dwDataLen < sizeof(NDIS_802_11_BSSID_LIST))
+ {
+ data_until_padding = (UCHAR*)&interface_data.padding1 - (UCHAR*)&interface_data;
+
+ // this is a hack to support Windows XP SP2 with WLAN Hotfix and SP3
+ memmove((UCHAR*)&interface_data + data_until_padding, (UCHAR*)&interface_data + data_until_padding + 8, sizeof(interface_data) - data_until_padding - 8);
+ if (interface_data.rdBSSIDList.dwDataLen == 0 || interface_data.rdBSSIDList.dwDataLen < sizeof(NDIS_802_11_BSSID_LIST))
+ {
+ // cleanup
+ printf("WZC: Interface query consistency failure: no data or incorrect data length (length: %ld)\n", interface_data.rdBSSIDList.dwDataLen);
+ LocalFree(interface_list.pIntfs);
+ LocalFree(interface_data.rdBSSIDList.pData);
+ return 0;
+ }
+ }
+ pList =(NDIS_802_11_BSSID_LIST*)(interface_data.rdBSSIDList.pData);
+ pBssid =(PNDIS_WLAN_BSSID)(&pList->Bssid[0]);
+ buffer_end =(unsigned char*)(pBssid) + interface_data.rdBSSIDList.dwDataLen;
+ for (j= 0; j<(int)pList->NumberOfItems; j++)
+ {
+ cnt++;
+ if (pBssid->Length < sizeof(NDIS_WLAN_BSSID) || ((unsigned char*)(pBssid) + pBssid->Length > buffer_end))
+ {
+ // cleanup
+ LocalFree(interface_list.pIntfs);
+ LocalFree(interface_data.rdBSSIDList.pData);
+ printf("WZC: Bssid structure looks odd. Break!\n");
+ return cnt;
+ }
+ memcpy(request->bssids[cnt],pBssid->MacAddress,6);
+// request->signal[cnt]=(char)((100+pBssid->Rssi)*1.6); // is this really the correct calculation for a signal strength in percent?
+ pBssid=(PNDIS_WLAN_BSSID)((unsigned char*)(pBssid) + pBssid->Length);
+ }
+ LocalFree(interface_data.rdBSSIDList.pData);
+ }
+ }
+ LocalFree(interface_list.pIntfs);
+
+ return cnt+1;
+}
+#endif
+
+
+
+#ifdef ENV_LINUX
+extern int iw_fill_structure(struct wloc_req *request);
+#endif
+
+WLOC_EXT_API int wloc_get_wlan_data(struct wloc_req *request)
+{
+#ifdef ENV_WINDOWS
+ int ret;
+
+ // here we have to try which one of the methods works because there is no stable and standardised API
+ // available on Windows that could be used securely
+ ret=WinMethod1(request);
+ if (ret==0) ret=WinMethod2(request);
+
+ return ret;
+#else
+ #ifdef ENV_LINUX
+ return iw_fill_structure(request);
+ #else
+ #ifdef ENV_QNX
+ #warning WLAN functionality not implemented, library will never use the more exact WLAN positioning!
+ #else
+ #error Not supported!
+ #endif
+ #endif
+#endif
+ return 0; // no networks found
+}
+
+
diff --git a/master/wlan.h b/master/wlan.h
index 6e486fb..7f88a29 100755
--- a/master/wlan.h
+++ b/master/wlan.h
@@ -1,24 +1,24 @@
-/**
- * libwlocate - WLAN-based location service
- * Copyright (C) 2010-2012 Oxygenic/VWP virtual_worlds(at)gmx.de
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef WLAN_H
-#define WLAN_H
-
-// the prototype of the wlan.c-function can be found in libwlocate.h, it is used as library interface function too
-
-#endif
+/**
+ * libwlocate - WLAN-based location service
+ * Copyright (C) 2010-2012 Oxygenic/VWP virtual_worlds(at)gmx.de
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WLAN_H
+#define WLAN_H
+
+// the prototype of the wlan.c-function can be found in libwlocate.h, it is used as library interface function too
+
+#endif
--
2.1.4
1
3
Moin,
ich bin ja noch neu dabei
höre aber immer wieder dieses Netmon „problem“
ich würde das Projekt wohl mit angehen wollen. Habe da schon ein paar Ideen.
Würde da noch jemand mitmachen wollen? Oder mach ich alles alleine?! :D
Gruß
Johannes
3
2
Moin
Wenn ich mir die Statistik so anschaue
http://stats.ffnw.de -> auf Monat
So ist Scheinbar die maximale Anzahl von Routern erreicht? Es kommen neue dazu die sind aber nicht online bzw können nicht online kommen.
Können wir temporär bis zum Netzsplit noch was machen und die Anzahl der zulässigen Routern auf den gateways erhöhen ?
Gruß Johannes
Von meinem iPhone gesendet
Von meinem iPhone gesendet
2
1
Hi,
die Firmware Version 0.6.2 wartet noch auf die Signatur von einer Person.
Evtl. ist das etwas untergegangen, ich habs auch erst durch den Anruf von
Stefan bemerkt.
Dokumentation zum Signieren:
https://wiki.nordwest.freifunk.net/Entwicklung/Firmware_releaseprozess#Best…
Firmware Download:
http://firmware.nordwest.freifunk.net/0.6.2/
Viele Grüße
Clemens
7
8
Hi,
ich bin gerade im space und prüfe die Problematik mit Freifunk.
tata@keks ~ % speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Leaseweb Deutschland GmbH (178.162.198.45)...
Selecting best server based on latency...
b'Hosted by HillCom Solutions (Alsfeld) [33.58 km]: 72.562 ms'
Testing download speed........................................
Download: 7.85 Mbit/s
Testing upload speed..................................................
Upload: 5.67 Mbit/s
Speedtest ist ok.
keks (0.0.0.0) Fri Dec 4 23:48:27 2015
Resolver error: Received reply from unknown source: fd74:fdaa:9dc4::q
uit Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 10.18.40.1 7.1% 56 82.5 66.4 36.8 166.2 28.7
2. 10.4.0.1 9.1% 56 81.5 66.7 37.6 165.9 24.3
3. vlan436.fra1-ngn-cs2. 1.8% 56 124.7 65.0 36.1 124.7 20.9
4. 178.162.223.136 1.8% 56 86.6 71.0 37.7 183.6 24.4
5. te0-1-1-5.nr21.b01575 3.6% 56 111.0 67.5 37.3 157.9 26.4
6. be2258.rcr21.fra06.at 3.6% 56 90.6 65.4 38.6 105.9 19.1
7. be2305.ccr42.fra03.at 1.8% 56 100.2 63.9 38.6 193.6 27.0
8. be2262.ccr42.ams03.at 0.0% 56 90.0 69.8 46.6 132.7 19.8
9. be2183.ccr22.lpl01.at 3.6% 56 87.1 77.1 56.0 105.3 13.8
10. be2191.ccr21.man01.at 5.4% 56 106.6 83.6 56.3 168.7 24.0
11. te1-4.ccr01.man02.atl 8.9% 56 117.9 117.4 57.8 302.0 63.1
12. 149.14.36.18 1.8% 56 71.5 87.8 61.1 181.2 28.5
13. te0-1.cr1.lds.bytemar 5.5% 55 134.3 87.2 60.2 161.5 25.8
14. te1-6.cr1.yrk.bytemar 3.6% 55 107.1 94.3 60.7 195.3 30.4
15. po1.ar1.dc1.yo26.yrk. 1.8% 55 112.5 87.4 60.9 222.2 29.2
16. www.gentoo.org 3.6% 55 113.1 92.1 59.2 193.5 28.7
mtr über v4 ist unproblematisch
My traceroute [v0.86]
keks (::) Fri Dec 4 23:47:40 2015
Keys: Help Display mode Restart statistics Order of fields
uit Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 2a03:2260:1001::24:1 1.4% 841 88.9 97.5 69.8 291.0 22.3
2. 2a03:2260:0:1e::1 9.0% 841 112.7 126.1 96.2 1081. 41.8
3. 2001:7f8:19:1::1b1b:1 9.9% 841 149.0 136.5 97.1 373.8 27.8
4. 10ge11-5.core1.ams1.h 9.5% 841 132.1 147.5 121.0 858.2 34.2
5. ams-ix-v6.nl.plusline 56.9% 841 137.1 149.8 120.7 373.9 24.8
6. te3-2.c501.f.de.plusl 10.1% 841 148.9 154.5 112.8 418.1 42.3
7. te2-4.c101.f.de.plusl 10.6% 841 129.8 156.3 122.2 384.5 40.1
8. 2a02:2e0:3fe:0:c::1 9.3% 841 148.7 151.4 120.4 390.4 30.4
9. redirector.heise.de 10.0% 840 146.5 146.2 120.9 381.2 27.9
Bei v6 gibt es an 5. stelle ~60% packagelost. Es könnte an der Telekom
störung liegen (siehe golem). Ich bin mir da allerdinst nicht sicher.
Hat jemand ne idee?
vg
Tarek
1
0
Hi,
in 0.6.2 gibt es nur eine kleine Änderung. Damit die Netmon
geokoordinaten Synchronisation in der Firmware funktioniert.
Die Router Koordinaten aus Netmon werden mit einer Priorität auf die
Router synchronisiert[0].
Schöne Grüße
Tarek
[0]
https://git.nordwest.freifunk.net/ffnw/packages/commit/f26e4a62aa5842ca5c27…
5
29
Hi zusammen,
Hier ein Doodle für ein puppet treffen. Geplant ist derzeit die Server
Infrastruktur mit puppet wieder zu spiegeln. Aktuell fehlen die Module
für das Routing und die netzwerk interfaces. Rene von Bytemine hat sich
bereit erklärt uns bei der puppet Umstellung zu unterstützen.
http://doodle.com/poll/q5t44kwg6wc4zqpn
vg
Tarek
2
1
Hi dev's,
ich habe mal unser x86 Image getestet.
Mir ist aufgefallen, dass in /etc/opkg.conf die falsche Architektur eingetragen ist. Lies sich
händisch ändern, wäre jedoch schön wenn es von vorneherein stimmt.
Über den Einbau von zusätzlichen Kernelmodulen würde ich mich auch freuen.
Mein Wunschliste:
Unterstützung für USB-Netzwerkkarten: Namentlich "kmod-usb-net-asix" und Abhängigkeiten "kmod-usb-net", "kmod-usb-core" und "kmod-nls-base" wäre toll.
Lies sich händisch nachinstallieren und nach der Anpassung der Konfigurationsdateien funktionierte
auch das Clientnetzwerk auf der USB Netzwerkkarte. Löppt.
Atheros Wlan Karten: Namentlich "kmod-ath5k" sowie die Abhängigkeiten "kmod-crypto-aes", "kmod-cfg80211", "hostapd-common", "kmod-mac80211" und "kmod-ath".
Konnte ich nachträglich installieren, wurde von gluon jedoch nicht integriert/angenommen.
Im Configmode zeigte das Webinterface im Reiter Wlan des Expertenmodus nur eine Fehlermeldung von
luci.
/usr/lib/lua/luci/dispatcher.lua:190: Failed to execute cbi dispatcher target for entry '/admin/wifi-config'.
The called action terminated with an exception:
/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua:22: attempt to index field 'nl80211' (a nil value)
stack traceback:
[C]: in function 'assert'
/usr/lib/lua/luci/dispatcher.lua:190: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:63: in function </usr/lib/lua/luci/dispatcher.lua:63>
Über eine kurze Rückmeldung würde ich mich freuen. Damit ich weiß ob ihr das realisieren könnt oder
ich mir das selbst kompilieren muss. (Für die Zukunft).
Danke
Gruß Pascal
PS: Bin nicht auf der Liste Antwortet mir bitte direkt.
1
0
hallo zusammen,
adrian hat mich auf etwas aufmerksam gemacht bei einem treffen.
aber aus ihrgend einem grund wird es nie zu ende diskutiert?!
Ein Problem ist, dass immer mehr WLAN-Router auf den Markt kommen bei
denen Kanalbündelung (20 MHz + 20 MHz = 40 MHz) aktiviert ist. Hier
werden die Kanäle 1 und 5 sowie 9 und 13 zu je 40 MHz zusammengefasst,
um eine größere Übertragungsgeschwindigkeit zu erreichen. In der
Praxis ist das in der Form meist unnötig. Geht man von einer normalen
WLAN-Nutzung für den Internet-Zugang aus, dann ist die
Übertragungskapazität mit einem 20-MHz-Kanal vollkommen ausreichend.
Dummerweise sind die meisten WLAN-Router nicht in der Lage die
Kanalbreite automatisch herunterzuschalten. Die Bestimmungen für 40
MHz breite Kanäle im 2,4-GHz-Band sind viel zu freigiebig.
quelle: http://www.elektronik-kompendium.de/sites/net/1712061.htm
Hinweis: Gilt, wenn es im Frequenzspektrum extrem eng zu geht: Zwei
WLAN-Netze mit gleichem Kanal stören sich am wenigsten. Liegen die
Kanäle halb übereinander, dann nimmt das eine WLAN das andere als
Störung war und versucht mit niedriger Modulation und maximaler
Sendeleistung das jeweils andere zu übertönen. So stören sich die
WLANs gegenseitig. Deshalb lieber einen belegten Kanal benutzen, als
irgendwas dazwischen. Einen Kanal außerhalb der üblichen
Kanalverteilung zu verwenden ist kontraproduktiv und senkt nur die
Übertragungsrate für alle WLAN-Netze in der näheren Umgebung.
in der siteconf
https://git.nordwest.freifunk.net/ffnw/siteconf/blob/master/site.conf
finde ich htmode = 'HT40+',
unter http://wiki.openwrt.org/doc/uci/wireless#common_options
finde ich htmode mit erklärung
ich bin der meinung wir sollten 20Mhz für ffnw einrichten.
ich kopiere noch mal adrians unterhaltung mit mir und seine zitate aus
der ML hier rein.
Das Thema habe ich bereits 3/4 mal angesprochen, aber leider wurde es
jedes mal wieder verworfen. Im letzten Jahr hatte dann irgendwer (ich
meine es war Tarek) den HT40+ Modus mal aus der Firmware
rausgeschmissen, es aber nur für das Client Netz übernommen, nicht für
das mesh.ffnw Netz. Ein Update später war es dann wieder alles HT40+.
Dann hat Clemens sich im Frühjahr das Thema nochmal aufgegriffen, aber
darauf hat bis heute keiner geantwortet. (siehe weiter unten)
meinst du das?
Ein Problem ist, dass immer mehr WLAN-Router auf den Markt kommen
…praktisch jeder Router, der 802.11n unterstützt…
bei denen Kanalbündelung (20 MHz + 20 MHz = 40 MHz) aktiviert ist.
Hier werden die Kanäle 1 und 5 sowie 9 und 13 zu je 40 MHz
zusammengefasst, um eine größere Übertragungsgeschwindigkeit zu
erreichen. In der Praxis ist das in der Form meist unnötig. Geht man
von einer normalen WLAN-Nutzung für den Internet-Zugang aus, dann ist
die Übertragungskapazität mit einem 20-MHz-Kanal vollkommen
ausreichend. Dummerweise sind die meisten WLAN-Router nicht in der
Lage die Kanalbreite automatisch herunterzuschalten. Die Bestimmungen
für 40 MHz breite Kanäle im 2,4-GHz-Band sind viel zu freigiebig.
quelle: http://www.elektronik-kompendium.de/sites/net/1712061.htm
<http://www.elektronik-kompendium.de/sites/net/1712061.htm>
Richtig, so ist es! Ich habe es schon oft versucht, auf
Freifunktreffen im Space zu erklären, da es sich dabei wirklich um ein
doofes Problem handelt. Meist hieß es dann leider, das 40Mhz ja immer
auf jeden Fall besser wären als ‘nur’ 20 Mhz. Grade auf
Großveranstaltungen habe ich dann händisch alle 2,4Ghz Knoten auf HT20
zurück gefahren, um mit Freifunk nicht das komplette Frequenzband zu
belegen. Denn je breiter unser Funkkanal ist, desto anfälliger ist er
natürlich auch für Störungen. Und grade, weil wir dann mit unserem 6+1
(HT40+) quer durchs Funkband senden, ist mir das schon immer ein Dorn
im Auge gewesen. Wir sollten uns an den Standart 1 - 6 - 11 halten und
dabei die jeweils höheren bzw niedrigeren Kanäle nicht stören. (meint
Kanal 6 HT20)
Hinweis: Gilt, wenn es im Frequenzspektrum extrem eng zu geht: Zwei
WLAN-Netze mit gleichem Kanal stören sich am wenigsten. Liegen die
Kanäle halb übereinander, dann nimmt das eine WLAN das andere als
Störung war und versucht mit niedriger Modulation und maximaler
Sendeleistung das jeweils andere zu übertönen. So stören sich die
WLANs gegenseitig. Deshalb lieber einen belegten Kanal benutzen, als
irgendwas dazwischen. Einen Kanal außerhalb der üblichen
Kanalverteilung zu verwenden ist kontraproduktiv und senkt nur die
Übertragungsrate für alle WLAN-Netze in der näheren Umgebung.
Genau das tut es dann bei uns auch, denn wir benutzen ja quasi den
Kanal 6 plus die höheren anliegenden 20Mhz welche sich nicht mit einem
WLAN auf Kanal 11 deckt und so auch wieder zu Störungen führt. Die
quellen, die du genannt hast, belegen das ja…
http://www.dd-wrt.com/wiki/index.php/Wireless-N_Configuration
<http://www.dd-wrt.com/wiki/index.php/Wireless-N_Configuration>
http://www.smallnetbuilder.com/wireless/wireless-features/31743-bye-bye-40-…
<http://www.smallnetbuilder.com/wireless/wireless-features/31743-bye-bye-40-…>
Viele Communitys haben bereits auf HT20 umgestellt, und wir sollten
die nächste sein :)
Hier nochmal Copy-Paste von der ML Month ago:
Ja, es geht mir darum, dass 2,4 Ghz Netz mit Freifunk nicht zu stark
zu verschmutzen.
Aktuell gibt es unter den Routerherstellern wie Telekom, AVM, und
anderen die Vereinbarung, im 2,4Ghz Band lediglich mit den Kanälen 1,6
und 11 zu arbeiten (Ein Kanal = 5Mhz, 20 Mhz Kanalbreite = belegt bis
zu 5 Kanäle) und auf dem im 802.11n Standart standardisierten HT40
Modus zu verzichten. So können drei HT20 Netze störungsfrei
koexistieren. Wenn nun 2 Wlannetze auf dem gleichen Kanal senden, ist
es außerdem so, dass die sich bei der Sendezeit abstimmen und so
nacheinander senden können und nicht gegenseitig sich 'anschreien'.
Das funktioniert nicht, wenn WLAN A auf Kanal 5 und WLAN B auf Kanal 6
arbeitet. Die Freifunkrouter senden aktuell auf dem Kanal 6+1 also
benutzen zusätzlich die oberhalb von Kanal 6. Dieser erweiterte 20Mhz
Kanal ist aber nicht deckungsgleich mit einem WLAN, welches auf Kanal
11 sendet. So sorgen wir aktuell mit unserem mesh.ffnw Netz dafür, das
die oberen Kanäle gestört werden und noch schlechter bis gar nicht
koexistieren können.
Zur Übertragungsgeschwindigkeit: Mit Sicherheit ist es so, dass die
meshgeschwindigkeit mit 40Mhz Bandbreite höher ist (Brutto 300 Mbits
auf 130 Mbits) Aber grade in Städten, wo ja nun sicher 90 Prozent der
Freifunknodes stehen, funkt mindestens eine Fritze auf Kanal 11 und
stören unsere, aber wir auch dessen Netz. Daher befürworte ich lieber
ein Funknetz, das sich mit seinen Nachbarn abspricht als eins, das
sich selbst und andere Funknetze stört.
Im 5Ghz Band ist das wieder etwas anderes, da dort genug Bandbreite
auch für HT40 Netze bereithält. Dort können wir weiterhin mit Kanal
44+1 senden.
Wir hatten das Thema ende letzen Jahres bereits mal auf einem Treffen
besprochen, wohin dann auch das Clientnetz auf HT20 umgestellt worden
ist. Aber iwie hat man es fürs meshnetz nicht gemacht/vergessen
Am 12.04.2015 um 16:12 schrieb Clemens John <clemens.john(a)floh1111.de>:
[Zitattext verstecken]
Am Samstag, 11. April 2015, 12:19:35 schrieb Patrick Uven:
Moin,
On 11.04.2015 12:02, Clemens John wrote:
anscheinend gibt es ein Problem mit dem aktuellen htmode (HT40+), das wir
hier kurz in einem eigenen Thread diskutieren sollten.
gibt es irgendwo ein Zitat/Link mit dem Problem?
Da müsste Adrian sich mal zu äußern. Genaues weiß ich auch nicht.
LG
Clemens
Ich würde mich freuen, wenn wir diese Diskussion endlich mal zu Ende
bringen könnten :))
Liebe Grüße
Adrian
--
Gruß
pic
@ME https://wiki.nordwest.freifunk.net/picard
3
4
Hi Leute,
ich hab heut Abend mit Johannes (aka. PowerPan) und Christian (aka.
picard / fr32k) darüber gesprochen,
dass der Konfigmodus wohl eher ein Noteinstieg in die
Routerkonfiguration ist, für den Fall dass man sich für die an-
deren Wege ausgesperrt hat. Denn für den Laien, ist es viel zu
Kompliziert die Einstellungen zwischendurch zu ändern.
Auch für uns Profis, wäre es einfacher bestimmte Einstellungen in der
Weboberfläche vorzunehmen, als über SSH.
Für diesen Zweck fänd ich es schön, wenn die Weboberfläche auch im
normalen Betriebsmodus zu erreichen wäre. -
Natürlich nur wenn bei der Ersteinrichtung ein Passwort eingerichtet
wurde...
Wie kompliziert wäre eine solche Umstellung?
Grüße aus Wilhelmshaven
Malte
2
2