A lot of changes

This commit is contained in:
Łukasz Moskała 2023-01-30 22:17:19 +01:00
parent 17c294881f
commit f2248c03eb

View file

@ -1,16 +1,16 @@
#include <string.h> #include <string.h>
#include <FreeRTOS.h> #include "FreeRTOS.h"
//#include "freertos/task.h" //#include "freertos/task.h"
//#include "freertos/event_groups.h" //#include "freertos/event_groups.h"
#include <tcpip_adapter.h> #include "tcpip_adapter.h"
#include <netif/ppp/pppos.h> #include "netif/ppp/pppos.h"
#include <lwip/err.h> #include "lwip/err.h"
#include <lwip/sockets.h> #include "lwip/sockets.h"
#include <lwip/sys.h> #include "lwip/sys.h"
#include <lwip/netdb.h> #include "lwip/netdb.h"
#include <lwip/dns.h> #include "lwip/dns.h"
#include <netif/ppp/pppapi.h> #include "netif/ppp/pppapi.h"
#include "PPPOS.h" #include "PPPOS.h"
@ -45,85 +45,85 @@ static void ppp_status_cb(ppp_pcb *pcb, int err_code, void *ctx)
switch (err_code) { switch (err_code) {
case PPPERR_NONE: { case PPPERR_NONE: {
ESP_LOGE(TAG, "status_cb: Connected\n"); //ESP_LOGE(TAG, "status_cb: Connected\n");
#if PPP_IPV4_SUPPORT #if PPP_IPV4_SUPPORT
ESP_LOGE(TAG, " ipaddr_v4 = %s\n", ipaddr_ntoa(&pppif->ip_addr)); //ESP_LOGE(TAG, " ipaddr_v4 = %s\n", ipaddr_ntoa(&pppif->ip_addr));
ESP_LOGE(TAG, " gateway = %s\n", ipaddr_ntoa(&pppif->gw)); //ESP_LOGE(TAG, " gateway = %s\n", ipaddr_ntoa(&pppif->gw));
ESP_LOGE(TAG, " netmask = %s\n", ipaddr_ntoa(&pppif->netmask)); //ESP_LOGE(TAG, " netmask = %s\n", ipaddr_ntoa(&pppif->netmask));
#endif /* PPP_IPV4_SUPPORT */ #endif /* PPP_IPV4_SUPPORT */
#if PPP_IPV6_SUPPORT #if PPP_IPV6_SUPPORT
ESP_LOGE(TAG, " ipaddr_v6 = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0))); //ESP_LOGE(TAG, " ipaddr_v6 = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
#endif /* PPP_IPV6_SUPPORT */ #endif /* PPP_IPV6_SUPPORT */
PPPOS_connected = true; PPPOS_connected = true;
break; break;
} }
case PPPERR_PARAM: { case PPPERR_PARAM: {
ESP_LOGE(TAG, "status_cb: Invalid parameter\n"); //ESP_LOGE(TAG, "status_cb: Invalid parameter\n");
break; break;
} }
case PPPERR_OPEN: { case PPPERR_OPEN: {
ESP_LOGE(TAG, "status_cb: Unable to open PPP session\n"); //ESP_LOGE(TAG, "status_cb: Unable to open PPP session\n");
break; break;
} }
case PPPERR_DEVICE: { case PPPERR_DEVICE: {
ESP_LOGE(TAG, "status_cb: Invalid I/O device for PPP\n"); //ESP_LOGE(TAG, "status_cb: Invalid I/O device for PPP\n");
break; break;
} }
case PPPERR_ALLOC: { case PPPERR_ALLOC: {
ESP_LOGE(TAG, "status_cb: Unable to allocate resources\n"); //ESP_LOGE(TAG, "status_cb: Unable to allocate resources\n");
break; break;
} }
case PPPERR_USER: { case PPPERR_USER: {
ESP_LOGE(TAG, "status_cb: User interrupt\n"); //ESP_LOGE(TAG, "status_cb: User interrupt\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_CONNECT: { case PPPERR_CONNECT: {
ESP_LOGE(TAG, "status_cb: Connection lost\n"); //ESP_LOGE(TAG, "status_cb: Connection lost\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_AUTHFAIL: { case PPPERR_AUTHFAIL: {
ESP_LOGE(TAG, "status_cb: Failed authentication challenge\n"); //ESP_LOGE(TAG, "status_cb: Failed authentication challenge\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_PROTOCOL: { case PPPERR_PROTOCOL: {
ESP_LOGE(TAG, "status_cb: Failed to meet protocol\n"); //ESP_LOGE(TAG, "status_cb: Failed to meet protocol\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_PEERDEAD: { case PPPERR_PEERDEAD: {
ESP_LOGE(TAG, "status_cb: Connection timeout\n"); //ESP_LOGE(TAG, "status_cb: Connection timeout\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_IDLETIMEOUT: { case PPPERR_IDLETIMEOUT: {
ESP_LOGE(TAG, "status_cb: Idle Timeout\n"); //ESP_LOGE(TAG, "status_cb: Idle Timeout\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_CONNECTTIME: { case PPPERR_CONNECTTIME: {
ESP_LOGE(TAG, "status_cb: Max connect time reached\n"); //ESP_LOGE(TAG, "status_cb: Max connect time reached\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
case PPPERR_LOOPBACK: { case PPPERR_LOOPBACK: {
ESP_LOGE(TAG, "status_cb: Loopback detected\n"); //ESP_LOGE(TAG, "status_cb: Loopback detected\n");
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;
} }
default: { default: {
ESP_LOGE(TAG, "status_cb: Unknown error code %d\n", err_code); //ESP_LOGE(TAG, "status_cb: Unknown error code %d\n", err_code);
PPPOS_started = false; PPPOS_started = false;
PPPOS_connected = false; PPPOS_connected = false;
break; break;