diff --git a/src/h/base_DB.h b/src/h/base_DB.h index 83cd077..e3565e8 100644 --- a/src/h/base_DB.h +++ b/src/h/base_DB.h @@ -6,15 +6,49 @@ #include #include - +/*! + * \brief Establishes a connection to the database. + * \param user : The username for the databse. + * \param password : The password for the database. + * + * \return A pointer to the connection object. + */ PGconn* DB_connection(const char* user, const char* password); +/*! + * \brief Checks if a drone exists in the database. + * \param conn : The database connection. + * \param dic : The drone identifier code. + * + * \return True if the drone exists, false otherwise. + */ bool checkDic(PGconn* conn, const char* dic); +/*! + * \brief Inserts a new route into the database. + * \param conn : The database connection. + * \param dic : The drone identification code. + * \param auth_code : The authentication code for the drone. + * \param route : The route to insert. The route should be a string with the format: "[[x0,y0],[x1,y1],...]". + */ void insertRoute(PGconn* conn, const char* dic, const char* auth_code, const char* route); +/*! + * \brief Cheks if the authorization code for a drone is valid. + * \param dic : The drone identifier code. + * \param authCode : The authentication code to check. + * + * \return True if the authentication code is correct, false otherwise. + */ bool checkAuthCode(PGconn* conn, const char* dic, const char* authCode); +/*! + * \brief Checks for collisions on a given route. + * \param dic : The drone identifier code. + * \param route : The route to check for collisions. The route should be a string with the format: "[[x0,y0],[x1,y1],...]". + * + * \return The number of potential collisions on the route + */ int checkColissions(PGconn* conn, const char* dic, const char* route); #endif \ No newline at end of file