locating and logging · web viewlocating and logging devices using ekahau positioning system final...
TRANSCRIPT
Locating and LoggingDevices using
Ekahau Positioning System
Final Year Project
May 2009
by
Colm McMenamin (32511005)
Bsc Hons Computer Science
University of Ulster
Supervised by Dr Kevin Curran
1
ABSTRACT
While there are many different technologies available for the purpose of Location
awareness, only recently has there been a concentration on Local Positioning
systems. The reason local positioning systems are being more widely researched is
due to the lack of accuracy in more common Location technologies like GPS (Global
Positioning System) and LBS (Location based service). What is meant by “lack of
accuracy” is the inability of GPS to locate people or devices indoors. This is where
Local Positioning comes in. This report identifies some of the Local Positioning
technologies available while also examining some of the standard positioning
technologies like GPS, RFID (Radio Frequency Identification) and LBS.
Ekahau is one of the leading systems when it comes to local positioning and this
report details the Ekahau system and its components. The reader is also introduced
to three of Ekahau’s software applications, Ekahau Vision – Used for Determining a
location, Ekahau Tracker – Used for tracking an objects movement, trajectory and
speed, and Ekahau Logger used to track an objects historical movement over a
period of time.
This report not only highlights the Ekahau application suite, but identifies the ability
for Custom application integration to work alongside the Ekahau System. The
requirements are highlighted for such an application and an outline of the Project
Implementation are revealed
2
ACKNOWLEDGEMENTS
I would like to thank Dr Kevin Curran for his guidance, expert advice and useful
suggestions throughout this initial phase of the Project.
I would also like to thank Eoghan Furey for his support, guidance and
encouragement since the start of this project.
I am honoured that Mr Furey considered me to participate in his research as part of
my final year project and also grateful to Dr Curran for taking me under his
supervision.
I would like to add a special thanks to Mark Denieffe who gave up alot of his spare
time to advise me on this Project.
In addition to this I would like to thank my Girlfriend Orlagh and to all my family and
friends for all the encouragement and support that they have given me throughout
my University education.
3
CONTENTSABSTRACT 2
ACKNOWLEDGEMENTS 3
CHAPTER 1 - INTRODUCTION 7
1.1) AIMS AND OBJECTIVES 8
1.2) THE PROJECT 8
1.3) OVERVIEW OF THE PROJECT 9
CHAPTER 2 – LITERATURE REVIEW 11
2D TRILATERATION: 12
3D TRILATERATION 13
2.1) LOCATION ESTIMATION & POSITIONING TECHNOLOGIES 13
GPS 14
RFID 14
BLUETOOTH & IRDA 15
ULTRASOUND 15
2.2) LOCATION ESTIMATION TECHNOLOGIES USING WI-FI 16
CISCO WIRELESS CONTROL SYSTEM (WCS) 16
AEROSCOUT 17
WHERENET 18
PLACELAB 18
CHAPTER 3 – EKAHAU 19
3.1) HOW IT WORKS 19
3.2) EKAHAU CLIENT 20
3.3) EKAHAU POSITIONING ENGINE 21
3.4) EKAHAU MANAGER 22
3.5) EKAHAU PLANNER 24
3.6) EKAHAU APPLICATION FRAMEWORK AND SDK 25
4
CHAPTER 4 - REQUIREMENTS AND ANALYSIS 26
4.1) PROBLEM SPECIFICATION 26
4.2) SYSTEM SCENARIOS 27
4.3) REQUIREMENTS ANALYSIS 27
FUNCTIONAL REQUIREMENTS 28
NON-FUNCTIONAL REQUIREMENTS 28
4.4) HARDWARE AND SOFTWARE REQUIREMENTS 29
4.5) DEVELOPMENT LANGUAGES 29
CHAPTER 5 - DESIGN AND IMPLEMENTATION 30
5.1) DESIGN METHODOLOGY 30
5.2) PROPOSED IMPLEMENTATION 31
5.3) SYSTEM FUNCTIONALITY: ORDER OF PROCEEDINGS 32
5.4) GRAPHICAL USER INTERFACE (GUI) 32
CHAPTER 6 – IMPLEMENTATION 33
6.1) EKAHAU SURVEY AND CALIBRATION 33
RAILS AND OPEN SPACE 34
SURVEY 35
MEASUREMENTS 36
ACCESS POINTS AND SIGNAL STRENGTH 37
ZONES 38
POSITIONING MODEL 39
6.2) PROJECT SOFTWARE 41
INTRODUCTION 41
JAVA SOFTWARE: 42
WEB SOFTWARE: 42
EKAHAU SDK 43
EKAHAU API 44
5
THE JAVA APPLICATION 44
COM.MCMENAMIN 45
COM.MCMENAMIN.EKAHAU 45
COM.MCMENAMIN.EKAHAU.DB 46
COM.MCMENAMIN.EKAHAU.DOMAIN 46
COM.MCMENAMIN.EKAHAU.SCHEDULER 47
MYSQL DATABASE 47
MYSQL - FRONT 50
SQL CODE 50
PHP PAGES 52
XAMPP 52
PHP 53
INDEX.PHP CODE 53
PHP CODE: 55
HISTORYLINK.PHP CODE 60
SO TO SUMMARISE THE INTERACTION BETWEEN ALL THE SOFTWARE: 62
CHAPTER 7 TESTING AND EVALUATION 63
INTRODUCTION 63
EVALUATION 63
EVALUATION OF FUNCTIONAL AND NON- FUNCTIONAL REQUIREMENTS 64
TESTING 67
WEB APPLICATION TESTING 70
CHAPTER 8 – CONCLUSION 71
REFERENCES 73
APPENDIX A 76
APPENDIX B – JAVA APPLICATION 77
APPENDIX C – WEB SITE CODE 91
6
CHAPTER 1 - INTRODUCTION
Currently there are a number of different technologies that are available and also
some still in development that provide some sort of positioning of a mobile device.
These can be either long range or short range with different levels of accuracy
(depending on the technology). These technologies mostly originate from the US
military like the GPS system used worldwide today. Another form of location
positioning has been developed using everyday mobile phone networks called
Location Based Services (LBS). These networks are being used by Emergency
services in Europe and the United States as a means of helping the emergency
services locate people in buildings much easier than before. In 1995 the US
government issued a mandate requiring all mobile phone operators to develop or
acquire technology that would enable emergency services to identify mobile phone
numbers of callers. The second phase of this mandate required that they must
develop a means to locate mobile phone users in case of an emergency whereas the
caller became incapacitated during a call. The requirement (US FCC E911 mandate)
went into more detail stating that the systems had to locate 67 percent of calls within
100 meters and 95 percent of calls within 300 meters [1]. In 2003, the European
Union introduced the E112 Regulatory Initiative. “Caller ID” was already in place for
landlines and Mobile phones so the only system needed was the location system
enabling Emergency services across Europe to have the same Mobile Location
Positioning as the US [2]. Long range location technologies like GPS and LBS are
excellent at locating a subject down to a specific building or street but when it comes
to pinpointing a specific room or area these systems are inadequate.
Currently there are technologies that are being used as Local Based Positioning
systems, technologies that may not have been specifically designed for this purpose
such as Wi-Fi (802.11), Bluetooth, Infrared and RFID. I will discuss these
technologies in greater detail further on in my Literature Review.
7
1.1) AIMS AND OBJECTIVES
The Aim of this project is to develop a web application that will provide a similar
service as “Ekahau Vision” and “Ekahau Logger” but with extra enhancements. Both
of these software applications are part of the Ekahau Application suite. There is
more detail on these in Chapter 3 of this report. The main focus of the application will
be the development of a device’s location history, this information ideally will be
displayed on a map, or more specifically a “heatmap” based on a query or a list
selection, (The term “heatmap” is explained in chapter 4). Hoever this will not be the
only function, there will also be a search function that will pin-point a device live
location on a map. Please note this function will not track the device but it will
pinpoint their location at the time of the search. A limit will be put on the amount of
searches that can be carried out, perhaps something like one search per minute.
This measure would be implemented to stop forced tracking by executing multiple
searches in a short time space, e.g. Searching a device every three seconds would
constitute “forced tracking”.
1.2) THE PROJECT
During this project there will be a lot of different positioning technologies discussed
and reviewed. Although the process of developing an application that works along
with Ekahau will involve a lot of hands on activity with regard to calibrating the survey
maps, studying the outputs from the positioning engine etc, the project will not drift
away from its aim too much, that is to develop the project application. And although
there is a lot of potential for innovation in the field of local positioning, the innovation
in this project will come from the application features and enhancements. However,
any discoveries or ideas with regard to the current Ekahau system will be noted for
future or current research purposes.
8
1.3) OVERVIEW OF THE PROJECT
Chapter 2 - Literature Review
The Literature review is used to provide the reader with a background of the report, and also to provide some understanding of the technologies in the field of Location systems. Technologies such as GPS, RFID, Bluetooth and IrDA. The reader will also be shown what is meant by Multilateration and Trilateration (2D and 3D) and their uses. The second section of the review will highlight some companies that specialise in Local positioning using Wi-Fi technology.
Chapter 3 – Ekahau
This chapter details the Ekahau system. This includes details of how the system functions, what software and hardware is used with it and how custom software can be developed to work along with Ekahau.
Chapter 4 - Requirements and Analysis
The Requirements and Analysis includes a specification of the problem, and a scenario of a problem that would require the project application to solve. Also in this chapter both the Functional and Non-functional requirement are identified along with the hardware and software requirements of the overall project. There is also a section explaining what software languages and technologies would be used for the application development.
Chapter 5 - Design and Implementation
The Design and Implementation section of the report is concerned with, what design methodologies we will be using, how the proposed implementation will be carried out and how the system processes will function. We will also look into the Interface design and suggest a layout.
9
Chapter 6 – Implementation
This chapter looks at the development of the project and shows how the software was created and explains a bit about the technologies used.
Chapter 7 – Testing and evaluation
This chapter explains what exactly testing and evaluation is then goes through several tests carried out on the Project software system.
Chapter 8 - Conclusion
This chapter takes a look at the entire report and decides whether or not the questions being asked at the start of the report where answered and also takes a look at any further findings in the report that may be of interest.
10
CHAPTER 2 – LITERATURE REVIEW
Multilateration is the process of calculating a person or objects position by means of
time difference of arrival (TDOA) of a signal sent from three emitters or more. A
company called Rosum in California has developed a system that can track people
in buildings using Television signals [6]. The technology is used alongside GPS
systems as Rosum claims Tv Signals are 10,000 times stronger than GPS signals.
"There are immense black holes in the GPS system, and we can fill the gap," says
John Metzler, Rosum's director of business development [7]. Figure 1 illustrates the
Rosum TV-GPS system components. The Rosum RTMM is a chipset which can be
integrated into the user device to be located or tracked. The RTMM contains a TV
tuner module, a digital signal processing module, and other supporting glue logic and
memory. [7]
Figure 1 - Rosum Tv Components
The Location server receives monitor data from monitor units in the region and
forwards that information to the RTMM. The main role of the location server is to
calculate the position of an RTMM and either send the information back to the
RTMM or it is forwarder to a tracking application or service provider [6]. The monitor
11
unit is a small device that must be deployed in the region of the RTMM device. The
role of the monitor unit is to monitor television signals in the region and report the
stability and timing of these signals back to the location server [6]. The system uses
TV signals to locate devices that have a Rosum chip embedded. There was a push
to have these chips embedded in all cell phones in the USA and as Rosum’s biggest
investor is In-Q-Tel (the Investment arm of the CIA) this move may certainly go
ahead [7].
2D TRILATERATION:
Imagine you are somewhere in Ireland totally lost and have no idea where you are,
you see a signpost 85 Miles to Derry. This basically means that you could be
anywhere in a circle around Derry with a radius of 85 miles as shown in the diagram
below:
Figure 2 - Trilateration
You then spot a passerby and ask them where you are and they tell you, “You are
112 miles from Belfast” Now you are getting somewhere as you now have two circles
one of radius 85 and the other of radius 112 as they intersect at two points, you are
at one of these two points (See Figure 2). You then bump into a second person who
12
tells you that you are 67 miles from Monaghan, this creates a third radius of 67 miles
from Monaghan and eliminates one of the two points as the third circle can only
intersect one of the two intersection points telling you your exact location which is
Omagh;
3D TRILATERATION
3D Trilateration work on the same concept as 2D Trilateration (see Figure 3) but just
imagine the circles as spheres instead. The Calculations are a lot more difficult and a
fourth satellite is usually needed to start the calculations. Also take note that the
earth itself can be used as a “fourth Sphere” to calculate positions. The process is
done a lot quicker by ignoring any parts of the spheres that are in space [4].
Figure 3 - 3D Trilateration
2.1) LOCATION ESTIMATION & POSITIONING TECHNOLOGIES
Location awareness is becoming an important capability for mobile computing
devices. However, affordable positioning systems that work well indoors have not
13
been available up to now. This project aims to demonstrate the use of an accurate
indoor positioning system for locating users indoors over a period and the in-depth
analysis which can be performed on this information to build up heat maps and time-
stamping of actual time spent on campus. First however, we review some of the
approaches to positioning used to date.
GPS
Global Positioning System consists of 27 satellites orbiting the earth. Each satellite
rotates around the earth simultaneously two times a day and at any one time four or
more satellites can be visible in the sky at any location. The Technology was
developed by the US Military for global US Military tracking but is freely available
today to anyone with a GPS Receiver device. The GPS receiver device basically
sends a signal to 4 (or more) of these satellites and works out its distance from them,
it then calculates its position based on the information, the method in doing this is
called Trilateration [12].
RFID
Radio frequency identification is an automatic tracking technology that is used to
identify people or objects by automatically scanning a specific radio frequency and
retrieving a serial number or some other type of information from the person or
object (see Figure 4). This serial number would be compared to a matching number
on the system database and whatever process associated with its scanning would
be carried out [13].
Figure 4 - A Typical RFID system
14
RFID is used for tracking livestock, pets, and payment at Toll systems, Access
control, asset tracking and many more. It seems that this technology can be applied
to almost anything you can think of [14]. With this type of tracking close proximity to
the reader is needed to detect the RFID tag, so this would not be of any use to the
type of location tracking being carried out in this research project.
BLUETOOTH & IRDA
Bluetooth is a short range wireless technology that is used to connect a pc to a
device like a Personal Digital Assistant (PDA) or it can be used to connect a mobile
device to a Bluetooth enabled accessory like a hands free kit. IrDA (Infrared Data
Association) is a communication technology that uses infrared to communicate with
another device. The system has several restrictions like its limited range (around two
metres) needs a good line of vision and has a limited angle viewing range [5]. There
are many new technologies available that use both Bluetooth and IrDA to augment
Local Positioning Systems especially Bluetooth as the range is more sensitive within
50 metres with a Bluetooth device and therefore more accurate [5].
ULTRASOUND
Ultrasound would be mostly used for improving accuracy of an already existent
positioning technology [6]. Two of the best know indoor Localisation systems, the
Active Bat and the MIT Cricket use Ultrasound. The reason ultrasound is used with
these systems is because ultrasound has the best granularity, meaning it uses the
smallest size of measurement that can be accurately addressed and measured [6].
For instance Kolodziej et al claims that Cricket can accurately delineate 4x4ft2
regions within a room, and Active bat can locate Bats to within 9cm of their true
position for 95% of the measurements. These systems however although very
accurate, are very expensive and therefore would not be feasible for the type of
study needed in this project.
15
2.2) LOCATION ESTIMATION TECHNOLOGIES USING WI-FI
A number of different systems have previously used 802.11 access points as
beacons from which to estimate location. The main implementations are listed here.
CISCO WIRELESS CONTROL SYSTEM (WCS)
Cisco Wireless Control System (WCS) is the industry’s leading platform for wireless
LAN planning, configuration, management, and mobility services. It provides a
powerful foundation that allows IT managers to design, control, and monitor
enterprise wireless. Networks from a centralized location, simplifying operations and
reducing total cost of ownership [8]. The feature of the Cisco Wireless Control
system that we are Interested in is the Cisco Wireless Location Appliance. This
application allows effective tracking of any assets equipped with 802.11 transceivers,
this includes laptops, pda’s, handsets, or equipment tagged with a wireless tag [8].
Cisco also claims that with these advanced location tracking capabilities, the Cisco
Unified Wireless Network is an ideal platform for helping to enable key business
applications that take advantage of wireless mobility, such as asset tracking,
inventory management, and enhanced 911 (e911) services for voice. [8].
Figure 5 - Visualize RF Coverage.
16
By incorporating indoor location tracking into the wireless LAN infrastructure itself,
Cisco aims at reducing the complexities of wireless LAN deployment and minimizing
the total cost of ownership [8]. Figure 5 illustrates the CISCO Wireless control
system application which shows the visual coverage of the access points.
AEROSCOUT
AeroScout is a company that specialises in Asset tracking and visibility for
companies. AeroScout uses a combination of Wi-Fi & RFID [9]. Figure 6 illustrates
the Aeroscout visibility system.
Figure 6 - Aeroscout visibility system
Organizations such as Boeing and DHL have deployed AeroScout’s Wi-Fi RFID
technology. AeroScout uses Wi-Fi RFID tags along with Aeroscout software that can
be integrated to a standard network Infrastructure that has many different hardware
vendors, through Aeroscout’s partnerships with these different vendors they can now
interact with Aeroscout’s Tag’s to provide location estimation without interrupting the
normal operations of the company [9].
17
WHERENET
WhereNet Produces two types of Active RF Tags - WhereTag III and WhereTag IV.
The difference in the Active RFID chips developed by WhereNet and the Passive RF
Tags used in most shops today is that WhereNet Active tags emit a signal to the
RFID Reader where the passive standard RF tags needs to be woken up by the
RFID reader to function. The WhereTag III is part of the WhereNet Real Time
Locating System (RTLS). They can be used to Identify and track company assets
like equipment, Vehicles, Containers, Inventory etc. It operates at the 2.4GHz
Frequency band and transmits signals in compliance with the ANSI 371.1 RTLS
standard. WhereNet’s Website claims that using Spread Spectrum technology
enables the range of the WhereTag III to be in excess of 1,000 meter read range,
and 300 meter locate range outdoors while using a power output of only 2mW [10]. WhereTag IV is specifically designed to work with Cisco's Unified Wireless Network,
and specifically the Cisco Wireless Location Appliance technologies that I have
mentioned already. The main difference in the WhereTag III and the WhereTag IV is
the ability of The WhereTag IV to be Identified and Located by different Location
technologies, but apart from this additional feature they operate in essentially the
same way [11].
PLACELAB
Placelab, unlike Ekahau uses a device’s embedded 802.11 interface and does not
rely on fingerprinting [6]. It provides location based on known positions of the access
points which are provided by a database cached on the detecting device [6]. Wi-Fi
radio surveys seldom have enough data from one access point to calculate a
position so position must be calculated from information provided by a number of
access points. Below in Figure 7 is a diagram of the key components of the Place
Lab architecture.
18
Figure 7 - Components in place lab architecture.
Place Lab is an open source project and consist of three key elements; Radio
beacons in the environment consisting of Wi-Fi network resources and GSM
towers, Databases holding beacon location information and Placelab clients that
estimate their location from this data.
CHAPTER 3 – EKAHAU
Ekahau is an 802.11 Wi-Fi Indoor Tracking system that can track anything that has
an Ekahau tag attached or any Wi-Fi enabled device. This tracking is done via an
existing Wireless Infrastructure.
3.1) HOW IT WORKS
It works by measuring signal strength along with the object location. Wireless signal
propagation and Location probability calculations are used along with calibration for
accurate positioning [6]. Most other types of positioning systems require proprietary
19
Infrastructure to function as they use time based measurements like TDOA (Time
Difference of Arrival). These methods tend to have a lot of calculation errors due to
obstacles blocking the line of site of the receiver to the person/object being tracked
[6]. Ekahau claims to achieves an accuracy of 1 to 3 metres with a site survey and
calibration up to 1h/1200m squared [6].
Figure 8 – Ekahau Positioning Engine software component
3.2) EKAHAU CLIENT
The Ekahau Client is a piece of software that runs in the background of a client
device. A client device would be either a laptop, Pda, Wireless tag or any WI-FI
enabled device that we would like to track. The Client talks to the Wi-Fi chip inside
the device for RSSI values, this stands for Received Signal Strength Indicator and
refers to the strength of the signal received by the Wi-Fi device from the Wireless
Access Point [6]. The Ekahau client software would then communicate the RSSI with
the Ekahau Positioning engine on the server, which would then calculate the location
of the device or tag [6]. The Wi-Fi tag would usually be used to track assets but in
this research the tags will be carried by people around the University in order to have
a wide range of location histories at our disposal.
20
Figure 9 - RSSI Fingerprinting Figure 10 - Ekahau site survey fingerprints
Ekahau uses a concept known as RSSI fingerprinting. All RSSI data is analysed by
the Ekahau positioning engine, this data is retrieved by each AP and the strength of
the signal coming from each AP is graphically displayed as shown in Figure 9 and
Figure 10. The term “fingerprinting” is due to the patterns made by the AP RSSI [6].
3.3) EKAHAU POSITIONING ENGINE
The Positioning engine is the Brains of the Ekahau system as most of the location
calculations are done here. The application is java based and can run on a
networked pc or a dedicated server and calculates the Client device (x,y) position,
Floor, Device heading (direction), Device Speed and Name of Area [6].
21
3.4) EKAHAU MANAGER
The Ekahau Manager is a stand-alone application that is used for creating maps and
different elements of the maps used to aid the tracking procedure. Maps can be
Loaded and configured and saved for future reference [6]. In the Magee survey and
Calibration a blank map was loaded showing all doors, rooms and stairs (see Figure
11))
Figure 11 - Blank map of 2nd floor MG building Magee
Site calibration involves collecting sample points every 3 to 5 metres in order for the
system to compare where the server thinks we are to where we actually are. This
process enhances the location accuracy every time it is done (see Figure 12).
Figure 12 - Ekahau Location Survey Tool
22
An option exists to Restrict and allow network and Access points to be part of the
location system perhaps a specific Ap is causing an inaccurate reading and needs to
be disabled, this function would enable us to do this [6].
Figure 13 shows the number of Ap’s in the second floor of the MG building Magee,
as you can see the number is displayed as a heatmap.
Figure 13 - Heatmap displaying no. of AP’s in 2nd floor of MG building.
Tracking rails can be drawn/removed and edited. The tracking rails provide
enhanced position accuracy and show the system where you (meaning the device) is
able to travel. You could go inside every room via the doors with these rails and stop
at the doors of rooms that you don’t have access of [6].
23
Figure 14 shows the rails in Magee.
Figure 14 - Tracking rails in Magee using Ekahau manager
The location of all devices being tracked by the system can be displayed here and
also each device properties can be displayed when requested. There is a tool
in Ekahau Manager which enables us to create a “zone” or logical area around a
certain room or area and give it a name [6]. This function enables us to have an
RFID type of location detection. For example if we created a logical area around a
doorway, then we could have an alarm go off in the system that tells us that device
‘A’ has entered room ‘A’, this is similar to RFID because it used proximity [6].
Positioning models can be loaded into the manager or saved from it. Also any work
done to these models can be shared and merged. The Ekahau manager user can re-
trace the steps of the original calibration to verify the system is positioning the device
location accurately [6].
3.5) EKAHAU PLANNER
Part of the Ekahau Site Survey Tool, used for Wi-Fi network design Ekahau Planner
is a tool for planning the positions and deployment of AP’s in a network using a drag
24
and drop GUI. It can be used to either plan the network before it’s installed or locate
current AP’s in already installed networks [6].
3.6) EKAHAU APPLICATION FRAMEWORK AND SDK
Ekahau has produced a set of tools for the developer called the Ekahau Software
Development Kit (SDK). This Kit enables applications to be developed that will work
alongside Ekahau Positioning engine [6]. Ekahau Vision is the Updated version of
Ekahau finder and is used for searching for a device within the wireless network.
When a query is made the device is located and displayed on a map. This Project
application will be similar in function to Ekahau vision. Figure 15 shows the Ekahau
vision screen showing the search box and the map displaying the device locations.
Figure 15 - Ekahau Vision
Ekahau Tracker is an application that displays a device live location, speed and
heading based on calculations made by the Ekahau Positioning engine, this
information is shown on a map [6]. Ekahau Logger is an application that allows a
devices location history to be logged over a period of time, this piece of software is
also similar to the application that is being developed for this projects and will have a
lot of similarities.
25
CHAPTER 4 - REQUIREMENTS AND ANALYSIS
This section addresses the Requirements specification and Analysis which includes
a look at the specification of the problem, an analysis of the Requirements (Including
functional and non-functional requirements) hardware and software requirements
and the Languages that will be used to develop the application.
4.1) PROBLEM SPECIFICATION
In the University of Ulster, Magee there is currently a lot of research being carried
out in the field of Local Positioning systems. The systems being used are the LA200
and Ekahau system and the tracking is monitored mainly in the 2nd floor of the MG
building. This Project will be focusing on designing and building a custom application
for the Ekahau System which will display a device fixed location and also display the
history of a device’s locations and stats of how long it was in a particular place within
a given time period. The first phase of the project would be to issue several Ekahau
Tags to certain members of staff and some students (volunteers), mainly persons
that would be frequently in the region of the 2nd floor in the MG building. The next
phase would involve the monitoring of the tagged volunteers over a period of either
one month or two weeks. This logged information would be passed to an external
database that would be accessed by the main project application.
Figure 16 - Heat map of USA (geothermal)
26
The Final phase of the project would be to develop the project application which
would allow a user to search for a tag or device and display the device current
location on a map. An extra feature would allow us to search for a device and
display the history of the device over a period of time. The history could be displayed
in table format and graphically ie. A Heat map, (see heat map example in Figure )
4.2) SYSTEM SCENARIOS
When on my Placement I worked in an Electronics factory as an IT administrator. As
it was quite a large factory and people would seldom be at their desk they used a
pager system to contact each other. This involved finding the nearest company
phone calling security and asking them to make an announcement over the company
PA system requesting the person to call the phone that you would be waiting at.
However, this system didn’t always work as the person wouldn’t always hear the
announcement or they would be in the middle of a task and would just not bother
going to the phone. If designated people had access to an application that could
pinpoint a member of staff’s location (they would have to carry or wear a tag) this
would save a lot of time trying to track someone down as appose to paging and
walking around the factory floor looking for this person etc. It is not being suggested
that everyone should know where this person is at all times during their working day,
obviously the person with the tag can leave the tag behind when going on breaks
and when in meetings etc. The Ekahau tracking system would be too obtrusive for
this task as the member of staff should not be subjected to the live tracking that
Ekahau offers instead this project application would allow the user to see “Ok person
‘A’ entered location ‘D’ 10 minutes ago” and if they left the room, “ Person ‘A’ Left
Location ‘D’ 2 Minutes ago”. It would work similar to an RFID system.
4.3) REQUIREMENTS ANALYSIS
In this section the Functional requirements of the system and the Non- Functional
requirements will be identified. Functional requirements consist of tasks or processes
that the system must be capable of performing. Non-functional requirements
27
describe not what the software will do, but how the software will do it, examples of
non-functional requirements would be interface design and performance issues.
FUNCTIONAL REQUIREMENTS
EKAHAU
- Ekahau needs a wireless network Including several Access points (AP’s)
- Ekahau requires a server/Pc to host the Ekahau Positioning Engine
- Ekahau needs clients to communicate with Ekahau Positioning Engine
- Ekahau needs Wi-Fi enabled laptop to Configure Ekahau Manager
USER
- The user will have access to a Pc with Standard Hardware
- The user requires Internet or at least local network access
- The user must have project application downloaded and installed on the
system
SOFTWARE
- The Software must have access to the Ekahau Positioning Engine logs
- The Software requires a device search function
- The Software requires a web based GUI
- The Software must have an Map system Independent from Ekahau
- The software must be able to query the Ekahau Position Engine for device co-
ordinates.
NON-FUNCTIONAL REQUIREMENTS
- The Software design will show good HCI practice
- The Software should have an athsteticaly pleasing GUI and show reliability.
- The Software should be versatile.
28
- The connection between the Software and Ekahau Server should be
permanently available.
- The Software response time should be as fast as possible.
- The Software should be portable
4.4) HARDWARE AND SOFTWARE REQUIREMENTS
The Project is software based one, although it does require some hardware to
function. The hardware requirement is as follows:
- A server to host Ekahau Positioning Engine
- An 802.11 Wi-Fi network
- Internet connection (Local network would suffice)
- Several Wi-Fi Ekahau Tags
- One or two Wi-Fi enabled devices (Laptops, pda)
- Pc to configure Ekahau Manager
- Pc to run custom Project software
The software requirement:
- Internet explorer
- Microsoft Word
- Java Runtime Environment
- Custom Project Application (Web Application)
4.5) DEVELOPMENT LANGUAGES
The Project will be a web based one so HTML will be used as the base language
along with several other languages like JavaScript, Java, and Ajax, Ajax will be used
to call the XML Data from the Ekahau server and the Java/JavaScript will be used to
parse this data for display purposes.
29
CHAPTER 5 - DESIGN AND IMPLEMENTATION
In this section of the report the design methodology being used will be discussed. We will also look at how the project will be implemented as well as looking at the system functionality and the GUI design. Several diagrams will be used to illustrate the design process and some of the Interface design ideas.
5.1) DESIGN METHODOLOGY
In order to produce the best software for this type of system a design methodology must be selected. There are many different methodologies available including the Waterfall Model, the V-shape Model, The Spiral Model and many more. Some companies even design their own model for software development.The basic model from which all other models base themselves on is call The General Model.
Figure 17 - The General Model.
The model that will be used for this project will be similar in concept to the model in
Figure 17 but the lifecycle will be different. The Methodology that we will be using for
this project is called the Incremental model. The Incremental model is similar to the
waterfall modal the difference being that the Incremental model has many lifecycles.
And can sometimes be called “A multi-waterfall cycle”. Basically what happens is
that the program design would be split up into smaller pieces and each cycle would
produce a working program. This program would then be revised and put through the
development cycle all over again producing an upgraded version of the program until
a working prototype is available.
30
5.2) PROPOSED IMPLEMENTATION
Figure shows how the Current Ekahau system operates. The Ekahau Clients
(Laptops, Tags, PDA’s) broadcast a signal to the Wi-Fi network through the AP
(Access Points). The Ekahau Location Survey software then tells the Ekahau
Positioning Engine the device proximity to the AP’s through the RSSI Fingerprinting
technique, which in turn predicts the device location and send back the info to
display on the map [6]. As this information is passed to the Ekahau positioning
engine it also streams the information as an XML stream [6]. The proposed solution
for the custom project application would be to read this XML data, parse the contents
and constantly map the data on a heatmap. An addition to this Project would be to
add a search function that could access the XML feed to receive a device live
location data.
Figure 18 - Proposed software working with Ekahau.
31
Ekahau Clients
Wi-Fi Network
Project Custom Application
Ekahau Positioning engine
Ekahau Location Survey
HTTP, XML
Ekahau Clients Including laptops, Tags and PDA’s talk to the Wi-Fi
network
The Ekahau Location Surveyor displays map and
Ekahau Position engine pinpoints device locations
on the map
The Ekahau Position engine feeds location information to an xml
fileThe Xml information can be parsed and sent to the project
application for storage The Project application can
query the Xml file to retrieve live location status.
5.3) SYSTEM FUNCTIONALITY: ORDER OF PROCEEDINGS
Map Device History:
1. User Starts Application (opens application URL)
2. User selects “History of a device”
3. User enters device no. (Mac address of device) or Selects from list
4. Application queries parsed XML data
5. Device no. is compared to device no. received from Ekahau Engine XML data
6. When device is found locations and times of device history loaded into map
7. Map displayed showing device path over time period.
Search device location:
1. User Starts Application
2. User Selects “Check Device Location”
3. User enters device no into search box
4. Xml feed is searched to determine if device is active
5. If device is Active location information is extracted
6. If device is not active last known location is extracted
7. Device live location or last known location is displayed on map.
5.4) GRAPHICAL USER INTERFACE (GUI)
The Project Application GUI is expected to be of high standard as it is web based it
allows for a lot of graphic and colour customisation. There would be three screens
Initially, One for the Main menu, and Two Sub menu screens. The first sub menu
would be for the Map Device history section and would initially display a list of
devices. Once these devices are clicked on a map would open with the device
history shown in a heatmap type format. This screen would also allow the searching
of a device. The second screen would be a search screen that could pinpoint a
device’s current location or last know location and display it on a map.
32
CHAPTER 6 – IMPLEMENTATION
During the initial stage of the development process there have been a few changes
to the original plan. The main change was the re-location of the research laboratories
from the MG Building to the MS Building. This was not a problem as it added a new
task to the project which was to carry out a survey and calibration of the MS Building
on the Ground floor. Both the MS and MG buildings of the university are shown
below in Figure 19 and the exact processes of the MS site survey are detailed in the
next section of the report.
Figure 19 – MG and MS Buildings at Magee
Another major change to the project development was the use of the Ekahau SDK
(Software Development Kit) for retrieving location data rather than parsing the data
from the XML feed. A few minor changes include the use of a different scripting
language (PhP as opposed to jsp) and the use of mySQL instead of Microsoft SQL.
There are more details of these changes further in this report.
6.1) EKAHAU SURVEY AND CALIBRATION
The Initial stage of the survey involves uploading a floor plan map of the Ground
floor MS building. This map is an accurate plan and is to scale shown in Figure 20.
33
Figure 20 – Floor plan of MS Ground Floor.
RAILS AND OPEN SPACE
After the map is loaded into the Ekahau Site Survey software, the rails and open
space are then marked out on the map to tell the Ekahau positioning engine where
devices are allowed to travel. As you can see in Figure 21, rails are drawn only as
far as the doors, this enables “open space” to be drawn in each of the rooms. “Open
Space” indicates that a person can walk around this room. Two rooms have been
excluded because they are private offices and thus tracking would not be feasible
here. The two largest rooms in the map (indicated by a red X for the purpose of this
report) have not had open space boxes added to them as the rooms are too big and
there are several obstacles in the centre of the rooms which would cause an
inaccurate reading. For these rooms rails were drawn instead and placed in strategic
positions to provide the best possible reading from those problem rooms.
Figure 21 – Rails and Open space drawn on MS Ground floor
34
SURVEY
The Survey is the most important stage of the calibration. The task is implemented
using a laptop equipped with the Ekahau Location Survey software and a wireless
card. If Figure 22 is examined you will see that there are several green lines with
arrows at the end and circles at the start. The Arrow indicates the direction headed
when the survey was taken and the circle indicates the starting point of the survey.
Only small sections of each room are surveyed at a time.
Example: There are four walls in first room. We start by clicking on the map at the
approximate position that we are standing in the room i.e. beside the door, and walk
parallel along the first wall until we reach the other side. We then click on the position
that we have walked to on the map to complete the first survey. To give as accurate
as possible a reading we then repeat this process on the same path but in the
opposite direction back to the door, again clicking on the map when we reach the
door. This process is repeated for all four walls in the room and for each room that
has rails or open space on the map.
Figure 22 – Survey Map of MS Ground Floor
35
MEASUREMENTS
During the survey there is constant communication between the surveying laptop
and the wireless access points they are stored as measurements readings and can
be viewed graphically in the Ekahau manager. The measurement view is shown in
Figure 23 below and each orange “dot” represents a signal received from the
wireless access points. These signals can be set to different time intervals for
greater accuracy. As the survey is being carried out the person carrying out the
survey should walk at a consistent pace and a slow speed to produce the most
accurate readings.
If the diagram Figure 23 is examined it can show which parts of the survey were
carried out quicker than others. The orange dots are readings from the Wireless
access points so the slower the survey device moves the more dots there are in a
specific area.
36
Figure 23 –diagram shows measurement of the signals coming from the wireless access points.
ACCESS POINTS AND SIGNAL STRENGTH
After the survey, there are several other views that can be accessed through the
Ekahau Manager. One view enables us to see the number of access points and their
estimated location on the map as shown in Figure 24.
Figure 24 – shows view of access points in Ekahau manager software.
Another view enables us to see the Signal strength of the Surveyed area. This signal
strength is measured in dbm (The level of a signal in dB relative to 1 m W (0 dBm).)
and is displayed as a heat map as shown in Figure 25.
37
Figure 25 – Shows the Signal strength of the survey for the Ground floor (MS)
ZONES
As mentioned in the “Proposed Implementation” section in this report, Zones will be
utilised for the purpose of demonstrating the effectiveness of the application that is
being developed for this Project. The Zones are an area on the map that is pre-
defined by the user and given a Unique Zone ID and Zone name. These Zones can
be used to alert a user when a specific tag enters or exits the Zone. The alert can be
in the form of a pop-up on the Ekahau administrators screen or an email sent to a
specified person.
The alert can also be set up to sound an alarm when the tag enters or exits the zone,
this alarm sound would come from the tag itself. The list of Zones that will be used in
this project can be seen in Figure 26.
Figure 26– the Zones created in the Ekahau Site Survey Application
As illustrated in Figure 26 above five Zones have been created for the ground floor
plan. These zones are:
Zone (id=1): Lecture theatre ms level 0
Zone (id=2): Research area ms level 0
Zone (id=3): Canteen ms level 0
38
Zone (id=4): Room A ms level 0
Zone (id=5): Room B ms level 0
So now that these Zones are in place this information will be shown in both the Xml feed and
the SDK call from our Project Application. The tag that holds the zone information is the
<poszoneid> tag and the number in between this tag is the Zone ID. The Tag
<poszoneid>10</poszoneid> would indicate that the tag was last detected in Zone 10 which
is the Canteen on MS ground floor.
POSITIONING MODEL
The Ekahau Site Survey creates a Positioning Model that has the file extension
*.esx. After the initial site survey and calibration is carried out the model then has to
be uploaded to the Ekahau Positioning Engine Server, there are two ways of doing
this. The first way of doing it is through the Ekahau Site Survey. The Site Survey
application has a function that enables a user to send the Site survey model file
directly to the Ekahau Positioning Engine Server from within the application. This
method is the most convenient and is the method that will be used for this project.
The Alternative way of loading the file is by saving it to the hard drive then uploading
it later through the process outlined below.
To upload the model the following address is typed into the browser address bar:
http://193.61.190.42:8550/epe/main/. The IP “193.61.190.42” is the Ekahau
positioning Engine IP address. After logging in, we can then access the Ekahau
Positioning Engine interface and upload the map see Figure 27.
39
Figure 27 – Shows the page for uploading a Site survey map to
the Ekahau Positioning Engine.
After the site survey model has been uploaded to the Ekahau Positioning Server we
can then view all available models by clicking on the “models” link on the site. The
list of models available is shown in Figure 28 below. As you can see the “Active
Model” is displayed in bold and the current active model is the one that has just been
created using the Ekahau Site Survey application.
F i g u r e 2 8 – L i s t o f S u r v e y M o d e l s a v a i l a b l e t o t h e E k a h a u P o s i t i o n i n g
Engine
40
Now that The Site Survey is complete and the Model is uploaded to the Ekahau
Positioning Server, the tags and devices can now be tracked and positioning data
can be gathered and stored in our Database. The Tag’s will be carried be a number
of staff members and students that frequently move around the ground floor during
the week. These movements will be received by our Java application and stored in a
database which will then be displayed graphically on the application Web Frontend.
6.2) PROJECT SOFTWARE
INTRODUCTION
As mentioned in the previous section there has been many changes to the original
project plan. The main ones being the re-locating of the project base from the MG
building to the MS building. As far as the software goes the main changes would be
the use of the Ekahau SDK and a slight modification to the web front of the
application. The original plan for the web front was to have two separate sections,
one for the user to check a device location history. The other section was to locate a
device’s current or last known location. These functions are still present in the
developed application but they are not separated, i.e. to access a device history you
must first search for a device’s last known location. The reason for this change was
to simply integrate the web front together and provide much faster access to the
location history.
Another change was the exclusion of a heatmap. The “heatmap” as mentioned in the
proposed Implementation chapter would have been a nice addition to the device
history page, but it would not have served any purpose. Ekahau has a heat map
function that shows a wireless network’s signal strength and it works well for this
type of scenario as there is fluctuating data in a large area. This project however will
only be concerned with counting specific numbers in specific zones so there will be
no fluctuation of data and therefore a heatmap would not function properly. This
counting would be the number of times a device has entered each room (Zone).
41
Here is the new order of proceedings based on changes:
JAVA SOFTWARE:
1. Run Java software, with active internet connection and leave running
WEB SOFTWARE:
1. User Starts Application by opening application URL:
http://localhost/ekahautest/2. User enters Mac address into search box
3. User clicks Search
4. Application executes php code and queries MySql database
5. Application returns last know device location based on Mac address. This
location would be the zone that the device was last detected in. And the Zone
would now be a hyperlink.
6. User Clicks on hyperlink to display map image of last zone device was
detected in
7. Application also returns Timestamp which tells the date and time the device
was last detected
8. Hyperlink also available stating “Click here for device history”
9. When clicked the url executes another php file which shows all zones device
has entered over a period of time and how many times the device has entered
each zone.
The Changes in software are highlighted below with reasons as to why specific technologies where used. To give an overview this project consists of the following:
Java Application (using Ekahau SDK)
MySql Database (Using my Sql)
Web front (Using Php and connect using Apache.)
42
EKAHAU SDK
The Ekahau Software Development Kit is supplied with the Ekahau software and
contains an out of the box solution for calling the Ekahau API (Application
Programming Interface) in Java. Here are some of the tasks the Ekahau API
handles:
Parses XML documents into messaging objects automatically
HTTP DIGEST authentication
Calls the streaming API (HTTP 1.1 chunked transfer)
Encodes/decodes BASE64 data
The SDK contains five packages of Java classes and interfaces, one for example
applications, and the other four packages for the actual SDK API.
Below is a short explanation of the four packages that are being used in this project.
com.ekahau.common.sdk - contains the SDK's basic framework. All the
functionality in the Engine API is accessible through the classes and
interfaces in this package.
com.ekahau.engine.sdk is a supplement to the aforementioned SDK
framework package. It provides higher level easy-to-use utilities for accessing
the most commonly needed features.
com.ekahau.engine.sdk.event is a sub-package containing classes and
interfaces related to the event API.
com.ekahau.engine.sdk.impl is a sub-package for code that is used
internally by the SDK.
We will only be using the com.ekahau.common.sdk package as it contains the core
classes needed to develop the project. This package and its contents will be
discussed further on in the report.
43
EKAHAU API
An API (Application Programming Interface) is a set of functions, procedures,
methods or classes that an operating system, library or service provides to support
requests made by computer programs [15].
The Ekahau API is basically a web service which is based on HTTP/XML web
service technology. Http is used as the transport protocol and XML is used to
encode the data. The Ekahau API can be tested using a web browser. An API call is
performed by making a HTTP request to a URL in the Engine. The request may
contain input parameters. The Engine sends back a response, an XML document
[16].
THE JAVA APPLICATION
For the Project application four packages were created in eclipse each with their own
classes:
1. com.mcmenamin
2. com.mcmenamin.ekahau
3. com.mcmenamin.ekahau.db
4. com.mcmenamin.ekahau.domain
5. com.mcmenamin.ekahau.scheduler
COM.MCMENAMIN
44
This package holds the Main class of the application which calls all the other classes
in the eclipse project.
Main.class
The main class makes a call to all the other classes and brings the application
together. The order it calls all the other classes goes like this:
1. Set-up Db connection
2. Pass connection Details to Db Manager
3. Set-up Ekahau Engine connection
4. Pass connection details to Engine Manager
5. Pass manager details to TagTaskQuery to put retrieved details into a list
6. Start a Timer to set how often to query Ekahau Engine
`
COM.MCMENAMIN.EKAHAU
This package contains two classes that handle the Ekahau server connection.
1. EkahauPosEngineConnectionFactory Class
2. EkahauPosManager Class
EkahauPosEngineConnectionFactory.class Sets up Connection to the Ekahau Engine server
Sets server address, username, password and port.
Limits connection to only one instance so that multiple connections cannot
occur
EkahauPosManager.class Sets query to send to Ekahau server requesting all tag current positions
Sets up Emsg[] array and stores tag positions in this array
45
Extracts eMsg [] array data and returns an ArrayList of Emessage domain
objects
Takes a token parses it and set the attribute on the Emessage object
reference.
COM.MCMENAMIN.EKAHAU.DB
Handles connection to the mySQL database and contains two classes
1. DBConnectionFactory Class
2. DBManager Class
DBConnectionFactory.class Sets database address and driver name
Creates database connection
DBManager.class Calls connection from DBConnectionFactory
Parses date Timestamp to simple date format
Set up Sql query from Emessage class
Execute Sql query inserting Emessage list into MySql database
COM.MCMENAMIN.EKAHAU.DOMAIN
This package contains one class called EMessage class which is used to store the
data received from the Ekahau positioning engine.
Emessage.class Domain class used to store all code from Ekahau engine
All positioning fields initialised ( tagid, PosX, PosY etc..)
46
Get and Set methods for all tag fields (getTagId(), setTagId)
Set up methods for all values
COM.MCMENAMIN.EKAHAU.SCHEDULER
Contains one class knows as TagTaskQuery Class which handles timing the calls to
the Ekahau Positioning engine and sends the contents to an Array waiting for
Database delegation.
TagTaskQuery.class Interfaces Ekahau positioning feed with database insertation
Sends engine positioning info to database
MYSQL DATABASE
The MySql database is an open source database that is used by many online
companies such as Yahoo!, Alcatel-Lucent, Google, Nokia, YouTube, and
Zappos.com [16]. MySql is most popular database because of its consistent fast
performance, high reliability and ease of use [16].
Reasons why mySql Server 5.1 was chosen over Microsoft’s SQL server 2005:
Operating systems:
Currently this java application is currently being developed for demonstration at
Magee where they run all their systems on Windows XP. In the future this application
could well be developed for use on Linux systems or older versions of Windows.
Microsoft’s SQL Server 2005 only runs on two types of operating systems, which are
Windows XP and Windows 2000+. While the open source MySql server 5.1 runs on
over 50 operating systems [16].
47
Licensing
Microsoft SQL 2005 is a closed source commercial product and offers different levels
of features based on the version which directly relates to the cost of the product.
MySql is free and is also open source which is very suitable for this Project with
regard to demonstrating the database on University systems.
Installation
MySql can install on a computer system within a minute and uses little resources in
doing so. In Comparison to Microsoft SQL 2005 installation which takes up to 5
minutes and can be difficult to configure.
SOFTWARE NEEDED FOR MYSQL:
MySql Server 5.1 MySql – Front
MySql Server 5.1 is needed to run a MySql database on a system. The software
comes with several components some of which are listed in detail below:
MySql Administrator: This tool gives user access to Administrative task such as
starting and stopping a MySql server. It also shows a lot of configuration information
such as hostname, server IP, system Information etc. Another great feature of MySql
Administrator is the Backup and restore function, allowing manual or scheduled
backup of the MySql database. Server logs and Server Health is also accessible
from the Administrator tool.
48
Figure 29 – MySql Administrator running the Project server
MySql Query browser
While MySql administrator is used to administer a MySql server. The Query browser
is used to execute queries, create tables and edit and analyse data stored in the
MySql database.
Figure 30 – MySql Query Browser
49
MYSQL - FRONT
MySql – Front is not a part of the MySql tools package. Although like MySql 5.1 this
software is also open source and free but it was developed by a different community.
MySql Front is a graphical interface for the MySql database running on the host
machine and can be used to create tables, delete tables, and view data similar to the
view in Microsoft’s access. This software was used as it provided faster on-demand
access to the data and was more “visual” to work with allowing the development
process to move at a much faster pace.
Figure 31 – MySql – Front showing database columns, rows and the data.
SQL CODE
The data being stored in this project only needs a single table to hold the data as the
php takes care of the parsing and displaying of the data on the front end.
To create the table the following code is typed into the MySql Query browser:
50
DROP TABLE IF EXISTS `log`;CREATE TABLE `log` (`id` int(11) NOT NULL AUTO_INCREMENT,`tagid` bigint(11) NOT NULL,`posX` int(11) NOT NULL,`posY` int(11) NOT NULL,`posModelId` int(11) NOT NULL,`posMapId` int(11) NOT NULL,`posZoneId` int(11) NOT NULL,`posQuality` int(11) NOT NULL,`posCounter` int(11) NOT NULL,`battery` int(11) NOT NULL,`posReason` int(11) NOT NULL,`macAddress` varchar(20) NOT NULL,`posMapName` varchar(50) NOT NULL,`posTimeStamp` varchar(50) NOT NULL,`posTime` bigint(20) NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Stores the data from the Ekahau engine';
This code creates the database table called ‘log’ with 15 Columns created for the
purpose of holding data coming from the Project software.
For the purpose of checking the database was functioning correctly the following
code was executed to insert dummy data into the database:
INSERT INTO `log` (`id`, `tagid`, `posX`, `posY`, `posModelId`, `posMapId`, `posZoneId`, `posQuality`, `posCounter`, `battery`, `posReason`, `macAddress`, `posMapName`, `posTimeStamp`, `posTime`) VALUES
(1, 1001, 200, 300, 10101, 1, 1, 10, 100, 90, 1, 'AA:CC:AA:BB', 'Hall', '123123123123', 213123331321);
51
After successful insertion of the data, the MySql database was ready for use. The
MySql statement above is used in the Project software to insert the application
variables into the database.
PHP PAGES
PhP which stands for “Hypertext PreProcessor” is a server-side, HTML embedded
scripting language used to create dynamic Web pages. Much of its syntax is
borrowed from C, Java and Perl with some unique features. A Php page consist of a
standard html page with the php code enclosed usually in the body of the document
between two php tags (<?php ?>). Php code executes on the server and sends the
user the output, unlike JavaScript which executes the code on the client allowing
everyone to see (and use) the source code of your JavaScript. This is one of the
reasons why php was chosen as a scripting language for this project. Another
reason why php was chosen over the other scripting languages was that php is
“Open Source” the same as MySql so they connect together well.
XAMPP
Xampp is another application that has been installed for use with this Project. Xampp
is a web server package that can run Apache Http server, MySql and serves as an
interpreter for Php and Pearl Scripts. The function of the Xampp application in this
project is to interpret the Php pages created for the Project web front with Apache.
This task was accomplished by creating a directory called “ekahautest” in the Xampp
php directory knows as “htdocs” this is where Apache executes the Php code. The
Project web front directory is located here: “ C:\xampp\htdocs\ekahautest” and
contains all the php files, css files and image files needed for the web front to
function.
52
When testing the web front the following address “http://localhost/xampp/ekahautest
“is copied into the address bar of a browser this calls the index.php file located in the
Xampp directory on the C drive executes it on the Apache local server and outputs
the code in the client web browser.
PHP
In the web front of this Project there two Php files these are index.php and
historylink.php. There are also some extra files that are used for aesthetic
purposes, such as the images files contained in images folder. There is also a
cascading style sheet called default.css used to control font colours/sizes and mainly
used to control the layout of the page (Div’s).
The php code is commented and the main sections of the code will be discussed
below.
INDEX.PHP CODE
Loading Scripts and CSS:The code below is the html code that is needed when using external JavaScript or
Css files. The first 3 files are JavaScript: “prototype.js”, “scriptaculous.js” and
“lightbox.js”. These are all associated with a JavaScript function used to display an
image of a particular zone that a device is in. This JavaScript was retrieved from an
external source and produces a zoom effect before displaying the desired image.
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
53
<script type="text/javascript" src="js/lightbox.js"></script>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="default.css" type="text/css" media="screen" />
The other two files “lightbox.css” and “default.css” are cascading style sheets used
for controlling the page layout and the zoom effects layout.
Content Area:
Below is the basic layout of the page with a header, paragraphs and a form to take
user input (in this case the Mac address) to search the MySql database. This
process starts with the line <form name="form" action="index.php" method="get">
which executes the php code in the page.
<h1>Ekahau Project Web-App</h1>
<p>Welcome to the Web application for Ekahau.</p>
<p>Enter Mac Address of device:</p>
<form name="form" action="index.php" method="get">
<input type="text" name="q" />
<input type="submit" name="Submit" value="Search" />
</form>
54
Figure 32 – Shows the search form in the Project Web-app.
PHP CODE:
Below is the code used to make a connection to the MySql database. When the connection is made the search is carried out based on what the user has inputted into the search form.
<?php
// Get the search variable from URL
$var = @$_GET['q'] ;
$trimmed = trim($var); //trim whitespace from the stored variable
//number of rows to return
$limit=10;
// check for an empty string and display a message.
if ($trimmed == "")
{
55
echo "<p>Please enter a search...</p>";
exit;
}
// check for a search parameter
if (!isset($var))
{
echo "<p>We dont seem to have a search parameter!</p>";
exit;
}
//connect to the database
mysql_connect("localhost","root","pass123"); //(host, username, password)
//specify database
mysql_select_db("ekahau") or die("Unable to select database"); //select which database we're using
// SQL Query
$query = ("select macAddress, tagid,posZoneId, posMapName, MAX(posTimeStamp) AS timeStamp,posTimeStamp, posQuality from log
where macAddress like\"%$trimmed%\"
order by macAddress");
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// If we have no results
if ($numrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";
}
// next determine if s has been passed to script, if not use 0
56
if (empty($s)) {
$s=0
}
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched for
echo "<p>You searched for: "" . $var . ""</p>";
// show results
$count = 1 + $s ;
// display the results returned
while ($row= mysql_fetch_array($result)) {
$tagid = $row["tagid"] ;
$mac = $row["macAddress"];
$postimestamp = $row["timeStamp"];
$posy = $row["posY"];
$posZoneId =$row["posZoneId"];
echo "<span class='style1' align='center'>Tag ID: </span> $tagid<br>";
echo "<span class='style1'>Mac address: </span>$mac<br>";
echo "<span class='style1'>Last Know location: </span>
<a href=images/$posZoneId.jpg rel='lightbox'>Zone $posZoneId</a><br> " ;
echo "<span class='style1'>Time Stamp: </span>$postimestamp<br><br>";
echo "<a href=historylink.php?test=$mac>Click here for device $macAddress History</a></span><br> " ;
57
echo "<br><br>";
$count++ ;
}
//break
echo "<br />";
?>
We examine this line:
<a href=images/$posZoneId.jpg rel='lightbox'>Zone $posZoneId</a>
The line above highlighted in green is Important as it places the name of the last
zone the searched device was in into the start of a jpg. This means that if the last
zone that the device was in was Zone 1, then the variable “$posZoneId” would store
the number 1. This variable would then be added to the link creating
“$posZoneId.jpg” meaning “1.jpg”.
We examine this line:
"<a href=historylink.php?test=$mac>Click here for device $macAddress History</a>
The link above shows how the device’s Mac address that was stored for the search
function can be passed to the second php page as a variable. historylink.php is the
page that the variable is being passed to. By adding the question mark after it we are
indicating that we are passing data. The text “test” being the variable and the text
“$mac” being the value of the variable. The $mac value is retrieved by the search.
58
Figure 33 shows the design/layout of the results page (which is the same page:
index.php)
Figure 33 – Results page after execution of php search.
HISTORYLINK.PHP CODE
The basic layout of this page is the same as the index.php layout although the php
code is different. As mention in the previous paragraph the “test” variable was being
passed from the index.php page to this page via the text: historylink.php?test=$mac.
59
The line $var = @$_GET['test'] ; takes the variable “test” passed from the previous
link click and stores it as $var. The variable “$var” is then passed to the Sql Query
and the returned query is passed to another variable called “$result”.
<?php
$db="ekahau";
$link = mysql_connect("localhost","root","pass123");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$var = @$_GET['test'] ;
$result = mysql_query ("SELECT posZoneId, COUNT(*) As Total FROM log
WHERE macAddress like \"%$var%\"
GROUP BY posZoneId ORDER BY Total DESC")
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are <span class='style1'>$num_rows</span> records for Mac Address: <span class='style1'>$var</span><br><br>";
print "Below is a Zone history for the device<br><br>";
print "<table width=120 border=0>\n";
$count = 1 + $s ;
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
$mac = $row["macAddress"];
$total = $row["Total"];
$posZoneId =$row["posZoneId"];
60
echo "Entered <a href=images/$posZoneId.jpg rel='lightbox'>Zone $posZoneId</a> :" ;
echo " $total times <br>";
$count++ ;
}
?>
$result = mysql_query ("SELECT posZoneId, COUNT(*) As Total FROM log
WHERE macAddress like \"%$var%\"
GROUP BY posZoneId ORDER BY Total DESC")
From the Highlighted code above we can see that Sql query is asking the database
to group all the Zone id’s (posZoneId) together and count them for a specified mac
address (The mac address comes from the index.php page from the search).
Output would be similar to the following:
Zone | total
------ |-----------
3 | 42 4 | 33 2 | 32 5 | 11 1 | 10
The “Zone” column would indicate what zone the table is referring to and the “total”
would indicate how many times that device was in the zone.
61
SO TO SUMMARISE THE INTERACTION BETWEEN ALL THE SOFTWARE:
1. Java Software Connects to Ekahau server and retrieves tag details
every 10 seconds
2. Java Software Connects to MySql Database
3. Java Software sends positioning data to MySql database
4. Php connects to MySql server via Apache server.
5. Php performs queries MySql database for device last known location
(Zone)
6. Php Displays last known location
7. Php Queries MySql database for device history information
8. Php displays Device history information
Now that the Software and database are in place, the next stage involves gathering
location history by moving tags around the ground floor. Then testing the database
and the Java software and finally testing the Web front. These Testing details can be
found in the next chapter.
CHAPTER 7 TESTING AND EVALUATION
INTRODUCTION
This chapter addresses the testing and evaluation of the system. The term testing
will be briefly described and each of the software components that were tested will
be documented in this chapter. The term evaluation will also be described and an
evaluation of the Project software solution will be carried out.
62
EVALUATION
There are two types of Evaluations, Formative and Summative Evaluation.
Formative evaluation is typically conducted during the development or improvement
of a program or product (or person, and so on) and it is conducted, often more than
once, for in-house staff of the program with the intent to improve. The reports
normally remain in-house; but serious formative evaluation may be done by an
internal or an external evaluator or preferably, a combination; of course, many
program staff are, in an informal sense, constantly doing formative evaluation [17].
Summative evaluation provides information on the product's efficacy (it’s ability to do
what it was designed to do). For example, did the learners learn what they were
supposed to learn after using the instructional module. In a sense, it lets the learner
know "how they did," but more importantly, by looking at how the learner's did, it
helps you know whether the product teaches what it is supposed to teach.
EVALUATION OF FUNCTIONAL AND NON- FUNCTIONAL REQUIREMENTS
Functional Requirements
Requirement Tested
Result Comment
1 Pass The Software must have access to the Ekahau Positioning Engine
logs.
The software creates the logs from live Ekahau Engine data and
stores in its own database hence it does not need access to the
Ekahau engine logs
63
2 Pass The Software requires a device search function
There is a device Search function available on the web front end
which searches live and stored data in the database.
3 Pass The Software requires a web based GUI
A web Based Gui has been developed
4 Pass The Software must have an Map system Independent from Ekahau
The web Interface allows a device current or last location to be viewed
on a map.
5 FAIL The software must be able to query the Ekahau Position Engine for
device co-ordinates.
Since “Zones” are being used the device co-ordinates were not
needed as we are not plotting specific device locations, instead we
are plotting device proximities to specific “Zones”. Although the co-
ordinates are being stored in the project database and may be called
if required.
Non-Functional requirements
Requirement Tested
Result Comment
1 Pass The Software design will show good HCI practice
The web front end has been designed specifically with HCI in mind and
64
passes all the standard HCI guidelines for web application design.
2 Pass The Software should have an athsteticaly pleasing GUI and show
reliability.
The web front is compact and to the point when asking the user to enter
input. It is also reliable and is crash free.
3 Pass The Software should be versatile
The software has got only 2 major functions that is to locate a device’s
current location, and to view a device’s travel history, the software is
capable of much more and is would be very easy to extend its
capabilities.
4 Pass The connection between the Software and Ekahau Server should be
permanently available.
As long as the Ekahau server is running and the machine that has the
Project software installed on it has a live internet connection then a
permanent connection between the software and the Ekahau server is
possible.
5 Pass The Software response time should be as fast as possible.
The software does not have any delays as it is running on a localhost,
some speed issue’s may need to be addressed when the web
application runs on a server.
6 Pass The software should be portable
65
The web front of the software is extremely portable as it can be
accessed from any pc equipped with a browser. Once the system is up
and running.
TESTING
Software testing is any activity aimed at evaluating an attribute or capability of a
program or system and determining that it meets its required results [18]. Although
crucial to software quality and widely deployed by programmers and testers,
software testing still remains an art, due to limited understanding of the principles of
software. The difficulty in software testing stems from the complexity of software: we
cannot completely test a program with moderate complexity. Testing is more than
just debugging. The purpose of testing can be quality assurance, verification and
validation, or reliability estimation. Testing can be used as a generic metric as well.
Correctness testing and reliability testing are two major areas of testing. Software
testing is a trade-off between budget, time and quality.
The next section highlights the testing of the different components of the software.
Java Application testing
There are two tests that need to be carried out for the java application
1 – Test data is being received from Ekahau Server
2 – Test data is being sent to MySql database
66
Both tests can be carried out at the same time by simply running the java software
for a period and checking the MySql database afterwards. To run the software we
must be connected to the internet and then click the Run button in Eclipse.
After run is clicked the console will start producing output as follows:
28-Apr-2009 14:22:33 com.mcmenamin.ekahau.EkahauPosEngineConnectionFactory setupConnection
INFO: Connecting - 193.61.190.42:8550
28-Apr-2009 14:22:33 com.mcmenamin.ekahau.EkahauPosEngineConnectionFactory setupConnection
INFO: Connected to Ekahau Positioning Engine
28-Apr-2009 14:22:33 com.mcmenamin.ekahau.EkahauPosManager getAllGoodPositions
INFO: eConnection = com.ekahau.common.sdk.EConnection@1d99a4d
INFO 2009-04-28 14:22:33,817 org.apache.commons.httpclient.auth.AuthChallengeProcessor [Timer-0] - digest authentication scheme selected
28-Apr-2009 14:22:34 com.mcmenamin.ekahau.EkahauPosManager
getAllGoodPositions
This indicates that the connection has been made and that the server is sending a
request for tag positions.
After the Tag’s have all been received and parsed they are then sent to the database
as shown in the console output below:
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (105463684135, 320, 209, 0, 2, -1,61, 0, 100, 3, '00:18:8E:20:1C:27', 'MS 1st Floor', 'Tue Apr 28 14:18:36 BST 2009', 1240924716674)
67
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (105463683717, 320, 213, 0, 2, -1,51, 0, 100, 3, '00:18:8E:20:1A:85', 'MS 1st Floor', 'Tue Apr 28 14:18:35 BST 2009', 1240924715043)
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (85073987312, 320, 113, 0, 2, -1,59, 0, 100, 3, '00:13:CE:CE:06:F0', 'MS 1st Floor', 'Wed Apr 22 17:13:18 BST 2009', 1240416798359)
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (105462119195, 320, 184, 0, 2, -1,76, 0, 100, 3, '00:18:8E:08:3B:1B', 'MS 1st Floor', 'Mon Apr 20 11:59:08 BST 2009', 1240225148390)
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (49041931176, 158, 113, 0, 2, -1,93, 0, 100, 3, '00:0B:6B:20:7B:A8', 'MS 1st Floor', 'Wed Mar 25 16:32:56 GMT 2009', 1237998776781)
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (72057994854, 29, 199, 0, 1, -1,37, 0, 100, 2, '00:10:C6:FD:BE:66', 'Block MG - Second Floor', 'Tue Sep 09 11:42:35 BST 2008', 1220956955281)
INSERT INTO log (tagid, posX, posY, posModelId, posMapId, posZoneId, posQuality, posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) VALUES (72049780667, 29, 198, 0, 1, -1,49, 0, 60, 2, '00:10:C6:80:67:BB', 'Block MG - Second Floor', 'Thu Sep 04 13:58:53 BST 2008', 1220533133234)
If we check the MySql database we can see that the records have all been added
68
Figure 33 – Testing MySql data has been added
This indicates that the software is communicating with both the Ekahau server and
the MySql database. From this test we can also deduct that the MySql database is
working and no further test need to be carried out on this.
WEB APPLICATION TESTING
The web application is tested for functionality:
Search:
Figure 34 – Shows a search being carried out
The search displayed is correct and now to click on the device history link to verify it
is working:
69
Figure 35 – Shows zone count working
CHAPTER 8 – CONCLUSION
Based on the research for this initial report into Local Positioning Systems and more
specifically the Ekahau Positioning System, It was found that there exists a great
opportunity to develop a state of the art Innovative Software application to
compliment Ekahau’s already Ingenious Wi-Fi Positioning engine. This software
application for this Project will be the stepping stone to a large scale multipurpose
location application that may be used in more social ways like a “locate your friend
on campus” application or “Find your course tutor” application. However, this brings
up a very important issue that doesn’t receive much attention in technical reports….
….Privacy.
The Privacy issue is an important one in this field of research because sometimes
technological research seems to steamroller over such issues in the name of the
ultimate goal….. Results. It is widely believe that this technology has the potential to
take away people’s privacies if abused, or in the wrong hands. So proper protocol
should be followed when such technologies are being developed.
To conclude this report, it is suggested that while all these technologies have many
different strengths (range, accuracy, reliability), they also have many weaknesses. It
70
seems clear that the best approach for future Location technologies is to combine
several different types, for instance a system that had the Range and wide coverage
area of GPS, the low cost of Wi-Fi local positioning systems (due to already present
infrastructure) and the proximity and security advantages of RFID. This type of
combination or similar would “fill in the gaps” that many current positioning systems
have.
8.1 FUTURE DEVELOPMENT
The Software developed in this project shows that there are many real life
applications that this technology could be used for. The Project software has the
ability to count the number of times a device was detected entering a zone, and can
list the zones by their highest count. This application could be an excellent marketing
information tool. For example, In a Large supermarket environment tags could be
attached to the supermarket trolleys. If the ekahau system was installed and
obviously a Wireless connection available then users patterns could be tracked and
a marketing strategy could be built up based on these movement patterns. This
example could be easily implemented by creating “Zones” as we did in this project
i.e. “deli Zone”, “Frozen food Zone”, “Alcohol Zone” etc.
Another possible Future project would be Congestion control at Magee. This would
involve a volunteer from every class/course in Magee. The volunteer’s would carry a
tag every day in the university for a week or two weeks. Using the device history
software created (along with the ekahau system of course) we could then view what
paths these students take every day. This information could then be viewed to flag
possible congestion areas and to maybe re-schedule some classes to cope with the
problem.
71
REFERENCES
[1] Emergency Call Location Solution (2008) found on the web at:
http://www.trueposition.com/web/guest/emergency-call-location
[2] Initiative aims to enhance EU emergency services (2003) found on the web
at: http://www.euractiv.com/en/infosociety/e112-initiative-aims-enhance-eu-
emergency-services/article-115827
[3] Wi-Fi From Wikipedia (2008) found on the web at: http://en.wikipedia.org/wiki/Wi-Fi
[4] How GPS Receivers Work by Marshall Brain and Tom Harris, found on the web
at: http://adventure.howstuffworks.com/gps2.htm
72
[5] Bluetooth Positioning,Josef Hallberg, Marcus Nilsson, Kåre Synnes
found on the web at:
http://media.csee.ltu.se/publications/2002/hallberg02bluetooth.pdf
[6]Local Positioning Systems, LBS Applications and Services, Kyzystof W.
Kolodziej/Johan Hjelm (2006)
[7] Roland Piquepaille's Technology Trends, How new technologies are modifying
our way of life, found on the web at:
http://www.primidi.com/2005/05/10.html
[8] Cisco Wireless Control System (WCS) system overview, found on the web at:
http://www.cisco.com/en/US/prod/collateral/wireless/ps5755/ps6301/ps6305/
product_data_sheet0900aecd802570d0.html
[9] FEATURED PARTNERS of R@etech, AeroScout, found on the web at:
http://www.raetech.net/featuredPartner.html
[10] WhereNet Product overview, Wheretag III, found on the web at:
http://www.wherenet.com/products_wheretag.shtml
73
[11] WhereNet Product overview, Wheretag IV, found on the web at:
http://www.wherenet.com/products_wheretagiv.shtml
[12] How GPS Receivers Work by Marshall Brain and Tom Harris, found on the web at:
http://www.howstuffworks.com/gps.htm
[13] RFID Journal, General RFID Information found on the web at:
http://www.rfidjournal.com/faq/16/48
[14] Introducing New LF Chip for Livestock, Asset Tracking, Mary Catherine O'Connor found on the web at:
http://www.rfidjournal.com/article/articleview/4460/
[15] http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=43487
[16] http://www.mysql.com
[17] Scriven, (1991)
[18] Hetzel, William C., The Complete Guide to Software Testing, 2nd ed. Publication info: Wellesley, Mass. : QED Information Sciences, 1988. ISBN: 0894352423.Physical description: ix, 280 p. : ill ; 24 cm
74
APPENDIX A
January February March April
RESEARCH ACTIVITESW1
W2
W3
W4
W1
W2
W3
W4
W1
W2
W3
W4
W1
W2
W3
W4
INVESTIGATIVE/SELECTIVE
Further location awareness research
Learn JavaScript, AJAX and web technologies for integrating
Learn the necessary software packages
Set up necessary software and experimental testbed for mapping
SYSTEM IMPLEMENTATION
Create Web Application (Prototype)
Enhance prototype & perform tests
Create Web Application & test for accuracy
75
Evaluation of system on users
Built in slack for unplanned problems
INTEGRATION AND TESTING
WRITE UP OF THESIS
Figure 29: Project Schedule
APPENDIX B – JAVA APPLICATION
Main.class
package com.mcmenamin;
import java.util.Date;
import java.util.Timer;
import org.apache.log4j.Logger;
import com.mcmenamin.ekahau.EkahauPosEngineConnectionFactory;
import com.mcmenamin.ekahau.EkahauPosManager;
import com.mcmenamin.ekahau.db.DBConnectionFactory;
import com.mcmenamin.ekahau.db.DbManager;
import com.mcmenamin.ekahau.scheduler.TagTaskQuery;
/**
* Main class
76
*
*
*
*/
public class Main {
private static final Logger logger = Logger.getLogger(Main.class.getName());
public static void main(String[] args) {
DBConnectionFactory dbConnectionFactory = DBConnectionFactory.getInstance();
DbManager dbManager = new DbManager(dbConnectionFactory.getConnection());
EkahauPosEngineConnectionFactory engineWrapper = EkahauPosEngineConnectionFactory.getInstance();
//call to get all good positions
EkahauPosManager manager = new EkahauPosManager(engineWrapper.getEConnection());
TagTaskQuery tagTaskQuery = new TagTaskQuery(manager, dbManager);
Timer timer = new Timer();
Date d = new Date();
timer.schedule(tagTaskQuery, d, 10000);
}
}
77
EkahauPosManager.classpackage com.mcmenamin.ekahau;
import java.util.ArrayList;import java.util.List;import java.util.Scanner;import java.util.StringTokenizer;import java.util.logging.Logger;
import com.ekahau.common.sdk.EConnection;import com.ekahau.common.sdk.EException;import com.ekahau.common.sdk.EMsg;import com.ekahau.common.sdk.EResponse;import com.mcmenamin.ekahau.domain.EMessage;
public class EkahauPosManager {
private static final Logger logger = Logger.getLogger(EkahauPosManager.class.getName());
//Queryprivate static final String ALL_GOOD_QUERY = "/epe/pos/taglist?
fields=posgood&orderby=lastpos&ascending=false";
private EConnection eConnection;
public EkahauPosManager(EConnection eConnection) {this.eConnection = eConnection;
}
78
/** * Connects to the Ekahau Positioning Engine and returns all the Tags
with * All Good Positions. */public EMsg[] getAllGoodPositions() {
EMsg[] msgs = null;try {
logger.info("eConnection = " + eConnection);EResponse response = eConnection.call(ALL_GOOD_QUERY);msgs = response.get();for(EMsg msg : msgs) {
logger.info(msg.toString());}
} catch (EException e) {e.printStackTrace();
}
return msgs;}/** * Takes a EMsg[] array and extracts the data, it then * returns a ArrayList of EMessage Domain objects. * * @param msgs * @return ArrayList<EMessage> */public ArrayList<EMessage> parseEMsgs(List<EMsg> msgs) {
final String DELIMITER = ",";ArrayList<EMessage> msgList = new ArrayList<EMessage>();StringTokenizer msgTokenizer = null;EMessage eMessage = null;for(EMsg msg : msgs) {
eMessage = new EMessage();msgTokenizer = new StringTokenizer(msg.toString(),
DELIMITER);while(msgTokenizer.hasMoreElements()) {
parseToken(msgTokenizer.nextToken(), eMessage);}msgList.add(eMessage);
}
return msgList;}/** * Takes a token parses it and set the attribute on the * ENessage object reference.
79
* * @param token * @param msg EMessage */private void parseToken(String token, EMessage msg) {
final String DELIMITER = "=";final String TAG_ID = "EMSG(TAG): tagid";final String MAC = "mac";final String POSX = "posx";final String POSY = "posy";final String POS_MODEL_ID = "posmodelid";final String POS_MAP_ID = "posmapid";final String POS_ZONE_ID = "poszoneid";final String POS_MAP_NAME = "posmapname";final String POS_QUALITY = "posquality";final String POS_REASON = "posreason";final String POS_TIME = "postime";final String POS_TIME_STAMP = "postimestamp";final String BATTERY = "battery";
Scanner scanner = new Scanner(token);scanner.useDelimiter(DELIMITER);while(scanner.hasNext()) {
String key = scanner.next().toString().trim();String value = scanner.next().toString().trim();logger.info(key + "-" + value);if(key.equals(TAG_ID)) {
msg.setTagId(Long.parseLong(value));}if(key.equals(MAC)) {
msg.setMacAddress(value);}if(key.equals(POSX)) {
msg.setPosX(Integer.parseInt(value));}if(key.equals(POSY)) {
msg.setPoxY(Integer.parseInt(value));}if(key.equals(POS_MODEL_ID)) {
msg.setPosX(Integer.parseInt(value));}if(key.equals(POS_MAP_ID)) {
msg.setPosMapId(Integer.parseInt(value));}if(key.equals(POS_ZONE_ID)) {
msg.setPosZoneId(Integer.parseInt(value));}if(key.equals(POS_MAP_NAME)) {
msg.setPosMapName(value);}if(key.equals(POS_QUALITY)) {
msg.setPosQuality(Integer.parseInt(value));
80
}if(key.equals(POS_REASON)) {
msg.setPosReason(Integer.parseInt(value));}if(key.equals(POS_TIME)) {
msg.setPosTime(Long.parseLong(value));}if(key.equals(POS_TIME_STAMP)){
msg.setPosTimeStamp(value);}if(key.equals(BATTERY)) {
msg.setBattery(Integer.parseInt(value));}
}
}}
EkahauPosEngineConnectionFactory.classpackage com.mcmenamin.ekahau;
import java.util.logging.Logger;
import com.ekahau.common.sdk.EConnection;import com.ekahau.common.sdk.EException;import com.ekahau.common.sdk.EMsg;import com.ekahau.common.sdk.EResponse;
/** * Singleton class, used to make setup a connection to the Ekahau Positioning engine, * and provide convenience methods that allow the user to get certain information back * regarding tags. * * @author * @version initial version 1.0 */
public class EkahauPosEngineConnectionFactory {
private static final Logger logger = Logger.getLogger(EkahauPosEngineConnectionFactory.class.getName());
private static final String URL = "193.61.190.42";
81
private static final String USERNAME = "admin";private static final String PASSWORD = "admin";private static final int PORT = 8550;
private static EkahauPosEngineConnectionFactory instance;private EConnection eConnection;
private EkahauPosEngineConnectionFactory() {setupConnection();
}
/** * Sets up a connection to the Ekahau positioning engine * * TODO Remove the constant variables e.g. URL, PORT etc * and put into a config file. */private void setupConnection() {
//remove the URL and PORT out into a config filelogger.info("Connecting - " + URL + ":" + PORT);eConnection = new EConnection(URL, PORT);eConnection.setUserCredentials(USERNAME, PASSWORD);if(eConnection != null)logger.info("Connected to Ekahau
Positioning Engine");}
/** * intialisation class, based on the singleton design pattern * only allows one instance of the class to be created in the * JVM. * * @return EkahauConnection */public static EkahauPosEngineConnectionFactory getInstance() {
if(instance == null) {instance = new EkahauPosEngineConnectionFactory();
}return instance;
}
/** * Returns the Ekahua Positioning Engine connection instance * @return */public EConnection getEConnection() {
if(eConnection == null) {setupConnection();return eConnection;
}return eConnection;
82
}}
DBConnectionFactory.classpackage com.mcmenamin.ekahau.db;
import java.sql.Connection;import java.sql.DriverManager;
public class DBConnectionFactory {
private static final String URL = "jdbc:mysql://localhost/ekahau";private static final String DRIVER_NAME = "com.mysql.jdbc.Driver";
private static Connection conn;
private static DBConnectionFactory instance;
private DBConnectionFactory() {createConnection();
}
public static DBConnectionFactory getInstance() {if(instance == null) {
instance = new DBConnectionFactory();}return instance;
}
public Connection getConnection() {return conn;
}private void createConnection() {
try {Class.forName(DRIVER_NAME);conn = DriverManager.getConnection(URL, "root",
"pass123");
} catch (Exception e) {e.printStackTrace();
}}
}
83
DBManager.classpackage com.mcmenamin.ekahau.db;
import java.sql.Connection;import java.sql.SQLException;import java.sql.Statement;import java.util.List;
import com.mcmenamin.ekahau.domain.EMessage;
public class DbManager {
private Connection connection;
public DbManager(Connection connection) {this.connection = connection;
}
public void resetDB() {//TODO
}
public void storeEkahauData(List<EMessage> list) {String sqlQuery = null;try {Statement stat = connection.createStatement();for(EMessage msg : list) {sqlQuery = "INSERT INTO log (tagid, posX, posY, posModelId,
posMapId, posZoneId, posQuality," +" posCounter, battery, posReason, macAddress, posMapName, posTimeStamp, posTime) " +
" VALUES (" + msg.getTagId() + ", "+ msg.getPosX() +", "+ msg.getPosY() +"" +", "+ msg.getPosModelId() +", "+ msg.getPosMapId() +", "+ msg.getPosZoneId() +"," +""+ msg.getPosQuality() +", "+msg.getPosCounter() +", "+ msg.getBattery() +"," +" "+ msg.getPosReason() +", '" + msg.getMacAddress() + "', '" + msg.getPosMapName() +"'," +" '"+ msg.getPosTimeStamp() + "', " + msg.getPosTime() +")";
System.out.println(sqlQuery);stat.execute(sqlQuery);
}
} catch (SQLException e) {e.printStackTrace();
}}
Emessage.class
84
package com.mcmenamin.ekahau.domain;
/** * Domain class used to store all the data from the * returned <code>EMsg</code> object from the Ekahau * Engine. * @ * @version initial version 1.0 */public class EMessage {
private long posTime;private long tagId;
private int posX;private int posY;private int posModelId;private int posMapId;private int posZoneId;private int posQuality;private int posCounter;private int battery;private int posReason;
private String macAddress;private String posTimeStamp;private String posMapName;
/** * Default Contructor */public EMessage() {
}
/** * Contructor * * @param tagId * @param macAddress * @param posX * @param posY * @param posModelId * @param posMapId * @param posZoneId * @param posMapName * @param posQuality * @param posReason * @param posTime * @param posTimeStamp * @param posCounter
85
* @param battery */public EMessage(long tagId, String macAddress, int posX, int posY,
int posModelId,int posMapId, int posZoneId, String
posMapName, int posQuality,int posReason, long posTime, String
posTimeStamp, int posCounter, int battery) {
this.tagId = tagId;this.macAddress = macAddress;this.posX = posX;this.posY = posY;this.posModelId = posModelId;this.posMapId = posMapId;this.posZoneId = posZoneId;this.posMapName = posMapName;this.posQuality = posQuality;this.posReason = posReason;this.posTime = posTime;this.posTimeStamp = posTimeStamp;this.posCounter = posCounter;this.battery = battery;
}
/** * Returns Tag Id * @return long tagid */public long getTagId() {
return tagId;}
/** * Sets the Tag Id variable * @param l long */public void setTagId(long l) {
this.tagId = l;}
/** * Returns position X of a Tag * @return int posX */public int getPosX() {
return posX;}
/** * Sets the position X variable * @param posX int
86
*/public void setPosX(int posX) {
this.posX = posX;}
/** * Returns the Position Y of a Tag * @return posY int */public int getPosY() {
return posY;}
/** * Sets the Posistion Y * @param poxY */public void setPoxY(int posY) {
this.posY = posY;}
/** * Returns the Position Model Id * @return int posModelId */public int getPosModelId() {
return posModelId;}
/** * Sets the Position Model Id * @param posModelId int */public void setPosModelId(int posModelId) {
this.posModelId = posModelId;}
/** * Returns the Position Map Id * @return int posMapId */public int getPosMapId() {
return posMapId;}
/** * Sets the Position Map Id * @param posMapId int */public void setPosMapId(int posMapId) {
this.posMapId = posMapId;}
87
/** * Returns the Position Zone Id * @return int posZoneId */public int getPosZoneId() {
return posZoneId;}/** * * @param posZoneId */public void setPosZoneId(int posZoneId) {
this.posZoneId = posZoneId;}
public int getPosQuality() {return posQuality;
}
public void setPosQuality(int posQuality) {this.posQuality = posQuality;
}
public long getPosTime() {return posTime;
}public void setPosTime(long posTime) {
this.posTime = posTime;}
public int getPosCounter() {return posCounter;
}
public void setPosCounter(int posCounter) {this.posCounter = posCounter;
}
public int getBattery() {return battery;
}
public void setBattery(int battery) {this.battery = battery;
}
public String getMacAddress() {return macAddress;
}
88
public void setMacAddress(String macAddress) {this.macAddress = macAddress;
}
public String getPosTimeStamp() {return posTimeStamp;
}
public void setPosTimeStamp(String posTimeStamp) {this.posTimeStamp = posTimeStamp;
}
public String getPosMapName() {return posMapName;
}
public void setPosMapName(String posMapName) {this.posMapName = posMapName;
}
public int getPosReason() {return posReason;
}
public void setPosReason(int posReason) {this.posReason = posReason;
}
TagTaskQuery.class
package com.mcmenamin.ekahau.scheduler;
import java.util.Arrays;import java.util.List;import java.util.TimerTask;
import com.ekahau.common.sdk.EMsg;import com.mcmenamin.ekahau.EkahauPosManager;
public class TagTaskQuery extends TimerTask {
private EkahauPosManager manager;private List<EMsg> eMsgList;
public TagTaskQuery(EkahauPosManager manager) {this.manager = manager;
}
@Overridepublic void run() {
eMsgList = Arrays.asList(manager.getAllGoodPositions());}
89
public List<EMsg> getEMsgsList() {return eMsgList;
}}
APPENDIX C – WEB SITE CODE
Index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Ekahau Project - Device Search</title>
<script type="text/javascript" src="js/prototype.js"></script><script type="text/javascript" src="js/scriptaculous.js?load=effects"></script><script type="text/javascript" src="js/lightbox.js"></script><link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /><link rel="stylesheet" href="default.css" type="text/css" media="screen" />
</head>
<body>
<div>
<p> </p>
<div class="dialog">
90
<div class="hd"><div class="c"></div></div> <div class="bd"> <div class="c"> <div class="s">
<!-- content area -->
<h1>Ekahau Project Web-App</h1> <p>Welcome to the Web application for Ekahau.</p> <h1> </h1> <h1> </h1> <p>Enter Mac Address of device:</p> <form name="form" action="index.php" method="get"> <input type="text" name="q" /> <input type="submit" name="Submit" value="Search" /> </form>
<?php
// Get the search variable from URL $var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable//number of rows to return$limit=10;
// check for an empty string and display a message.if ($trimmed == "") { echo "<p>Please enter a search...</p>"; exit; }
// check for a search parameterif (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; }
//connect to your database mysql_connect("localhost","root","pass123");
//specify database mysql_select_db("ekahau") or die("Unable to select database"); //select which database we're using
// Build SQL Query $query = ("select macAddress, tagid,posZoneId, posMapName, MAX(posTimeStamp) AS timeStamp,posTimeStamp, posQuality from log
where macAddress like\"%$trimmed%\"order by macAddress");
$numresults=mysql_query($query); $numrows=mysql_num_rows($numresults);
// If we have no results
if ($numrows == 0)
91
{ echo "<h4>Results</h4>"; echo "<p>Sorry, your search: "" . $trimmed . "" returned zero results</p>";}
// next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; }
// get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched forecho "<p>You searched for: "" . $var . ""</p><br>";
// begin to show results set
$count = 1 + $s ;
// now you can display the results returned while ($row= mysql_fetch_array($result)) { $tagid = $row["tagid"] ; $mac = $row["macAddress"]; $postimestamp = $row["timeStamp"]; $posy = $row["posY"]; $posZoneId =$row["posZoneId"]; echo "<span class='style1' align='center'>Tag ID: </span> $tagid<br>"; echo "<span class='style1'>Mac address: </span>$mac<br>"; echo "<span class='style1'>Last Know location: </span><a href=images/$posZoneId.jpg rel='lightbox'>Zone $posZoneId</a><br> " ; echo "<span class='style1'>Time Stamp: </span>$postimestamp<br><br>"; echo "<a href=historylink.php?test=$mac>Click here for device $macAddress History</a></span><br> " ; echo "<br><br>"; $count++ ; }
$currPage = (($s/$limit) + 1);
//break before paging echo "<br />";
?> <!-- content area --> <p><a href="index.php">go back</a></p> </div> </div> </div> <div class="ft"><div class="c"></div></div></div>
<p> </p>
</div>
92
</body></html>
Historylink.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><title>Ekahau Project - Device History</title><link href="default.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="js/prototype.js"></script><script type="text/javascript" src="js/scriptaculous.js?load=effects"></script><script type="text/javascript" src="js/lightbox.js"></script><script type="text/javascript" src="wz_jsgraphics.js"></script><script type="text/javascript" src="pie.js"></script><link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /><link rel="stylesheet" href="default.css" type="text/css" media="screen" />
</head>
<body>
<div>
<p> </p>
<div class="dialog"> <div class="hd"><div class="c"></div></div> <div class="bd"> <div class="c"> <div class="s">
<!-- content area -->
<h1>Ekahau Device History</h1>
<p> <label></label>
<?php$db="ekahau";$link = mysql_connect("localhost","root","pass123");if (! $link)die("Couldn't connect to MySQL");mysql_select_db($db , $link)or die("Couldn't open $db: ".mysql_error());
$var = @$_GET['test'] ;
$result = mysql_query ("SELECT posZoneId, COUNT(*) As Total FROM loghistory WHERE macAddress like \"%$var%\"
GROUP BY posZoneId ORDER BY Total DESC")
or die("SELECT Error: ".mysql_error());$num_rows = mysql_num_rows($result);
93
print "There are <span class='style1'>$num_rows</span> records for Mac Address: <span class='style1'>$var</span><br><br>";print "Below is a Zone history for the device<br><br>";print "<table width=120 border=0>\n";
$count = 1 + $s ;
// now you can display the results returned while ($row= mysql_fetch_array($result)) { $mac = $row["macAddress"]; $total = $row["Total"]; $posZoneId =$row["posZoneId"];
echo "Entered <a href=images/$posZoneId.jpg rel='lightbox'>Zone $posZoneId</a> :" ; echo " $total times <br>"; $count++ ; }
?>
<!-- content area --> <!-- <a href="piechart.php">piechart</a> !--> <!-- <p><img src="piechart.php?data=10*9*11*10&label=Denmark*Germany*USA*Sweden" /> !--> <!-- graph code begins here--> <p><a href="index.php">go back</a></p> </div> </div> </div>
</div>
<p> </p>
</div>
</body></html>
Default.css
@charset "utf-8";/* CSS Document */a {
padding-left: 0px;text-decoration: none;
94
color:#79FF79;font-size:16px;font-family:Calibri;
}
a:hover{color:#00FF00;
}body { font:normal 76% georgia,helvetica,verdana,tahoma,arial,"sans serif";}
.dialog {width:45%;margin:0px auto;min-width:20em;color:#FFFFFF;
}
.dialog .hd .c,
.dialog .ft .c { font-size:1px; /* ensure minimum height */ height:13px;}
.dialog .ft .c { height:14px;}
.dialog .hd { background:transparent url(tl.gif) no-repeat 0px 0px;}
.dialog .hd .c { background:transparent url(tr.gif) no-repeat right 0px;}
.dialog .bd { background:transparent url(ml.gif) repeat-y 0px 0px;}
.dialog .bd .c { background:transparent url(mr.gif) repeat-y right 0px;}
.dialog .bd .c .s { margin:0px 8px 0px 4px; background:#000 url(ms.jpg) repeat-x 0px 0px; padding:1em;}
95
.dialog .ft { background:transparent url(bl.gif) no-repeat 0px 0px;}
.dialog .ft .c { background:transparent url(br.gif) no-repeat right 0px;}
/* content-specific */
.dialog h1 { /* header */ font-size:2em; margin:0px; padding:0px; margin-top:-0.6em;}
.dialog p {margin:0.5em 0px 0px 0px;padding:0px;font:1.5em/1.5em arial,tahoma,"sans serif";
}
html>body .dialog pre { font-size:1.1em;}
.style1 {color:#FF4F4F;font-size: 14px;font-weight:bold;
}
.style2 {color:#00FF00;font-size: 14px;font-weight:bold;
}.style1 {color:#00FF00;font-size: 14px;font-weight:bold;
}.style1 a:link{
color:#FFFFFF;font-size:12px;
}.style a:hover{
color:#00FF00;
96