Tezzeret  1
Tezzeret
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Geometrics::GmLoggingApp Class Referenceabstract

Direct base class for Tezzeret applications. Includes the main event queue, general command logic, and support for some of the basic event types and sources, in particular Geometrics::GmAppEvent. More...

#include <GmLoggingApp.hpp>

Inheritance diagram for Geometrics::GmLoggingApp:
Inheritance graph
[legend]
Collaboration diagram for Geometrics::GmLoggingApp:
Collaboration graph
[legend]

Public Member Functions

 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. More...
 
virtual int Initialize ()
 
void MainLoop ()
 
int SetupAppQueues ()
 
void DequeueCommands ()
 
int QueueCommand (UInt32 iCommand, UInt8 commandSource, UInt8 *pui8AddedInfo, UInt32 uiAddedInfoSize)
 
int HandleMqttSynchCommand (int messageId, char *strTmp)
 
virtual UInt32 ProcessCommand (UInt32 iCommand, UInt8 commandSource, UInt8 *pui8AddedInfo, UInt32 uiAddedInfoSize)
 
int ListSurveys (GmSessionNames *psnSessions)
 
int SetHostSyncTimes (int64_t hostTimeInMilliseconds, int64_t thisTimeInMilliseconds)
 
Bool LogToFile ()
 
Bool LogToSerial ()
 
double OnPps (Seconds_Time *timestamp)
 
int SetApproximateTimeInfo (double dSeconds)
 
virtual GmLoggingAppStateGetLoggingAppState ()=0
 
CGmAppConfigGetConfigInfo ()
 
GmRingBufferFileStorageGetStorage ()
 
int StartLogAnnotation ()
 
void EndLogAnnotation ()
 
int LogUnindexedAppEvent (GmAppEvent *appEvent, const char *strTextData, int loggingMode)
 
Int RequestDeleteSegment (const int messageId, char *commandJson)
 
Int MarkTarget (const int messageId, char *commandJson)
 
Int RequestSynch (const int messageId)
 
int SelectAcquisition (const int messageId, char *commandJson)
 
int SendMqttOKMessage (const int messageId)
 
int SendMqttSynchResponseMessage (const int messageId, const char *message)
 
int MqttSendDataFileSynch (const int messageId, char *commandJson)
 
struct _GeoMachineProvisioningGetBasicProvisioning ()
 
int AddEvent (UInt32 uiEventCode, UInt32 uiEventInfo, UInt32 uiDataLength, char *caData)
 

Public Attributes

Bool m_bPendingSecondRecord
 
int m_iPendingMode
 
double m_dTimeAtNextSecond
 
int64_t mHostTimeAtSyncInMilliseconds
 
int64_t mThisTimeAtSyncInMilliseconds
 
bool mHostTimeSynced
 
CTivaGpsUartSensormGps
 
GmMqttPublishermMqttPublisher
 
CGmMqttConfigm_pcmmMqttParams
 

Static Public Attributes

static GmLoggingAppm_static_plaTheSingleApp = NULL
 
- Static Public Attributes inherited from Geometrics::GmEmbeddedApp
static char s_ApplicationName [MAX_APPLICATION_NAME_LN+1]
 
static char s_ApplicationVersionString [MAX_APPLICATION_VERSION_STRING_LN+1]
 
static char s_MachineSerialNumber [MAX_APPLICATION_MACHINE_SERIAL_NUMBER_STRING_LN+1]
 

Protected Member Functions

UInt32 StartLogging ()
 
UInt32 StopLogging ()
 
UInt32 SetFileLogging (Bool bSet)
 
UInt32 SetMqttLogging (Bool bSet)
 
UInt32 SetTextMode ()
 
UInt32 SetBinaryMode ()
 
uint32_t DisconnectKeepLogging ()
 
uint32_t ReconnectKeepLogging ()
 
virtual UInt32 CheckCommandContext (UInt32 iCommand)
 When a command is presented to the application, the application needs to check whether the event is legal in the current context. This is a guard-rail function: the application shouldn't create events that don't make sense in a particular context, but Tezzeret is a distributed application, running in at least 2 different devices at one time (the embedded device and a separate UI device such as a tablet or browser), and sometimes things get out of sync.
 
virtual UInt32 FlushInputQueue ()=0
 
int PrepLogSession ()
 
int StartSerialPort (int iUartPortEnum)
 
void StopLogSession ()
 
int SetupSDStorage (int iSpiEnum, UInt32 uiBitRate)
 
int SetupUsbStorage (int iUsbEnum)
 
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 sensor information when in a particular mode. More...
 
