WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
Classes | Macros | Functions
udp_handler.h File Reference
#include <string.h>
#include <sys/param.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"
#include "esp_system.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_netif.h"
#include "protocol_examples_common.h"
#include "lwip/err.h"
#include "lwip/sockets.h"
#include "lwip/sys.h"
#include <lwip/netdb.h>
Include dependency graph for udp_handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  network_data
 

Macros

#define HOST_IP_ADDR   CONFIG_SERVER_IP_ADDRESS
 
#define PORT   CONFIG_SERVER_PORT
 

Functions

void network_manager (struct network_data *nm)
 Manages UDP connection to the server. More...
 
int send_data (struct network_data *nm, char *payload)
 Sends data to the server through a UDP socket. More...
 
char * receive_data (struct network_data *nm)
 Receives data from UDP server. More...
 
void close_network_manager (struct network_data *nm)
 Shutdown active connection, deallocate memory. More...
 

Macro Definition Documentation

◆ HOST_IP_ADDR

#define HOST_IP_ADDR   CONFIG_SERVER_IP_ADDRESS

◆ PORT

#define PORT   CONFIG_SERVER_PORT

Function Documentation

◆ close_network_manager()

void close_network_manager ( struct network_data nm)

Shutdown active connection, deallocate memory.

Parameters
nmtcp_network_data struct which contains connection info
Returns
void

◆ network_manager()

void network_manager ( struct network_data nm)

Manages UDP connection to the server.

Parameters
nmnetwork_data struct which contains necessary data for a UDP connection
Returns
void

◆ receive_data()

char* receive_data ( struct network_data nm)

Receives data from UDP server.

Parameters
nmnetwork_data struct which contains connection info
Returns
char array which contains data received

◆ send_data()

int send_data ( struct network_data nm,
char *  payload 
)

Sends data to the server through a UDP socket.

Parameters
nmA pointer to network_data struct
payloadchar array which contains data to be sent
Returns
int - returns -1 if sending failed, number of bytes sent if successfully sent the data