# CrowdPower: A Novel Crowdsensing-as-a-Service Platform for Real-Time Incident Reporting
## 3 System Architecture and Design
### Benchmarking Sensors  
CrowdPower's mobile application allows the interaction with a variety of sensors using different data collection frequencies (i.e., sense once, time-based repeated collection, \begin{table}
\begin{tabular}{c c c} \hline \hline
**Resources** & **RESTful URIs** & **Action: Description** \\ \hline  & /users/login & POST: Login to the application \\  & /users/luserID/logout & POST: Logout of the application \\  & /users & POST: Register new account \\ User & /users/luserID/sync & POST: Sync device data with backend \\ Management & /users/luserID & GET: Get User Details \\  & /users/luserID\(|\)/status & PUT: Update User’s Status \\  & /users/luserID\(|\) & PATCH: Update the User’s Details \\  & /users/luserID\(|\) & DELETE: Deactivate the user’s account \\ \hline  & /users/communities & GET: Get all communities, regardless if the User has selected \\ Community & /users/luserID\(|\)/communities & GET: Get all communities selected by User \\ Management & /users/communities/[commitID]/services & GET: Get all Services that belong to a particular Community \\  & /users/services/lserviceID\(|\)/sensors & GET: Get all Sensors that are assigned for a service \\ \hline  & POST-/users/luserID\(|\)/incidents & POST: Create a new incident request (consumer) \\ Incident & users/luserID\(|\)/incidents/consumer/[incID]?decision=(cancel) & PUT: Update the consumer’s status \\ Management & users/luserID\(|\)/incidents/[incID]/consumer/report & GET: Get Incident report \\  & users/luserID\(|\)/incidents/[producer/[incID]?decision=(accept/cancel)] & PUT: Update the producer’s status \\  & users/luserID\(|\)/incidents/[incID]/producer/data/file & POST: Upload Incident Data \\  & users/luserID\(|\)/incidents/[incID]/producer/data/sensor & POST: Upload Incident Sensor Data \\ \hline  & /users/luserID\(|\)/voluntary & POST: Create a new voluntary request \\  & /users/luserID\(|\)/voluntary/[volID]/data/file & POST: Upload voluntary data (Images/Videos) \\ Publication & /users/luserID\(|\)/voluntary/[volID]/data/sensor & POST: Upload Voluntary Sensor Data \\  & /POST-/users/luserID\(|\)/voluntary/[volID] & DELETE: Cancel the Voluntary request \\ \hline \hline \end{tabular}
\end{table} 
Table 3: CrowdPower’s RESTful Web Service Interfaces. Figure 7: Collaboration diagram: participant selection and service request. and event-based collection). Furthermore, the quality of different phones' sensors is benchmarked to the same types of sensors in other phones to ensure accurate scoring of sensors' quality level and a more reliable participants recruitment. This section will detail how the sensory data are collected using the CrowdPower mobile app and discuss our sensor-quality-benchmarking approach. A list of all the sensors supported by CrowdPower and their type and description are given in Table 4. Sensors that are currently supported by the CrowdPower mobile app can be roughly divided into the following categories:  
* Environmental Sensors: These allow the user to monitor the state of the surrounding environment and its properties. * Motion Sensors: These sensors allow the user to monitor the motion of the mobile device itself, such as tilt, shake, rotation, or swing. * Positional Sensors: These sensors allow the user to determine the position of the mobile device. Android OS provides a Sensor API that provides access to the underlying hardware sensors of the mobile device. The application must register to a sensor to collect data to get events. Each sensor event contains the following information:
* Accuracy: How accurate the values are;
* Sensor Name: The sensor that generated the event;
* Data: The actual Sensor data. This is a string array of variable length. The number of values and the context of each value depends on the sensor type that is being collected. The CrowdPower mobile app registers to the required sensor for one second and stores all the events sent by the OS during that time. The exact number of events accumulated in a one-second duration depends on the sensor type.