mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-12-20 22:12:44 +01:00
Provision status BLE proper definition
This commit is contained in:
@@ -691,7 +691,7 @@ static void sendDataToAg() {
|
|||||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnecting);
|
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnecting);
|
||||||
}
|
}
|
||||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnecting);
|
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnecting);
|
||||||
wifiConnector.bleNotifyStatus(1);
|
wifiConnector.bleNotifyStatus(PROV_CONNECTING_TO_SERVER);
|
||||||
|
|
||||||
/** Task handle led connecting animation */
|
/** Task handle led connecting animation */
|
||||||
xTaskCreate(
|
xTaskCreate(
|
||||||
@@ -720,13 +720,13 @@ static void sendDataToAg() {
|
|||||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnected);
|
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnected);
|
||||||
}
|
}
|
||||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnected);
|
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnected);
|
||||||
wifiConnector.bleNotifyStatus(2);
|
wifiConnector.bleNotifyStatus(PROV_SERVER_REACHABLE);
|
||||||
} else {
|
} else {
|
||||||
if (ag->isOne()) {
|
if (ag->isOne()) {
|
||||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnectFailed);
|
stateMachine.displayHandle(AgStateMachineWiFiOkServerConnectFailed);
|
||||||
}
|
}
|
||||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnectFailed);
|
stateMachine.handleLeds(AgStateMachineWiFiOkServerConnectFailed);
|
||||||
wifiConnector.bleNotifyStatus(11);
|
wifiConnector.bleNotifyStatus(PROV_ERR_SERVER_UNREACHABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
stateMachine.handleLeds(AgStateMachineNormal);
|
stateMachine.handleLeds(AgStateMachineNormal);
|
||||||
@@ -1048,17 +1048,17 @@ void initializeNetwork() {
|
|||||||
if (agClient->isRegisteredOnAgServer() == false) {
|
if (agClient->isRegisteredOnAgServer() == false) {
|
||||||
stateMachine.displaySetAddToDashBoard();
|
stateMachine.displaySetAddToDashBoard();
|
||||||
stateMachine.displayHandle(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
stateMachine.displayHandle(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
||||||
wifiConnector.bleNotifyStatus(13);
|
wifiConnector.bleNotifyStatus(PROV_ERR_MONITOR_NOT_REGISTERED);
|
||||||
} else {
|
} else {
|
||||||
stateMachine.displayClearAddToDashBoard();
|
stateMachine.displayClearAddToDashBoard();
|
||||||
wifiConnector.bleNotifyStatus(12);
|
wifiConnector.bleNotifyStatus(PROV_ERR_GET_MONITOR_CONFIG_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stateMachine.handleLeds(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
stateMachine.handleLeds(AgStateMachineWiFiOkServerOkSensorConfigFailed);
|
||||||
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
|
delay(DISPLAY_DELAY_SHOW_CONTENT_MS);
|
||||||
} else {
|
} else {
|
||||||
ledBarEnabledUpdate();
|
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
|
// If not connect send status through BLE while also turn led and display indicator
|
||||||
WiFi.disconnect();
|
WiFi.disconnect();
|
||||||
wifiConnecting = false;
|
wifiConnecting = false;
|
||||||
bleNotifyStatus(10);
|
bleNotifyStatus(PROV_ERR_WIFI_CONNECT_FAILED);
|
||||||
|
|
||||||
// Show failed inficator then revert back to provision mode
|
// Show failed inficator then revert back to provision mode
|
||||||
sm.ledAnimationInit();
|
sm.ledAnimationInit();
|
||||||
@@ -295,7 +295,7 @@ bool WifiConnector::connect(void) {
|
|||||||
config.setDisableCloudConnection(result == "T");
|
config.setDisableCloudConnection(result == "T");
|
||||||
}
|
}
|
||||||
hasPortalConfig = false;
|
hasPortalConfig = false;
|
||||||
bleNotifyStatus(0);
|
bleNotifyStatus(PROV_WIFI_CONNECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -14,6 +14,18 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <NimBLEDevice.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 {
|
class WifiConnector : public PrintLog {
|
||||||
public:
|
public:
|
||||||
enum class ProvisionMethod {
|
enum class ProvisionMethod {
|
||||||
|
|||||||
Reference in New Issue
Block a user