A Driver is a service provider in the LYNX platform who is paired with a registered vehicle. Drivers authenticate with their DNI and password, then access a dedicated menu to register trips, view their completed-trip history, manage availability, and monitor earnings. Driver records are stored in memory and persisted toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/yeremyacuna/LYNX/llms.txt
Use this file to discover all available pages before exploring further.
assets/drivers.txt between sessions.
Driver Profile
Every Driver record contains the following fields, sourced directly fromDriver.h:
| Field | Type | Description | Default |
|---|---|---|---|
driverId | string | Auto-generated identifier in the format DRV-XXXX (4 digits) | Generated on registration |
name | string | Full display name of the driver | — |
dni | string | 8-digit national identity number used as the login key | — |
password | string | Login credential | — |
rating | float | Driver rating, updated by passengers after each trip | 5.0 |
isAvailable | bool | Whether the driver can currently accept new trips | true |
totalTrips | int | Cumulative number of completed trips | 0 |
totalEarnings | float | Gross cumulative earnings across all completed trips | 0.0 |
vehicle | Vehicle | The vehicle associated with this driver | — |
Driver::syncNextDriverId(int nextId) re-synchronises the internal ID counter after loading persisted data, ensuring DRV-XXXX codes remain sequential across restarts.
Vehicle
Each Driver has exactly one associatedVehicle. The Vehicle class (defined in Vehicle.h) carries five fields:
| Field | Type | Description |
|---|---|---|
plate | string | Vehicle licence plate (e.g. EQH-692) |
brand | string | Manufacturer (e.g. BMW, Toyota) |
model | string | Model name (e.g. Serie 1, Corolla) |
color | string | Exterior colour |
year | int | Model year |
Vehicle class exposes two plate getters: getPlate() (non-const, for general access) and getPlates() (const, for read-only contexts such as sorted container keys and const method calls).
Driver Registration
Drivers register themselves directly from the driver entry menu, following the same self-service flow used by passengers. The system prompts for driver details and vehicle information before creating the account.Open the Driver entry screen
At the main menu, select “Soy conductor” and then choose “Registrarme”.
Enter driver details
Provide your full name, 8-digit DNI, and a password. The system validates the DNI length via
AuthManager::validateDni(DNI).Enter vehicle details
Supply the vehicle’s plate, brand, model, colour, and year. The year must be within the accepted range (2005–2026 in the console flow).
Driver Menu Actions
After logging in with their DNI and password, the following actions are available, as defined inMainMenu.h:
- Registrar Viaje Manual — the driver logs a completed trip by entering origin, destination, distance (km), and fare tier. The system creates a
Tripwith status"completado"and pushes it directly onto the history stack.Driver::acceptRide(price)incrementstotalTripsandtotalEarningsand setsisAvailable = false;Driver::finishRide()immediately setsisAvailable = true. - Ver Carreras Hechas — displays the driver’s trip history, filtered from the global history stack by the driver’s DNI.
- Cambiar a Disponible / Finalizar Viaje — if the driver has an active trip, this action calls
TripManager::finishTrip(tripId, authManager)and marks the driver available. If no active trip exists, availability is set totruedirectly viaAuthManager::setDriverAvailability(dni, true). - Ver mis Ganancias — shows gross earnings, platform commission (20 %), and net earnings. The net value is computed by the lambda inside
Driver::getNetEarnings():
- Perfil — displays the driver’s full summary including vehicle details.
- Cerrar sesion — ends the driver session and returns to the main menu.
Rating System
A driver’s rating starts at5.0 and is updated each time a passenger rates them. The update formula is a running weighted average implemented in Driver::updateRating(float nuevaCalif):
AuthManager::updateDriverRating(dni, newRating). Administrators can sort all drivers by rating using AuthManager::sortDriversByRating() (ShellSort, descending).