\section{Data Collection}

This section describes the data collection application and the methods used to collect data. 

% motivation for why making my own database, could be in the introduction

\subsection{Logging Mechanism}

%start with this! 
%As I mentioned, start with the general requirements.
%- there are tools that exist. some of them are open source and can be modified
%- we save time
%- we did a fork which is also available.
%next section explains the extension of the basic functionality.

The collected data is required to map to where it was collected and the logging application needs to allow collaboration and consider at least \gls{rss} in \gls{3g}. Android is the considered mobile platform.

There are several different Android network logging applications, some of them are open source and can be modified. Since we do not want to make everything from scratch and none of the available logging applications conformed to our requirements, we were limited to use open source projects which we could modify. The logging application used in this thesis work is based on Network Monitor\footnote{\href{Hyperlink}{https://play.google.com/store/apps/details?id=ca.rmen.android.networkmonitor}} which is one of the many network monitor applications in the Google Play Store \cite{google_play_store}. 

% explain what network monitor does and how it works. 
% if you have some architectural image of it put it here.
% then mention what it lacks that you need.

% explain in short sentences focused on the main things you have to say (make a bullet list of the things you want to say).

%There exists several different Android network logging applications, OpenSignal\footnote{\href{Hyperlink}{http://opensignal.com/}}, Network Log\footnote{\href{Hyperlink}{https://play.google.com/store/apps/details?id=com.googlecode.networklog}} and many more. The logging application used in this thesis work is based on Network Monitor\footnote{\href{Hyperlink}{https://play.google.com/store/apps/details?id=ca.rmen.android.networkmonitor}} which is one of the many network monitor applications in the Google Play Store \cite{google_play_store}. Adapting the open source application for the purpose of this thesis was selected for being more time efficient.

% Motivation of choice
% 	Already logged most of the wanted characteristics
%	Provided accuracy of the GPS coordinates
%	Was Open Source which allowed for modification and verification data presented
%	

Network Monitor was chosen because none of the other logging applications was logging enough parameters, and since none of the existing applications exposed enough data to enable collecting to our database. Network Monitor is an open source project which means we can modify it to fit my needs and improve it where needed. We plan on having all the improvements we made to be available in the original project but the fork of the original project is open source and available \cite{myGitRepo}. 

\input{constructing_a_signal_map/graph/network_monitor_graph}

Network Monitor is an Android application which do network logging to a local database on the mobile device it is running on, see figure \ref{network_monitor_graph} for the basic tasks it performs. The logging is done in statically set intervals and the logged parameters depends on which that are enabled in the application.  It is capable of exporting the database through external services such as mail and WEBDav, though exporting is optional in the application. 

Only mail can be done automatic but most mail servers block mail sent by the built in mail client. In order to enable collaboration of multiple devices a method for automating export of the database is needed. 

The next section explains the extension of the basic functionality.


\subsection{Extending Network Monitor}

% How the application works
% - Ref to back-end appendix for setting up ftp,web server and heatmap

The created fork of Network Monitor \cite{myGitRepo}, network monitor was extended to allow sending the collected data to a server. In the current implementation automatic synchronization over File Transfer Protocol (\gls{ftp}) is available, though there exist options to use other protocols those currently lack implementation. The reason for using \gls{ftp} is that it is easy to implement both server-side and client-side, the backside is however that the data is sent unencrypted. There are ways to encrypt \gls{ftp} traffic but the data that I transfer is not sensitive nor identifying directly to any user. 

The other changes that has been made are already available in the original project. These changes regarded: 
\begin{itemize}
\item{Fixes to the download and upload tests so they can estimate speeds higher than 1.5 Mbps.}
\item{Introducing a separate interval for speed tests.
\begin{itemize}
\item{Allows the use of a higher sample rate of \gls{rss} while speed tests are enabled.}
\item{ Enable the \gls{ue} to only perform a new speed test when the network or \gls{rss} has changed by X amount dBm.}
\end{itemize} }

\end{itemize}
% fixes and additions to the speed tests for upload and download, for example the introduction of a separate interval for upload and download tests which allowed for a reduced set of time that speed tests were executed.
