8 #ifndef GMLOGGINGAPP_HPP_
9 #define GMLOGGINGAPP_HPP_
12 #if GPS_ENABLED == GEO_TRUE || GEO_PPS_EVENTS == GEO_TRUE
13 #include <ti/sysbios/hal/Seconds.h>
17 #include <GmMFAMDataSource.hpp>
18 #if GEO_PPS_EVENTS == GEO_TRUE
19 #include <GmPpsEvent.hpp>
21 #include <GmAppEvent.hpp>
23 #if UNMIRRORED_STORAGE == GEO_TRUE
24 #include <GmCharRingBufferStorage.hpp>
26 #if GEO_SDCARD == GEO_TRUE
27 #include <GmTivaSDStorage.hpp>
29 #if GEO_USB_STORAGE == GEO_TRUE
30 #include <GmTivaUsbStorage.hpp>
34 #if GEO_MQTT == GEO_TRUE
38 #if GPS_ENABLED == GEO_TRUE
39 #include <GmTivaGpsUartSensor.hpp>
42 #include "GmMqttCfg.hpp"
43 #include "GmAppCfg.hpp"
48 #if GEO_LEGACY_MAG_SERIAL_OUT == GEO_TRUE
49 #include "GmUartOut.hpp"
52 #include <ti/sysbios/knl/Semaphore.h>
54 #include <GmRingBuffer.hpp>
55 #include <GmManagedArrayRingBuffer.hpp>
56 #include <GmStatus.hpp>
59 #include <semaphore.h>
64 #if GEO_CONFIGPROVISION_EEPROM == GEO_TRUE
65 #include <GmProvision.hpp>
75 UInt8 m_iCommandSource;
76 UInt8 *m_pui8AddedInfo;
77 UInt32 m_iAddedInfoSize;
80 #define GEO_NO_PENDING_MODE -1
82 #define STORAGE_STATUS_ALL_OK 0
83 #define STORAGE_STATUS_USB_FAILED 0x01
84 #define STORAGE_STATUS_SD_FAILED 0x02
85 #define STORAGE_STATUS_TEST_FAILED 0x04
105 m_bSystemClockSetByGps,
107 m_bSystemClockSetByNetwork,
111 UInt32 m_iRecsWritten;
113 UInt32 TotalRecordsWritten ();
114 Bool IsSavingData ();
133 Semaphore_Handle shCommandQueueAvailable,
134 Semaphore_Handle appEventsAvailable,
139 virtual int Initialize ();
141 int SetupAppQueues ();
142 void DequeueCommands ();
143 int QueueCommand (UInt32 iCommand,
145 UInt8 *pui8AddedInfo,
146 UInt32 uiAddedInfoSize);
147 #if GEO_MQTT_SYNCH_REQUESTS == GEO_TRUE
148 int HandleMqttSynchCommand (
int messageId,
char *strTmp);
155 virtual UInt32 ProcessCommand (UInt32 iCommand,
157 UInt8 *pui8AddedInfo,
158 UInt32 uiAddedInfoSize);
160 #if (GEO_SDCARD == GEO_TRUE) || \
161 (GEO_USB_STORAGE == GEO_TRUE)
162 int ListSurveys (GmSessionNames *psnSessions);
175 Bool m_bPendingSecondRecord;
182 double m_dTimeAtNextSecond;
184 #if HOST_CONNECTED == GEO_TRUE
185 #if KNOWS_HOST_TIME == GEO_TRUE
187 int64_t mHostTimeAtSyncInMilliseconds,
188 mThisTimeAtSyncInMilliseconds;
189 bool mHostTimeSynced;
190 int SetHostSyncTimes (int64_t hostTimeInMilliseconds,
191 int64_t thisTimeInMilliseconds);
198 Bool LogToFile () {
return GetLoggingAppState()->m_bLogToFile; };
201 #if GEO_PPS_EVENTS == GEO_TRUE
202 double OnPps (Seconds_Time *timestamp);
203 int SetApproximateTimeInfo (
double dSeconds);
212 CGmAppConfig *GetConfigInfo () {
return m_cfgAppSetup; };
213 #if UNMIRRORED_STORAGE == GEO_TRUE
216 #if (GEO_SDCARD == GEO_TRUE) || \
217 (GEO_USB_STORAGE == GEO_TRUE)
222 #if (GEO_SURVEY_STORAGE == GEO_TRUE)
223 int StartLogAnnotation ();
224 void EndLogAnnotation ();
226 int LogUnindexedAppEvent (GmAppEvent *appEvent,
227 const char *strTextData,
230 #if GEO_MQTT == GEO_TRUE
231 Int RequestDeleteSegment (
const int messageId,
char *commandJson);
232 Int MarkTarget (
const int messageId,
char *commandJson);
233 Int RequestSynch (
const int messageId);
234 int SelectAcquisition (
const int messageId,
char *commandJson);
235 int SendMqttOKMessage (
const int messageId);
236 #if GEO_MQTT_SYNCH_REQUESTS == GEO_TRUE
237 int SendMqttSynchResponseMessage(
const int messageId,
const char *message);
240 int MqttSendDataFileSynch (
const int messageId,
char *commandJson);
248 UInt32 StartLogging (),
250 SetFileLogging (Bool bSet),
251 SetMqttLogging (Bool bSet),
254 #if GEO_ALLOW_RUN_DISCONNECTED == GEO_TRUE
255 uint32_t DisconnectKeepLogging ();
256 uint32_t ReconnectKeepLogging ();
267 virtual UInt32 FlushInputQueue () = 0;
269 int PrepLogSession (),
270 StartSerialPort (
int iUartPortEnum);
271 void StopLogSession ();
273 #if GEO_SDCARD == GEO_TRUE
274 int SetupSDStorage (
int iSpiEnum,
277 #if GEO_USB_STORAGE == GEO_TRUE
278 int SetupUsbStorage (
int iUsbEnum);
281 #if GPS_ENABLED == GEO_TRUE
285 #if GEO_MQTT == GEO_TRUE
298 #ifndef MIRRORED_STORAGE
304 #if (GEO_SDCARD == GEO_TRUE)||(GEO_USB_STORAGE == GEO_TRUE)
309 #if GEO_PPS_EVENTS == GEO_TRUE
317 #if GEO_LEGACY_MAG_SERIAL_OUT == GEO_TRUE
329 #if GEO_CONFIGPROVISION_EEPROM == GEO_TRUE
334 Semaphore_Handle m_shCommandAvailable,
335 m_shCommandQueueAvailable,
379 UInt32 iDownsampleRate,
397 int m_iCountSensorIds;
400 #if GEO_CONFIGPROVISION_EEPROM == GEO_TRUE
403 int AddEvent (UInt32 uiEventCode,
409 sem_t m_commandAvailableSemaphore,
410 m_commandQueueAvailable;
411 pthread_t m_commandQueueThread;
418 extern double date2sec(
long month,
long day,
long year,
long hh,
long mm,
double dsec);
Definition: GmAppCfg.hpp:29
Definition: GmMqttCfg.hpp:17
Definition: GmRingBuffer.hpp:33
Definition: GmTivaGpsUartSensor.hpp:57
Definition: GmUartOut.hpp:24
Definition: GmLoggingApp.hpp:71
Definition: GeoFatFsSurveyStorage.hpp:19
Definition: GmAppEvent.hpp:97
The root class for sensors and event sources.
Definition: GmSensor.hpp:32
Definition: GmLoggingApp.hpp:89
Direct base class for Tezzeret applications. Includes the main event queue, general command logic,...
Definition: GmLoggingApp.hpp:122
GmLoggingAppState * mLoggingAppState
State information about the application at this level (Geometrics::GmLoggingApp); This state is norma...
Definition: GmLoggingApp.hpp:296
GmStorage * mSurveyStorage
At any particular time, the application has no more than one main local storage, into which survey da...
Definition: GmLoggingApp.hpp:302
GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > * mMainEventQueue
This is the queue through which almost all events and data in a Tezzeret application pass....
Definition: GmLoggingApp.hpp:327
GmLoggingApp(Semaphore_Handle shCommandAvailable, Semaphore_Handle shCommandQueueAvailable, Semaphore_Handle appEventsAvailable, GmLoggingAppState *loggingAppState)
Constructor, called only in the context of the constructor for the final application class.
Definition: GmLoggingApp.cpp:200
GmAppEventSource * mAppEvents
Every application include AppEvents, which can include such generic functionality as start/stop,...
Definition: GmLoggingApp.hpp:316
virtual UInt32 CheckCommandContext(UInt32 iCommand)
When a command is presented to the application, the application needs to check whether the event is l...
Definition: GmLoggingApp.cpp:1530
static SensorStorageModeInfo mStorageModeInfo[GEO_MAX_APP_STORAGE_MODES][GEO_MAX_APP_SENSORS][GEO_MAX_APP_STORAGES]
A list of storages x sensors x modes. "Mode" is an application-specific state; Tezzeret isn't really ...
Definition: GmLoggingApp.hpp:352
int AddStorageSensorMode(int iStorageMode, GmEventSource *pSensor, GmStorage *pStorage, UInt32 iFormat, UInt32 iTopic, UInt32 iDownsampleRate, UInt32 iOtherInfo)
AddStorageSensorMode : Record the system's intention to handle (usuall to store or send) event and se...
Definition: GmLoggingApp.cpp:1686
Definition: GmMQTT.hpp:36
Definition: GmPpsEvent.hpp:38
Definition: GmCharRingBufferStorage.hpp:11
Definition: GmStorage.hpp:81
This class stores metadata about how a sensor should record itself to a storage, when in a particular...
Definition: GmSensor.hpp:19
GmApp/GmLoggingApp.hpp>
Definition: Analogs.hpp:47
Definition: GmProvision.hpp:55