SensorStorageModeInfoGetModeSensorLoggingInfo (GmEventSource *psSensor, int iStorageMode)
 
int WriteSensorToStorageList (GmEventSource *psSensor, SensorStorageModeInfo ssmiStorageList[], char *pData, UInt32 iSize)
 
int WriteSensorToStorageList (GmEventSource *psSensor, SensorStorageModeInfo ssmiStorageList[], char *pData, UInt32 iSize, std::function< Bool(SensorStorageModeInfo *pInfo)> storageFilter)
 
void SetSensorId (GmEventSource *psSensor)
 

Protected Attributes

GmLoggingAppStatemLoggingAppState = nullptr
 State information about the application at this level (Geometrics::GmLoggingApp); This state is normally part of a derived application state that also includes state about the final application.
 
GmStoragemSurveyStorage
 At any particular time, the application has no more than one main local storage, into which survey data is being stored.
 
GmPpsEventSensormPpsEvents
 
GmAppEventSourcemAppEvents
 Every application include AppEvents, which can include such generic functionality as start/stop, as well as any other events that are useful to the application.
 
CTivaUartOutm_uoUartOut
 
CRingBuffermCommandQueue
 
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. When a sensor reads a datum, it places its ID (the sensor's ID) into this queue, from which it is eventually read and handled by the application.
 
CGmAppConfigm_cfgAppSetup
 
struct _GeoMachineProvisioning m_basicProvisioning
 
Semaphore_Handle m_shCommandAvailable
 
Semaphore_Handle m_shCommandQueueAvailable
 
Semaphore_Handle mAppEventsAvailable
 
int m_iCountSensorIds
 

Static Protected Attributes

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 designed as a state machine, but if it were then mode would be the state. Various modes encapsulate such ideas as "dormant mode", "log everything mode", "monitor mode", etc. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Geometrics::GmEmbeddedApp
static char * GetApplicationName ()
 
static Bool GetApplicationShortName (char *buffer, int bufferSize)
 
static Bool GetApplicationLongName (char *buffer, int bufferSize)
 
static Bool GetApplicationVersionString (char *buffer, int bufferSize)
 
static Bool GetMachineSerialNumber (char *buffer, int bufferSize)
 
static Bool CompareVersionStrings (char *nameOne, char *nameTwo)
 

Detailed Description

Direct base class for Tezzeret applications. Includes the main event queue, general command logic, and support for some of the basic event types and sources, in particular Geometrics::GmAppEvent.


Constructor & Destructor Documentation

◆ GmLoggingApp()

GmLoggingApp::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.

Parameters
semaphoresVarious semaphores; see sources for synchronizing queues
loggingAppStateThe final application class has a state object that's derived from GmLoggingAppState. That object exists in the main object, but not here, so it needs to be passed in from the final object. It's OK to do it in this context.

Member Function Documentation

◆ AddStorageSensorMode()

int GmLoggingApp::AddStorageSensorMode ( int  iStorageMode,
GmEventSource pSensor,
GmStorage pStorage,
UInt32  iFormat,
UInt32  iTopic,
UInt32  iDownsampleRate,
UInt32  iOtherInfo 
)
protected

AddStorageSensorMode : Record the system's intention to handle (usuall to store or send) event and sensor information when in a particular mode.

Parameters
iStorageModeAn application value, indicating monitorMode, writeToFiles, standby, etc.
pSensor- The sensor to which this configuration applies.
pStorage- The storage to which this configuration applies.
iFormat- How to write the data. This is a code specific to the sensor, and may inlude text v binary, version, whether or not to include header information, etc. The receiver of this data must be able to decode the data.
iTopic- Used by storage such as MQTT, to add a header or other information for routing or other purposes.
iDownsampleRate- In some modes the target storage may not want to get all of the data.
iOtherInfo- Other information of use to the sensor or storage.

See also Geometrics::GmLoggingApp::mStorageModeInfo

Member Data Documentation

◆ mStorageModeInfo

SensorStorageModeInfo GmLoggingApp::mStorageModeInfo
staticprotected

A list of storages x sensors x modes. "Mode" is an application-specific state; Tezzeret isn't really designed as a state machine, but if it were then mode would be the state. Various modes encapsulate such ideas as "dormant mode", "log everything mode", "monitor mode", etc.

This structure associates event source<==>handler interactions; in a particular mode, the data from a particular event source or sensor will be handled a certain way.

These relations are set up in the final application. In Geometrics::TezzeretApp, each application has its own setup function: Geometrics::TezzeretApp::SetupMagArrowLoggingModes, etc.


The documentation for this class was generated from the following files: