Skip to content

An Android app using accelerometer and its server in C for Operating Systems Laboratory course @ UNINA.

Notifications You must be signed in to change notification settings

vincenzomarotta/PotHoles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚗​ PotHoles

🤔​ What is PotHoles?

PotHoles is a project assigned during Laboratory of Operating Systems course at Università di Napoli Federico II. PotHoles is a client-server system designed to manage pothole detection. This project is divided into a client (an Android app) and a server, written in C and running in a UNIX environment.

​📱​ Client

As mentioned before, the client is an android app written in Java (as specifically required).
The user can start a recording session where the app detects potholes using the smartphone’s accelerometer along the y-axis.
If the accelerometer exceeds a certain threshold, a new pothole is detected. The user can also check whether there are new events (potholes) within a specific range.

​💻​ Server

The server is written in C language and was hosted on Microsoft Azure (as specifically required).
A simple communication protocol called ECM (Enhanced Coordinate Messaging Protocol)Its structure is as follows:

HEADER -> PACKET_SIZE -> COMMAND -> OTHER_DATA_ACCORDING_TO_THE_COMMAND

The server is a multi-thred where instead of assign a new connection to a new thread, a thread pool has been developed; this choice was made to design something closer to real-world servers, rather than a purely academic solution. For data managment was used a simple databse in PostegreSQL.

For more detailed info you can check the documentation.

🚀​ Server Installation

The server needs to be used in a UNIX enviroment.
To compile it:

  gcc -Wall -Wextra -g -pthread -o main.run main.c ecmprotocol.c ecmdb.c threadpool.c -I/usr/include/postgresql/ -L/usr/lib/postgresql/14/lib/ -lpq

To start the program:

  ./main.run [argument] <option> ...

where the possible arguments are:

  • -t: thread number assigned to the pool (default is 4)
  • -q: queue length for the thread pool (default is 20)
  • -a: threshold value for the accelerometer (default is 10.0) An possible run could be:
  ./main.run -t 4 -q 20 -a 10,0

or

  ./main.run -t 10 -q 30 -a 5,0

🖼️ Screenshots

📍 Real-time Pothole Detection

In this screen, you can see a live recording session during which a new pothole has been detected.
A red marker appears on the map to indicate danger, making it visible to all users within a certain radius.

Screenshot - Pothole Detection


📋 List of Nearby Potholes

This screen displays a list of potholes detected within the user's proximity, allowing quick and organized access to critical road hazard information.

Screenshot - Pothole List

​🧑🏻‍💻​ Authors

This project was made in collaboration with:

📫​ Support

For any questions feel free to reach me anytime; my contacts are available in my homepage.

About

An Android app using accelerometer and its server in C for Operating Systems Laboratory course @ UNINA.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors