4#include "decode_esp_packet.h" 
    5#include "proto-esp-usart.h" 
    7#define WIFIMODE_NORMAL 0 
    8#define WIFIMODE_FLASH 1 
    9#define ESPRETRYDELAY 180 
   11#define PIN_ESP8266_CHPD 1 
   12#define PIN_ESP8266_GPIO0 208 
   13#define PIN_ESP8266_GPIO4 200 
   15#define ESP8266_MCULIBHANDLE 2 
   21#define ESP_AP_NAME_SIZE (100 * 5) 
   31long esp8266_get_time_of_last_ip();
 
   37void esp8266_event_loop();
 
   45void wifi_send_data(
const PACKET_TYPE type, 
const byte *buf, 
const int len);
 
   47int enable_esp_listener();
 
   48int esp_get_needs_retry();
 
   54void esp_enable_flash_mode();
 
   55int print_wifi_ip_on_serial(
void);
 
   57int wifi_set_to_station_mode();
 
   59#define ESP8266_USART_PASSTHROUGH 1 
   60#define ESP8266_USART_SMART 2 
   61#define ESP8266_USART_PACKET_ONLY 3 
   62#define ESP8266_USART_AFTERRESET 4 
   63#define ESP8266_USART_IGNORE 5 
   65int get_esp8266_usart_mode();
 
   66void set_esp8266_debug(
byte b);
 
   70void set_esp8266_usart_mode(
int i);
 
   74int esp8266_is_irq_enabled();
 
   75void esp8266_enable_irq();
 
   76void esp8266_disable_irq();
 
   86void esp8266_reset_command_validity_ctrs();
 
   87long esp8266_get_valid_commands();
 
   88long esp8266_get_invalid_commands();
 
   89int esp8266_get_operational_baudrate();
 
   90void esp8266_set_operational_baudrate(
int baudrate);
 
   91void print_esp_core_info();
 
   92void esp8266_dodebug(
const char *paras);
 
   93const char *esp_get_last_ssid();
 
   94const char *esp_get_last_pw();
 
   95int write_char_to_console(
char b);
 
   97void esp8266_wififlash_usb_bridge();
 
   99int esp8266_get_firmware_version();
 
  100int esp8266_get_chip();  
 
  101int esp8266_get_firmware_repo();
 
  102uint64_t esp8266_get_firmware_base();
 
  106int get_esp_reboot_ctr();
 
  107void start_wifi_scan();
 
  108void esp8266_wifi_scan(
struct command *com);
 
  109void esp8266_send_config();
 
  110int esp8266_is_enabled();
 
  115int esp32_bt_set_characteristic_com(
struct command *com);
 
  116int esp32_bt_trigger_read_characteristic_com(
struct command *com);
 
  120int esp32_bt_peers(
struct command *com);
 
void esp8266_enable()
enable the esp8266 (switch it on)
 
void esp8266_wififlash_bridge(void)
set esp8266 to flash mode, sync and then bridge ("startflash")
 
char * esp8266_status_string()
returns a human readable status string of the wifi connection
 
void esp8266_read_byte_from_serialport(int val)
this is called directly from the usart IRQ. be quick. and do not use printf()
 
void wifi_send_data(const PACKET_TYPE type, const byte *buf, const int len)
send a command via wifi
 
void esp8266_ota()
tell the esp to do an OTA
 
void esp8266_reset()
reset state machine and esp8266
 
int esp8266_is_accespoint()
returns !=0 if we are currently an accesspoint
 
void cat_send_local_instruction(const PACKET_TYPE type, const uint8_t *buf, const int len)
send a packet to the esp8266 wifi chip
 
void esp8266_got_packet(const byte *buf, int size)
 
int esp_get_mac(char *buf, int bufsize)
get the esp8266 mac address.
 
void esp8266_disable()
disable the esp8266 (switch it off)
 
void esp_init()
call this ONCE before calling anything else
 
struct ipv4address * esp8266_get_current_ip()
return last ip (null if none)
 
void esp8266_add_ap(const char *ssid, const char *pw)
add an ap to the list of known ap
 
void esp8266_bridge()
bridge debug serialport and esp8266 (e.g. "wifidebug")
 
void esp8266_cloud_connection_failed()
called if the cloud connection failed
 
void esp8266_send_instructions()
send our nodeid and other goodies to the esp8266 chip