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.
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.
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.
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/ -lpqTo 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,0or
./main.run -t 10 -q 30 -a 5,0In 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.
This screen displays a list of potholes detected within the user's proximity, allowing quick and organized access to critical road hazard information.
This project was made in collaboration with:
For any questions feel free to reach me anytime; my contacts are available in my homepage.


