enum ErrorCodes
enum ErrorCodes;
Elenco delle condizioni di errore del modulo WiFi :
typedef enum
{
	ERROR_NONE				= 0,
	
	// Parameters errors
	ERROR_WRONG_PARAM_NUM,
	ERROR_INVALID_PARAM,
	
	// Function still not implemented
	ERROR_NOT_IMPLEMENTED,
	
	// Timeout errors
	ERROR_TIMEOUT,
	
	// WIFI station errors
	ERROR_WIFI_SCAN,
	ERROR_WIFI_BAD_MODE,
	ERROR_WIFI_NO_AP_FOUND,
	ERROR_WIFI_WRONG_PASSWORD,
	ERROR_WIFI_BAD_SSID,
	ERROR_WIFI_BAD_CHANNEL,
	ERROR_WIFI_BAD_HIDDEN_FLAG,
	ERROR_WIFI_CONNECTION_FAILED,
	ERROR_WIFI_TIMEOUT,
	
	// AP errors
	ERROR_AP_CONFIG_FAILED,
	ERROR_AP_CONFIG_BAD_MODE,
	ERROR_AP_CONFIG_BAD_DATA,
	
	// STATION errors
	ERROR_STATION_CONFIG_FAILED,
	ERROR_STATION_CONFIG_BAD_MODE,
	ERROR_STATION_CONFIG_BAD_DATA,

	// Socket errors
	ERROR_SOCKET_INVALID,
	ERROR_SOCKET_CLOSED,
	ERROR_SOCKET_OPENED,
	ERROR_NO_SOCKETS_AVAILABLE,
	
	// DHCP errors
	ERROR_DHCP,
	
	// MAC errors
	ERROR_MAC,
	
	// IP errors
	ERROR_IP,
	
	// PHY mode errors
	ERROR_BAD_PHY_MODE,
	
	// Server errors
	ERROR_SERVER_ALREADY,
	ERROR_SERVER_BAD_DATA,
	ERROR_SERVER_OFF,
	ERROR_SERVER_TIMEOUT,
	
	// Connection errors
	ERROR_CONNECTION_BAD_DATA,
	ERROR_CONNECTION_BAD_SOCKET,
	ERROR_CONNECTION_DNSFAIL,
	ERROR_CONNECTION_BAD_TYPE,
	ERROR_CONNECTION_TIMEOUT,
	ERROR_CONNECTION_GENERIC,
	
	// Disconnection errors
	ERROR_DISCONNECTION_BAD_DATA,
	ERROR_DISCONNECTION_BAD_SOCKET,
	ERROR_DISCONNECTION_TIMEOUT,
	ERROR_DISCONNECTION_GENERIC,
	
	// Send error
	ERROR_SEND_BAD_DATA,
	ERROR_SEND_BAD_SOCKET,
	ERROR_SEND_TIMEOUT,
	ERROR_SEND_TOO_BIG,
	ERROR_SEND_GENERIC,
	
	// Receive error
	ERROR_RECEIVE_BAD_DATA,
	ERROR_RECEIVE_BAD_SOCKET,
	ERROR_RECEIVE_TIMEOUT,
	ERROR_RECEIVE_OUT_OF_MEMORY,
	ERROR_RECEIVE_GENERIC,
	ERROR_RECEIVE_NO_DATA,
	
	// UART errors
	ERROR_UART_BAD_SPEED,
	ERROR_UART_BAD_PARITY,
	ERROR_UART_BAD_BITS,
	ERROR_UART_BAD_STOP_BITS,
	
	// PORTS ERROR
	ERROR_PORT_INVALID,
	ERROR_PORTMODE_INVALID,
	
	// UDP ERRORS
	ERROR_UDP_CONNECTION_BAD_DATA,
	ERROR_UDP_CONNECTION_BAD_SOCKET,
	ERROR_UDP_CONNECTION_DNSFAIL,
	ERROR_UDP_CONNECTION_GENERIC,
	
	ERROR_UDP_RECEIVE_BAD_DATA,
	ERROR_UDP_RECEIVE_BAD_SOCKET,
	ERROR_UDP_RECEIVE_TIMEOUT,
	ERROR_UDP_RECEIVE_OUT_OF_MEMORY,
	ERROR_UDP_RECEIVE_GENERIC,
	ERROR_UDP_RECEIVE_NO_PACKET_PARSED,
	ERROR_UDP_RECEIVE_NO_DATA,

	ERROR_UDP_SEND_BAD_DATA,
	ERROR_UDP_SEND_BAD_SOCKET,
	ERROR_UDP_SEND_TIMEOUT,
	ERROR_UDP_SEND_TOO_BIG,
	ERROR_UDP_SEND_GENERIC,
	ERROR_UDP_SEND_NO_DATA,
	
	ERROR_UNKNOWN,
	ERROR_MAX
} ErrorCodes;

Note :


Esempio :

uint16_t errCode = Fishino.getLastError();
Serial.print("Codice ultimo errore rilevato : ");
Serial.println(errCode);
Serial.print("Messaggio corrispondente : ");
const char *msg = Fishino.getErrorString(errCode);
Serial.println(msg);
free(msg);

L’esempio stampa il codice ed il testo corrispondenti all’ultimo errore rilevato.


Vedi anche :
uint16_t FishinoClass::getLastError(void);
char *FishinoClass::getLastErrorString(void);
const char *FishinoClass::getErrorString(uint16_t errCode);
void FishinoClass::clearLastError(void);