port to platformio
This commit is contained in:
28
src/platform/particle/inputs/CloudStatus.cpp
Normal file
28
src/platform/particle/inputs/CloudStatus.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "CloudStatus.h"
|
||||
#include "../../../Static.h"
|
||||
|
||||
void
|
||||
CloudStatus::onStart()
|
||||
{
|
||||
SINGLE_THREADED_BLOCK() {
|
||||
if (Particle.connected()) {
|
||||
initNetwork(0, cloud_status_connected);
|
||||
} else {
|
||||
System.on(cloud_status, &CloudStatus::initNetwork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CloudStatus::initNetwork(system_event_t event, int param) {
|
||||
if (param == cloud_status_connected) {
|
||||
Log.info("Connected to T H E C L O U D");
|
||||
MainLoop::instance()->dispatch(InputEvent{InputEvent::NetworkStatus, true});
|
||||
} else if (param == cloud_status_disconnected) {
|
||||
Log.info("Lost cloud connection!!");
|
||||
MainLoop::instance()->dispatch(InputEvent{InputEvent::NetworkStatus, false});
|
||||
}
|
||||
}
|
||||
|
||||
STATIC_ALLOC(CloudStatus);
|
Reference in New Issue
Block a user