Adafruit Library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Wippersnapper_ESP32 Class Reference

Class for using the ESP32 network interface. More...

#include <Wippersnapper_ESP32.h>

Inheritance diagram for Wippersnapper_ESP32:
Wippersnapper

Public Member Functions

 Wippersnapper_ESP32 ()
 Initializes the Adafruit IO class for ESP32 devices.
 
 ~Wippersnapper_ESP32 ()
 Destructor for the Adafruit IO AirLift class.
 
void set_ssid_pass (const char *ssid, const char *ssidPassword)
 Sets the WiFi client's ssid and password. More...
 
void set_ssid_pass ()
 Sets the WiFi client's ssid and password.
 
bool check_valid_ssid ()
 Performs a scan of local WiFi networks. More...
 
void getMacAddr ()
 Sets the ESP32's unique client identifier. More...
 
int32_t getRSSI ()
 Gets the current network RSSI value. More...
 
void setupMQTTClient (const char *clientID)
 Initializes the MQTT client. More...
 
ws_status_t networkStatus ()
 Returns the network status of an ESP32 module. More...
 
const char * connectionType ()
 Returns the type of network connection used by Wippersnapper. More...
 
- Public Member Functions inherited from Wippersnapper
virtual ~Wippersnapper ()
 Wippersnapper destructor.
 
void provision ()
 Provisions a WipperSnapper device with its network configuration and Adafruit IO credentials.
 
virtual void set_user_key ()
 Configures the device's Adafruit IO credentials. This method should be used only if filesystem-backed provisioning is not avaliable.
 
void connect ()
 Connects to Adafruit IO+ Wippersnapper broker.
 
void disconnect ()
 Disconnects from Adafruit IO+ Wippersnapper.
 
ws_board_status_t getBoardStatus ()
 Returns the board definition status. More...
 
bool generateDeviceUID ()
 Attempts to generate unique device identifier. More...
 
bool generateWSTopics ()
 Generates device-specific Wippersnapper control topics and subscribes to them. More...
 
bool generateWSErrorTopics ()
 Builds MQTT topics for handling errors returned from the Adafruit IO broker and subscribes to them. More...
 
bool registerBoard ()
 Attempts to register hardware with Adafruit.io WipperSnapper. More...
 
bool encodePubRegistrationReq ()
 Encodes hardware registration request message and publishes the message to the Adafruit IO broker. More...
 
void decodeRegistrationResp (char *data, uint16_t len)
 Decodes hardware registration response message from the Adafruit IO MQTT broker and initializes hardware components. More...
 
void pollRegistrationResp ()
 Polls the broker for the hardware registration response message. More...
 
void publishPinConfigComplete ()
 Publishes an ACK to the broker that the device has completed its hardware configuration.
 
ws_status_t run ()
 Processes incoming commands and handles network connection. More...
 
void processPackets ()
 Process all incoming packets from the Adafruit IO MQTT broker. Handles network connectivity.
 
void publish (const char *topic, uint8_t *payload, uint16_t bLen, uint8_t qos=0)
 Publishes a message to the Adafruit IO MQTT broker. Handles network connectivity. More...
 
void pingBroker ()
 Pings the MQTT broker within the keepalive interval to keep the connection alive. Blinks the keepalive LED every STATUS_LED_KAT_BLINK_TIME milliseconds.
 
void runNetFSM ()
 Checks network and MQTT connectivity. Handles network re-connection and mqtt re-establishment.
 
void enableWDT (int timeoutMS=0)
 Enables the watchdog timer. More...
 
void feedWDT ()
 Feeds the WDT to prevent hardware reset.
 
void haltError (String error, ws_led_status_t ledStatusColor=WS_LED_STATUS_ERROR_RUNTIME, int seconds_until_reboot=25)
 Prints an error to the serial and halts the hardware until the WDT bites. More...
 
void errorWriteHang (String error)
 Writes an error message to the serial and the filesystem, blinks WS_LED_STATUS_ERROR_RUNTIME pattern and hangs. More...
 
bool decodeSignalMsg (wippersnapper_signal_v1_CreateSignalRequest *encodedSignalMsg)
 Decodes a signal buffer protobuf message. NOTE: Should be executed in-order after a new _buffer is recieved. More...
 
bool encodePinEvent (wippersnapper_signal_v1_CreateSignalRequest *outgoingSignalMsg, uint8_t pinName, int pinVal)
 Handles MQTT messages on signal topic until timeout. More...
 
bool configureDigitalPinReq (wippersnapper_pin_v1_ConfigurePinRequest *pinMsg)
 Configures a pin according to a wippersnapper_pin_v1_ConfigurePinRequest message. More...
 
