there can only be one
there's only one owner struct needed, thus adding a static one in the c file is better than having the main file to initialize one and pass it on again and again,. some code wasn't needed anymore and some had to change
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip.h"
|
||||
#define LOGGER_LEVEL_ALL
|
||||
#define LOGGER_LEVEL_INFO
|
||||
#include "log.h"
|
||||
#include "udp.h"
|
||||
|
||||
@@ -44,6 +44,7 @@ typedef struct {
|
||||
char name[20];
|
||||
char surname[20];
|
||||
uint8_t mac_address[6];
|
||||
char reply[100];
|
||||
}owner_details_t;
|
||||
|
||||
// The following functions are used for owner details (those that must be available in main)
|
||||
@@ -53,34 +54,31 @@ typedef struct {
|
||||
* @brief set_owner_details() is the interface that can be used in other files
|
||||
* to set the owner's details
|
||||
*
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
uint8_t udp_broadcast_set_owner_details(owner_details_t*, const char* , const char*);
|
||||
uint8_t udp_broadcast_set_owner_details(const char* , const char*);
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return name of owner
|
||||
* this name is set by @see udp_broadcast_set_owner_details_name()
|
||||
*/
|
||||
char* udp_broadcast_get_owner_details_name(owner_details_t*);
|
||||
char* udp_broadcast_get_owner_details_name();
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @return surname of owner
|
||||
* this name is set by @see udp_broadcast_set_owner_details_surname()
|
||||
*/
|
||||
char* udp_broadcast_get_owner_details_surname(owner_details_t*);
|
||||
char* udp_broadcast_get_owner_details_surname();
|
||||
|
||||
/**
|
||||
* @fn char udp_broadcast_get_owner_details_reply*()
|
||||
@@ -91,12 +89,9 @@ char* udp_broadcast_get_owner_details_surname(owner_details_t*);
|
||||
*/
|
||||
char* udp_broadcast_get_owner_details_reply();
|
||||
|
||||
// The following functions are used for UDP (those that must be available in main)
|
||||
|
||||
/**
|
||||
* @fn err_t udp_broadcast_init()
|
||||
* @brief init_UDP_server() initialises the UDP connection so that it listens for all traffic on
|
||||
* port 6400
|
||||
* @brief udp_broadcast_init() initializes the owner's variables and calls upon @see udp_broadcast_connection_init()
|
||||
*
|
||||
* @return lwIP error code.
|
||||
* - ERR_OK. Successful. No error occurred.
|
||||
@@ -105,4 +100,19 @@ char* udp_broadcast_get_owner_details_reply();
|
||||
|
||||
err_t udp_broadcast_init();
|
||||
|
||||
// The following functions are used for UDP (those that must be available in main)
|
||||
|
||||
/**
|
||||
* @fn err_t udp_broadcast_connection_init()
|
||||
* @brief udp_broadcast_connection_init() initializes the UDP connection so that it listens for all traffic on
|
||||
* port 6400
|
||||
* it is called by @see udp_broadcast_init() aswell but can be used separately if it failed before
|
||||
*
|
||||
* @return lwIP error code.
|
||||
* - ERR_OK. Successful. No error occurred.
|
||||
* - ERR_USE. The specified ipaddr and port are already bound to by another UDP PCB.
|
||||
*/
|
||||
|
||||
err_t udp_broadcast_connection_init();
|
||||
|
||||
#endif /* INC_UDP_BROADCAST_H_ */
|
||||
|
||||
Reference in New Issue
Block a user