WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
udp_handler.h
Go to the documentation of this file.
1 #ifndef UDP_HANDLER_H
2 #define UDP_HANDLER_H
3 
4 #include <string.h>
5 #include <sys/param.h>
6 #include "freertos/FreeRTOS.h"
7 #include "freertos/task.h"
8 #include "freertos/event_groups.h"
9 #include "esp_system.h"
10 #include "esp_wifi.h"
11 #include "esp_event.h"
12 #include "esp_log.h"
13 #include "nvs_flash.h"
14 #include "esp_netif.h"
15 #include "protocol_examples_common.h"
16 #include "lwip/err.h"
17 #include "lwip/sockets.h"
18 #include "lwip/sys.h"
19 #include <lwip/netdb.h>
20 
21 #define HOST_IP_ADDR CONFIG_SERVER_IP_ADDRESS
22 #define PORT CONFIG_SERVER_PORT
23 
25 {
26  char rx_buffer[128];
27  char addr_str[128];
30  struct sockaddr_in dest_addr;
31  int sock;
32 };
33 
34 void network_manager(struct network_data* nm);
35 int send_data(struct network_data* nm, char* payload);
36 char* receive_data(struct network_data* nm);
37 void close_network_manager(struct network_data* nm);
38 
39 #endif
Definition: udp_handler.h:24
int send_data(struct network_data *nm, char *payload)
Sends data to the server through a UDP socket.
Definition: udp_handler.c:38
int ip_protocol
Definition: udp_handler.h:29
char * receive_data(struct network_data *nm)
Receives data from UDP server.
Definition: udp_handler.c:59
char rx_buffer[128]
Definition: udp_handler.h:26
char addr_str[128]
Definition: udp_handler.h:27
struct sockaddr_in dest_addr
Definition: udp_handler.h:30
void close_network_manager(struct network_data *nm)
Shutdown active connection, deallocate memory.
Definition: udp_handler.c:85
int addr_family
Definition: udp_handler.h:28
void network_manager(struct network_data *nm)
Manages UDP connection to the server.
Definition: udp_handler.c:11
int sock
Definition: udp_handler.h:31