bool configAnalogInPinReq (wippersnapper_pin_v1_ConfigurePinRequest *pinMsg)
 Configures an analog input pin according to a wippersnapper_pin_v1_ConfigurePinRequest message. More...
 

Protected Member Functions

void _connect ()
 Establishes a connection with the wireless network.
 
void _disconnect ()
 Disconnects from the wireless network.
 

Protected Attributes

const char * _ssid
 WiFi SSID.
 
const char * _pass
 WiFi password.
 
NetworkClientSecure * _mqtt_client_secure
 Pointer to a secure network client object.
 
NetworkClient * _mqtt_client_insecure
 Pointer to an insecure network client object.
 
WiFiMulti _wifiMulti
 WiFiMulti object for multi-network mode.
 
const char * _aio_root_ca_staging
 Root certificate for io.adafruit.us.
 
const char * _aio_root_ca_prod
 Root certificate for io.adafruit.com. More...
 
- Protected Attributes inherited from Wippersnapper
ws_status_t _status = WS_IDLE
 
uint32_t _last_mqtt_connect = 0
 
uint32_t _prv_ping = 0
 
uint32_t _prvKATBlink = 0
 
const char * _deviceId
 
char * _device_uid
 
char * _topic_description_status
 
char * _topic_description_status_complete = NULL
 
char * _topic_device_pin_config_complete
 
char * _topic_signal_brkr = NULL
 
char * _err_topic = NULL
 
char * _throttle_topic = NULL
 
Adafruit_MQTT_Subscribe * _topic_description_sub
 
Adafruit_MQTT_Publish * _topic_signal_device_pub
 
Adafruit_MQTT_Subscribe * _topic_signal_brkr_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_i2c_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_servo_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_pwm_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_ds18_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_pixels_sub
 
Adafruit_MQTT_Subscribe * _topic_signal_uart_sub
 
Adafruit_MQTT_Subscribe * _err_sub
 
Adafruit_MQTT_Subscribe * _throttle_sub
 
wippersnapper_signal_v1_CreateSignalRequest _outgoingSignalMsg
 

Additional Inherited Members

- Public Attributes inherited from Wippersnapper
bool lockStatusNeoPixel
 True if status LED is using the status neopixel.
 
bool lockStatusDotStar
 True if status LED is using the status dotstar.
 
bool lockStatusLED
 True if status LED is using the built-in LED.
 
float status_pixel_brightness
 
std::vector< WipperSnapper_Component_I2C * > i2cComponents
 Vector containing all I2C components.
 
WipperSnapper_Component_I2C_i2cPort0
 WipperSnapper I2C Component for I2C port #0. More...
 
WipperSnapper_Component_I2C_i2cPort1
 WipperSnapper I2C Component for I2C port #1. More...
 
bool _isI2CPort0Init
 True if I2C port 0 has been initialized, False otherwise. More...
 
bool _isI2CPort1Init
 True if I2C port 1 has been initialized, False otherwise. More...
 
uint8_t _buffer [WS_MQTT_MAX_PAYLOAD_SIZE]
 
uint8_t _buffer_outgoing [WS_MQTT_MAX_PAYLOAD_SIZE]
 
uint16_t bufSize
 
ws_board_status_t _boardStatus
 Hardware's registration status. More...
 
Wippersnapper_DigitalGPIO_digitalGPIO
 Instance of digital gpio class.
 
Wippersnapper_AnalogIO_analogIO
 Instance of analog io class.
 
Wippersnapper_FS * _fileSystem
 Instance of Filesystem (native USB)
 
WipperSnapper_LittleFS * _littleFS
 Instance of LittleFS Filesystem (non-native USB)
 
ws_display_driver_display = nullptr
 Instance of display driver class.
 
ws_display_ui_helper_ui_helper
 Instance of display UI helper class. More...
 
ws_pixels_ws_pixelsComponent
 ptr to instance of ws_pixels class
 
ws_pwm_pwmComponent
 Instance of pwm class.
 
ws_servo_servoComponent
 Instance of servo class.
 
ws_ds18x20_ds18x20Component
 Instance of DS18x20 class.
 
ws_uart_uartComponent
 Instance of UART class.
 
uint8_t _macAddr [6]
 
char sUID [13]
 
const char * _boardId
 
Adafruit_MQTT * _mqtt
 
secretsConfig _config
 
networkConfig _multiNetworks [3]
 
bool _isWiFiMulti = false
 
int32_t totalDigitalPins
 
char * _topic_description = NULL
 
char * _topic_signal_device = NULL
 
char * _topic_signal_i2c_brkr = NULL
 
char * _topic_signal_i2c_device = NULL
 
char * _topic_signal_servo_brkr = NULL
 
char * _topic_signal_servo_device = NULL
 
