mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-12-19 13:32:35 +01:00
Provision status BLE proper definition
This commit is contained in:
@@ -691,7 +691,7 @@ static void sendDataToAg() {
|
||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnecting);
|
||||
}
|
||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnecting);
|
||||
wifiConnector.bleNotifyStatus(1);
|
||||
wifiConnector.bleNotifyStatus(PROV_CONNECTING_TO_SERVER);
|
||||
|
||||
/** Task handle led connecting animation */
|
||||
xTaskCreate(
|
||||
@@ -720,13 +720,13 @@ static void sendDataToAg() {
|
||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnected);
|
||||
}
|
||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnected);
|
||||
wifiConnector.bleNotifyStatus(2);
|
||||
wifiConnector.bleNotifyStatus(PROV_SERVER_REACHABLE);
|
||||
} else {
|
||||
if (ag->isOne()) {
|
||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnectFailed);
|
||||
}
|
||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnectFailed);
|
||||
wifiConnector.bleNotifyStatus(11);
|
||||
wifiConnector.bleNotifyStatus(PROV_ERR_SERVER_UNREACHABLE);
|
||||
}
|
||||
|
||||
stateMachine.handleLeds(AgStateMachineNormal);
|
||||
@@ -1048,17 +1048,17 @@ void initializeNetwork() {
|
||||
if (agClient->isRegisteredOnAgServer() == false) {
|
||||
stateMachine.displaySetAddToDashBoard();
|
||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
||||
wifiConnector.bleNotifyStatus(13);
|
||||
wifiConnector.bleNotifyStatus(PROV_ERR_MONITOR_NOT_REGISTERED);
|
||||
} else {
|
||||
stateMachine.displayClearAddToDashBoard();
|
||||
wifiConnector.bleNotifyStatus(12);
|
||||
wifiConnector.bleNotifyStatus(PROV_ERR_GET_MONITOR_CONFIG_FAILED);
|
||||
}
|
||||
}
|
||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
||||
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
|
||||
} else {
|
||||
ledBarEnabledUpdate();
|
||||
wifiConnector.bleNotifyStatus(3);
|
||||
wifiConnector.bleNotifyStatus(PROV_MONITOR_CONFIGURED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -242,7 +242,7 @@ bool WifiConnector::connect(void) {
|
||||
// If not connect send status through BLE while also turn led and display indicator
|
||||
WiFi.disconnect();
|
||||
wifiConnecting = false;
|
||||
bleNotifyStatus(10);
|
||||
bleNotifyStatus(PROV_ERR_WIFI_CONNECT_FAILED);
|
||||
|
||||
// Show failed inficator then revert back to provision mode
|
||||
sm.ledAnimationInit();
|
||||
@@ -295,7 +295,7 @@ bool WifiConnector::connect(void) {
|
||||
config.setDisableCloudConnection(result == "T");
|
||||
}
|
||||
hasPortalConfig = false;
|
||||
bleNotifyStatus(0);
|
||||
bleNotifyStatus(PROV_WIFI_CONNECT);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -715,7 +715,7 @@ void WifiConnector::stopBLE() {
|
||||
if (bleServerRunning) {
|
||||
Serial.println("Stopping BLE");
|
||||
NimBLEDevice::deinit();
|
||||
}
|
||||
}
|
||||
bleServerRunning = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,18 @@
|
||||
#include <Arduino.h>
|
||||
#include <NimBLEDevice.h>
|
||||
|
||||
// Provisioning Status Codes
|
||||
#define PROV_WIFI_CONNECT 0 // WiFi Connect
|
||||
#define PROV_CONNECTING_TO_SERVER 1 // Connecting to server
|
||||
#define PROV_SERVER_REACHABLE 2 // Server reachable
|
||||
#define PROV_MONITOR_CONFIGURED 3 // Monitor configured properly on dashboard
|
||||
|
||||
// Provisioning Error Codes
|
||||
#define PROV_ERR_WIFI_CONNECT_FAILED 10 // Failed to connect to WiFi
|
||||
#define PROV_ERR_SERVER_UNREACHABLE 11 // Server unreachable
|
||||
#define PROV_ERR_GET_MONITOR_CONFIG_FAILED 12 // Failed to get monitor configuration from dashboard
|
||||
#define PROV_ERR_MONITOR_NOT_REGISTERED 13 // Monitor is not registered on dashboard
|
||||
|
||||
class WifiConnector : public PrintLog {
|
||||
public:
|
||||
enum class ProvisionMethod {
|
||||
|
||||
Reference in New Issue
Block a user