WiFi Logger component  1.0
WiFi Logger component, uses wifi to output logs
Classes | Macros | Functions
tcp_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 tcp_handler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tcp_network_data
 

Macros

#define TCP_HOST_IP_ADDR   CONFIG_SERVER_IP_ADDRESS
 
#define TCP_PORT   CONFIG_SERVER_PORT
 

Functions

void tcp_network_manager (struct tcp_network_data *nm)
 Manages TCP connection to the server. More...
 
int tcp_send_data (struct tcp_network_data *nm, char *payload)
 Sends data to the server through a TCP socket. More...
 
char * tcp_receive_data (struct tcp_network_data *nm)
 Receives data from TCP server. More...
 
void tcp_close_network_manager (struct tcp_network_data *nm)
 Shutdown active connection, deallocate memory. More...
 

Macro Definition Documentation

◆ TCP_HOST_IP_ADDR

#define TCP_HOST_IP_ADDR   CONFIG_SERVER_IP_ADDRESS

◆ TCP_PORT

#define TCP_PORT   CONFIG_SERVER_PORT

Function Documentation

◆ tcp_close_network_manager()

void tcp_close_network_manager ( struct tcp_network_data nm)

Shutdown active connection, deallocate memory.

Parameters
nmtcp_network_data struct which contains connection info
Returns
void

◆ tcp_network_manager()

void tcp_network_manager ( struct tcp_network_data nm)

Manages TCP connection to the server.

Parameters
nmtcp_network_data struct which contains necessary data for a TCP connection
Returns
void

◆ tcp_receive_data()

char* tcp_receive_data ( struct tcp_network_data nm)

Receives data from TCP server.

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

◆ tcp_send_data()

int tcp_send_data ( struct tcp_network_data nm,
char *  payload 
)

Sends data to the server through a TCP socket.

Parameters
nmA pointer to tcp_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