An application to log WiFi SSIDs for position lookup testing
Dependencies: C027_Support SWO mbed-rtos mbed picojson
Fork of lpc4088_ebb_ublox_Cellular_PubNubDemo_rtos by
MbedAgent.cpp
00001 #include "MbedAgent.h" 00002 #include "rtos.h" 00003 00004 MbedAgent::MbedAgent(DeviceIO& io, MDMSerial& mdm, DeviceInfo& deviceInfo, DeviceMemory& deviceMemory) : 00005 _io(io), 00006 _mdm(mdm), 00007 _deviceInfo(deviceInfo), 00008 _deviceMemory(deviceMemory), 00009 _configurationProperties(_deviceConfiguration), 00010 _signalQualityMeasurement(_deviceInfo), 00011 _analogMeasurement(_io.analog1(), _io.analog2()), 00012 _locationUpdate(_io.gpsTracker()) 00013 { 00014 } 00015 00016 bool MbedAgent::init() 00017 { 00018 if ((!_signalQualityMeasurement.init()) || 00019 (!_analogMeasurement.init()) || 00020 (!_locationUpdate.init())) { 00021 puts("Initialization failed."); 00022 return false; 00023 } 00024 return true; 00025 } 00026 00027 bool MbedAgent::run() 00028 { 00029 // add some config setup if needed 00030 00031 loop(); 00032 00033 return true; 00034 } 00035 00036 void MbedAgent::loop() 00037 { 00038 Timer timer; int interval; 00039 00040 timer.start(); 00041 while (true) { 00042 timer.reset(); 00043 00044 _signalQualityMeasurement.run(); 00045 _analogMeasurement.run(); 00046 _locationUpdate.run(); 00047 00048 if ((interval = _configurationProperties.readInterval()) == 0) 00049 break; 00050 00051 while (timer.read() < interval) { 00052 Thread::yield(); 00053 } 00054 } 00055 }
Generated on Sun Jul 17 2022 02:39:36 by
1.7.2
Richard Osterloh
