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

Class for using the AirLift Co-Processor network iface. More...

#include <Wippersnapper_AIRLIFT.h>

Inheritance diagram for Wippersnapper_AIRLIFT:
Wippersnapper

Public Member Functions

 Wippersnapper_AIRLIFT ()
 Initializes the Adafruit IO class for AirLift devices.
 
 ~Wippersnapper_AIRLIFT ()
 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 from the secrets.json provisioning file.
 
bool check_valid_ssid ()
 Performs a scan of local WiFi networks. More...
 
void set_wifi (SPIClass *wifi)
 Sets the WiFi client. More...
 
void set_airlift_pins (int ssPin, int ackPin, int rstPin, int gpio0Pin)
 Configures ESP32 "AirLift" pins. More...
 
bool firmwareCheck ()
 Checks the version of an ESP32 module running nina-fw. More...
 
bool compareVersions (const char *currentVersion, const char *requiredVersion)
 Compares two version strings. More...
 
void getMacAddr ()
 Gets 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, uint8_t 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 resetAirLift ()
 Resets the ESP32 module.
 
void _disconnect ()
 Disconnects from the wireless network.
 

Protected Attributes

const char * _ssid
 
const char * _pass
 
const char * _fv = "0.0.1"
 
int _ssPin = -1
 
int _ackPin = -1
 
int _rstPin = -1
 
int _gpio0Pin = -1
 
WiFiSSLClient * _mqtt_client
 
SPIClass * _wifi
 
- 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 AirLift Co-Processor network iface.

Member Function Documentation

◆ set_ssid_pass()

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

Sets the WiFi client's ssid and password.

Parameters
ssidWireless network's SSID.
ssidPasswordWireless network's password.

Reimplemented from Wippersnapper.

◆ check_valid_ssid()

bool Wippersnapper_AIRLIFT::check_valid_ssid ( )
inlinevirtual

Performs a scan of local WiFi networks.

Returns
True if _network_ssid is found, False otherwise.

Reimplemented from Wippersnapper.

◆ set_wifi()

void Wippersnapper_AIRLIFT::set_wifi ( SPIClass *  wifi)
inline

Sets the WiFi client.

Parameters
wifiInstance of SPIClass.

◆ set_airlift_pins()

void Wippersnapper_AIRLIFT::set_airlift_pins ( int  ssPin,
int  ackPin,
int  rstPin,
int  gpio0Pin 
)
inline

Configures ESP32 "AirLift" pins.

Parameters
ssPinESP32 S.S. pin.
ackPinESP32 ACK pin.
rstPinESP32 RST pin.
gpio0PinESP32 GPIO0 pin.

◆ firmwareCheck()

bool Wippersnapper_AIRLIFT::firmwareCheck ( )
inline

Checks the version of an ESP32 module running nina-fw.

Returns
True if matches min. required to run WipperSnapper, False otherwise.

◆ compareVersions()

bool Wippersnapper_AIRLIFT::compareVersions ( const char *  currentVersion,
const char *  requiredVersion 
)
inline

Compares two version strings.

Parameters
currentVersionCurrent version string.
requiredVersionRequired version string.
Returns
True if the current version is greater than or equal to the required version, False otherwise.

◆ getMacAddr()

void Wippersnapper_AIRLIFT::getMacAddr ( )
inlinevirtual

Gets the ESP32's unique client identifier.

Note
For the ESP32, the UID is the MAC address.

Reimplemented from Wippersnapper.

◆ getRSSI()

int32_t Wippersnapper_AIRLIFT::getRSSI ( )
inlinevirtual

Gets the current network RSSI value.

Returns
int32_t RSSI value

Reimplemented from Wippersnapper.

◆ setupMQTTClient()

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

Initializes the MQTT client.

Parameters
clientIDMQTT client identifier

Reimplemented from Wippersnapper.

◆ networkStatus()

ws_status_t Wippersnapper_AIRLIFT::networkStatus ( )
inlinevirtual

Returns the network status of an ESP32 module.

Returns
ws_status_t

Reimplemented from Wippersnapper.

◆ connectionType()

const char* Wippersnapper_AIRLIFT::connectionType ( )
inline

Returns the type of network connection used by Wippersnapper.

Returns
AIRLIFT

Member Data Documentation

◆ _ssid

const char* Wippersnapper_AIRLIFT::_ssid
protected

Network SSID.

◆ _pass

const char* Wippersnapper_AIRLIFT::_pass
protected

Network password.

◆ _fv

const char* Wippersnapper_AIRLIFT::_fv = "0.0.1"
protected

nina-fw firmware version. (placeholder)

◆ _ssPin

int Wippersnapper_AIRLIFT::_ssPin = -1
protected

SPI S.S. pin.

◆ _ackPin

int Wippersnapper_AIRLIFT::_ackPin = -1
protected

SPI ACK pin.

◆ _rstPin

int Wippersnapper_AIRLIFT::_rstPin = -1
protected

SPI RST pin.

◆ _gpio0Pin

int Wippersnapper_AIRLIFT::_gpio0Pin = -1
protected

SPI GPIO0 pin, unused.

◆ _mqtt_client

WiFiSSLClient* Wippersnapper_AIRLIFT::_mqtt_client
protected

Instance of a secure WiFi client.

◆ _wifi

SPIClass* Wippersnapper_AIRLIFT::_wifi
protected

Instance of the SPI bus used by the AirLift.


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