diff --git a/project/Core/Inc/UDP_broadcast.h b/project/Core/Inc/UDP_broadcast.h index 1aa339e..929004a 100644 --- a/project/Core/Inc/UDP_broadcast.h +++ b/project/Core/Inc/UDP_broadcast.h @@ -1,6 +1,7 @@ -/* - * UDP_broadcast.h +/** + * @file UDP_broadcast.h * + * @brief UDP broadcast handler * Created on: Nov 6, 2023 * Author: joran */ diff --git a/project/Core/Src/UDP_broadcast.c b/project/Core/Src/UDP_broadcast.c index 9d45b64..a0a056c 100644 --- a/project/Core/Src/UDP_broadcast.c +++ b/project/Core/Src/UDP_broadcast.c @@ -1,10 +1,11 @@ -/* - * UDP_broadcast.c +/** + * @file UDP_broadcast.c * + * @brief UDP broadcast handler * Created on: Nov 6, 2023 * Author: joran */ -//| + //| // Includes #include "UDP_broadcast.h" @@ -30,9 +31,9 @@ static void udp_receive_callback(void* arg, struct udp_pcb* connection, struct p * and logs a warning depending on that * * - * @param owner owner_details_t structure, it contains information about the owner - * @param word string parameter that was used in the function that triggered this handler - * @param funct name of the function where the error occured + * @param[in] owner owner_details_t structure, it contains information about the owner + * @param[in] word string parameter that was used in the function that triggered this handler + * @param[in] funct name of the function where the error occured */ static void udp_broadcast_owner_details_error_handler(const owner_details_t* owner, const char* funct, const char* word){ @@ -50,7 +51,7 @@ static void udp_broadcast_owner_details_error_handler(const owner_details_t* own * @brief set_owner_details_mac() gets the MAC address from the default netif * and sets it in the owner_details_t struct * - * @param owner owner_details_t structure, it contains information about the owner + * @param[out] owner owner_details_t structure, it contains information about the owner * @return setting owner mac address error * - 1: no error occured, mac address was set * - 0: an error occured, owner pointer is NULL @@ -73,8 +74,8 @@ static uint8_t udp_broadcast_set_owner_details_mac(owner_details_t* owner){ * if one of the pointers given is NULL it calls the error handler * strncpy is used to copy the function paremeter safely to the owner_details_t's name * - * @param owner owner_details_t structure, it contains information about the owner - * @param name string containing the owner's name + * @param[out] owner owner_details_t structure, it contains information about the owner + * @param[in] name string containing the owner's name * @return setting owner name error * - 1: no error occured, name was set * - 0: an error occured, name pointer is NULL or owner pointer is NULL @@ -96,8 +97,8 @@ static uint8_t udp_broadcast_set_owner_details_name(owner_details_t* owner, cons * if one of the pointers given is NULL it calls the error handler * strncpy is used to copy the function paremeter safely to the owner_details_t's surname * - * @param owner owner_details_t structure, it contains information about the owner - * @param surname string containing the owner's surname + * @param[out] owner owner_details_t structure, it contains information about the owner + * @param[in] surname string containing the owner's surname * @return setting owner surname error * - 1: no error occured, surname was set * - 0: an error occured, surname pointer is NULL or owner pointer is NULL @@ -119,7 +120,7 @@ static uint8_t udp_broadcast_set_owner_details_surname(owner_details_t* owner, c * strncpy is used to copy the function paremeter safely to a global variable * the reason this one is global is so that the udp_callback function can access it easily * - * @param reply string used to reply to the UDP broadcast + * @param[in] reply string used to reply to the UDP broadcast * @return setting owner reply error * - 1: no error occured, reply was set * - 0: an error occured, reply pointer is null or owner pointer is NULL @@ -142,7 +143,7 @@ static uint8_t udp_broadcast_set_owner_details_reply(const char* reply){ * it formats a string using the owner's details using snprintf * it sets this reply with @see udp_broadcast_set_owner_details_reply() * - * @param owner owner_details_t structure, it contains information about the owner + * @param[in] owner owner_details_t structure, it contains information about the owner * @return formatting reply error * - 1: no error occured, reply was formatted * - 0: an error occured, owner pointer is NULL @@ -177,9 +178,9 @@ static uint8_t udp_broadcast_format_reply(const owner_details_t* owner){ * if the pointer given is NULL it calls the error handler, * the other pointers get checked by the functions that are called in this function * - * @param owner owner_details_t structure, it contains information about the owner - * @param name string containing the new owner's name - * @param surname string containing the new owner's surname + * @param[out] owner owner_details_t structure, it contains information about the owner + * @param[in] name string containing the new owner's name + * @param[in] surname string containing the new owner's surname * @return setting owner details error * - 1: no error occured, details were set * - 0: an error occured, all or some details weren't set or owner pointer is NULL @@ -188,7 +189,8 @@ uint8_t udp_broadcast_set_owner_details(owner_details_t* owner, const char* name if (owner == NULL){ udp_broadcast_owner_details_error_handler(owner, SOD,""); return 0; - }else if (udp_broadcast_set_owner_details_name(owner, name) && udp_broadcast_set_owner_details_surname(owner, surname) && udp_broadcast_set_owner_details_mac(owner) && udp_broadcast_format_reply(owner)){ + }else if (udp_broadcast_set_owner_details_name(owner, name) && udp_broadcast_set_owner_details_surname(owner, surname) + && udp_broadcast_set_owner_details_mac(owner) && udp_broadcast_format_reply(owner)){ return 1; } return 0; @@ -199,7 +201,7 @@ uint8_t udp_broadcast_set_owner_details(owner_details_t* owner, const char* name * @fn char udp_broadcast_get_owner_details_name*(owner_details_t) * @brief get_owner_details_name() can be used to get the current owner's name * - * @param owner owner_details_t structure, it contains information about the owner + * @param[out] owner owner_details_t structure, it contains information about the owner * @return name of owner * this name is set by @see udp_broadcast_set_owner_details_name() */ @@ -216,7 +218,7 @@ char* udp_broadcast_get_owner_details_name(owner_details_t* owner){ * @fn char udp_broadcast_get_owner_details_surname*(const owner_details_t) * @brief get_owner_details_surname() can be used to get the current owner's surname * - * @param owner owner_details_t structure, it contains information about the owner + * @param[out] owner owner_details_t structure, it contains information about the owner * @return surname of owner * this name is set by @see udp_broadcast_set_owner_details_surname() */ @@ -248,11 +250,11 @@ char* udp_broadcast_get_owner_details_reply(){ * it compares the data to a set string @see UDP_QUESTION1, if it's the same it sends the reply string, * @see reply_str, back to the client * - * @param arg a pointer to some user-defined data or context - * @param connection UDP PCB to be bound with a local address ipaddr and port. - * @param p packet buffern it holds the incoming UDP packet data, including its payload and length - * @param addr ip_addr_t structure that contains the IP address of the sender of the UDP packet - * @param port the source port number of the sender's UDP packet + * @param[in] arg a pointer to some user-defined data or context + * @param[in] connection UDP PCB to be bound with a local address ipaddr and port. + * @param[in] p packet buffer it holds the incoming UDP packet data, including its payload and length + * @param[in] addr ip_addr_t structure that contains the IP address of the sender of the UDP packet + * @param[in] port the source port number of the sender's UDP packet */ static void udp_receive_callback(void* arg, struct udp_pcb* connection, struct pbuf* p, const ip_addr_t* addr, u16_t port){ diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index 8bec33e..ea729c6 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -28,6 +28,7 @@ #include "log.h" #include "llfs.h" #include "lcd_api.h" +#include "UDP_broadcast.h" /* USER CODE END Includes */