char * _topic_signal_pwm_brkr
 
char * _topic_signal_pwm_device
 
char * _topic_signal_ds18_brkr = NULL
 
char * _topic_signal_ds18_device = NULL
 
char * _topic_signal_pixels_brkr = NULL
 
char * _topic_signal_pixels_device = NULL
 
char * _topic_signal_uart_brkr = NULL
 
char * _topic_signal_uart_device = NULL
 
wippersnapper_signal_v1_CreateSignalRequest _incomingSignalMsg
 
wippersnapper_signal_v1_I2CRequest msgSignalI2C
 
wippersnapper_signal_v1_Ds18x20Request msgSignalDS
 
wippersnapper_signal_v1_ServoRequest msgServo
 ServoRequest wrapper message.
 
wippersnapper_signal_v1_PWMRequest msgPWM
 
wippersnapper_signal_v1_PixelsRequest msgPixels
 PixelsRequest wrapper message.
 
wippersnapper_signal_v1_UARTRequest msgSignalUART
 UARTReq wrapper message.
 
char * throttleMessage
 
int throttleTime
 
bool pinCfgCompleted = false
 
ws_ledc_ledc = nullptr
 Pointer to LEDC object.
 

Detailed Description

Class for using the ESP32 network interface.

Member Function Documentation

◆ set_ssid_pass()

void Wippersnapper_ESP32::set_ssid_pass ( const char *  ssid,
const char *  ssidPassword 
)
inlinevirtual

Sets the WiFi client's ssid and password.

Parameters
ssidWiFi network's SSID.
ssidPasswordWiFi network's password.

Reimplemented from Wippersnapper.

◆ check_valid_ssid()

bool Wippersnapper_ESP32::check_valid_ssid ( )
inlinevirtual

Performs a scan of local WiFi networks.

Returns
True if _network_ssid is found, False otherwise.

Reimplemented from Wippersnapper.

◆ getMacAddr()

void Wippersnapper_ESP32::getMacAddr ( )
inlinevirtual

Sets the ESP32's unique client identifier.

Note
On ESP32, the UID is the MAC address.

Reimplemented from Wippersnapper.

◆ getRSSI()

int32_t Wippersnapper_ESP32::getRSSI ( )
inlinevirtual

Gets the current network RSSI value.

Returns
int32_t RSSI value

Reimplemented from Wippersnapper.

◆ setupMQTTClient()

void Wippersnapper_ESP32::setupMQTTClient ( const char *  clientID)
inlinevirtual

Initializes the MQTT client.

Parameters
clientIDMQTT client identifier

Reimplemented from Wippersnapper.

◆ networkStatus()

ws_status_t Wippersnapper_ESP32::networkStatus ( )
inlinevirtual

Returns the network status of an ESP32 module.

Returns
ws_status_t

Reimplemented from Wippersnapper.

◆ connectionType()

const char* Wippersnapper_ESP32::connectionType ( )
inline

Returns the type of network connection used by Wippersnapper.

Returns
ESP32

Member Data Documentation

◆ _aio_root_ca_prod

const char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Af8ECDAGAQH/AgEAMDQGCCsGAQUFBwEB\n"
"BCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AuZGlnaWNlcnQuY29tMEIGA1Ud\n"
"HwQ7MDkwN6A1oDOGMWh0dHA6Ly9jcmwzLmRpZ2ljZXJ0LmNvbS9EaWdpQ2VydEds\n"
"b2JhbFJvb3RHMi5jcmwwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEW\n"
"HGh0dHBzOi8vd3d3LmRpZ2ljZXJ0LmNvbS9DUFMwDQYJKoZIhvcNAQELBQADggEB\n"
"AIIcBDqC6cWpyGUSXAjjAcYwsK4iiGF7KweG97i1RJz1kwZhRoo6orU1JtBYnjzB\n"
"c4+/sXmnHJk3mlPyL1xuIAt9sMeC7+vreRIF5wFBC0MCN5sbHwhNN1JzKbifNeP5\n"
"ozpZdQFmkCo+neBiKR6HqIA+LMTMCMMuv2khGGuPHmtDze4GmEGZtYLyF8EQpa5Y\n"
"jPuV6k2Cr/N3XxFpT3hRpt/3usU/Zb9wfKPtWpoznZ4/44c1p9rzFcZYrWkj3A+7\n"
"TNBJE0GmP2fhXhP1D/XVfIW/h0yCJGEiV9Glm/uGOa3DXHlmbAcxSyCRraG+ZBkA\n"
"7h4SeM6Y8l/7MBRpPCz6l8Y=\n"
"-----END CERTIFICATE-----\n"

Root certificate for io.adafruit.com.


The documentation for this class was generated from the following file: