SRK Version of mDot LoRa_Sensormode_SRK
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_LoRa_Sensornode by
Application.h
00001 /* 00002 * Application.h 00003 * 00004 * Created on: Jun 3, 2016 00005 * Author: Adrian 00006 */ 00007 00008 #include "ApplicationConfig.h" 00009 #include "mbed.h" 00010 #include "rtos.h" 00011 #include "I2C_RT.h " 00012 #include "MAX44009.h " 00013 #include "BME280.h" 00014 #include "MPU9250.h " 00015 #include "SI1143.h " 00016 #include "uBlox.h " 00017 #include "mDot.h" 00018 #include "LoRa.h " 00019 #include "TaskLight.h " 00020 #include "TaskTemperature.h " 00021 #include "TaskHumidity.h" 00022 #include "TaskPressure.h " 00023 #include "TaskAcceleration.h " 00024 #include "TaskGyroscope.h " 00025 #include "TaskTesla.h " 00026 #include "TaskProximity.h " 00027 #include "TaskGPS.h " 00028 #include "TaskLoRaMeasurement.h " 00029 #include "TaskDatahandler.h " 00030 #include "main.h" 00031 00032 #ifndef SENSORHANDLER_H_ 00033 #define SENSORHANDLER_H_ 00034 00035 class Application { 00036 public: 00037 Application(); 00038 virtual ~Application(); 00039 00040 /** 00041 * @brief Start the Application in the desired Mode 00042 * @return 00043 */ 00044 void init(APPLICATION_MODE desiredMode); 00045 00046 private: 00047 RawSerial* uart; 00048 RawSerial* debugSerial; 00049 I2C_RT* i2c_rt; 00050 mDot* dot; 00051 LoRa* lora; 00052 00053 TaskLight* taskLight; 00054 TaskTemperature* taskTemperature; 00055 TaskPressure* taskPressure; 00056 TaskHumidity* taskHumidity; 00057 TaskAcceleration* taskAcceleration; 00058 TaskGyroscope* taskGyroscope; 00059 TaskTesla* taskTesla; 00060 TaskProximity* taskProximity; 00061 TaskGPS* taskGps; 00062 TaskLoRaMeasurement* taskLoRaMeasurement; 00063 TaskDatahandler* taskDataHandler; 00064 00065 rtos::Mutex* mutexI2C; 00066 rtos::Mutex* mutexUART1; 00067 rtos::Mutex mutexBME280; 00068 rtos::Mutex mutexMAX44009; 00069 rtos::Mutex mutexMPU9250; 00070 rtos::Mutex mutexSi4103; 00071 rtos::Mutex mutexUBlox; 00072 rtos::Mutex* mutexLoRa; 00073 00074 Queue<MAX44009Message,LIGHT_QUEUE_LENGHT> queueLight; 00075 Queue<BME280TemperatureMessage,TEMPERATURE_QUEUE_LENGHT> queueTemperature; 00076 Queue<BME280PressureMessage,PRESSURE_QUEUE_LENGHT> queuePressure; 00077 Queue<BME280HumidityMessage,HUMIDITY_QUEUE_LENGHT> queueHumidity; 00078 Queue<MPU9250AccelerationMessage,ACCELERATION_QUEUE_LENGHT> queueAcceleration; 00079 Queue<MPU9250GyroscopeMessage,GYROSCOPE_QUEUE_LENGHT> queueGyro; 00080 Queue<MPU9250TeslaMessage,TESLA_QUEUE_LENGHT> queueTesla; 00081 Queue<SI1143ProximityMessage,PROXIMITY_QUEUE_LENGHT> queueProximity; 00082 Queue<UBloxGPSMessage,GPS_QUEUE_LENGHT> queueGps; 00083 Queue<LoRaMeasurementMessage,LORA_MEASUREMENT_QUEUE_LENGHT> queueLoRaMeasurements; 00084 Queue<CommandMessage,COMMAND_QUEUE_LENGHT> queueCommands; 00085 00086 QueueBundle queueBundle; 00087 00088 uBlox* gpsSensor; 00089 MAX44009* max44009; 00090 BME280* bme280; 00091 MPU9250* mpu9250; 00092 SI1143* si1143; 00093 00094 ApplicationConfig* config; 00095 00096 /** 00097 * @brief Initializes all Interfaces such as I2C, UART and a Debug Serial via USB 00098 */ 00099 void initInterfaces(); 00100 00101 /** 00102 * @brief Initializes (builds) all Sensors in their specific modes 00103 */ 00104 void initSensors(); 00105 00106 /** 00107 * @brief Initializes (builds) all Tasks so that they are ready to run 00108 */ 00109 void initTasks(); 00110 00111 /** 00112 * @brief Initializes (builds) all Mutexes so that they are ready to be used 00113 */ 00114 void initMutexes(); 00115 00116 /** 00117 * @brief Initializes (builds) the ApplicationConfig which contains information about 00118 * which Task has to be run and how the sensors have to be configured 00119 */ 00120 void initApplicationConfig(); 00121 00122 /** 00123 * @brief Initializes (builds) the QueueBundle 00124 */ 00125 void initQueueBundle(); 00126 00127 /** 00128 * @brief Stops all tasks that are currently running. Used to define a defined state to start the application 00129 * in a new mode or when using a transition between two application modes it is neccessary to stop all task before 00130 * starting them again 00131 */ 00132 void stopAllRunningSensorTasks(); 00133 00134 /** 00135 * @brief Starts all task which are allowed to run by the Application Config 00136 */ 00137 void startRunnableSensorTasks(); 00138 00139 /** 00140 * @brief Configures and builds the sensors according to they SensorMode specific parameters 00141 */ 00142 void configureSensors(); 00143 00144 /** 00145 * @brief Configures and builds the LoRa Device according to its Mode specific parameters 00146 */ 00147 void configureLora(); 00148 00149 }; 00150 00151 #endif /* APPLICATION_H_ */
Generated on Wed Jul 13 2022 09:23:47 by 1.7.2