Tezzeret  1
Tezzeret
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
Geometrics::TezzeretApp Class Reference

The top-level application object. It is a singleton, and a Tezzeret application runs in this object's functions. As the top-level object it is allowed to know about any other object in the system. Some of the important information about the application is coded in the immediate base class, Geometrics::GmLoggingApp. More...

#include <TezzeretApp.hpp>

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

Public Member Functions

 TezzeretApp ()
 Constructor.
 
void Start ()
 Start the application. This function simply calls TezzeretApp::MainStartup and then starts reading the event queue.
 
UInt16 MfamSystemStatus ()
 
CMfamApplicationStateGetState ()
 
void NetworkSetupCountdown (bool starting)
 Called during various network startup hooks - link and ipAddress - and at the end of general application startup. When the count of an internal register reaches zero, posts an event to the event queue, which will cause EthernetSetups() to be called. See EthernetStartup.
 
virtual UInt32 ProcessCommand (UInt32 iCommand, UInt8 commandSource, UInt8 *pui8AddedInfo, UInt32 uiAddedInfoSize)
 ProcessCommand implements command processing specialized to this application. "Core" commands are implemented in the Use this function carefully; it should be used rarely.

 
int AddEvent (UInt32 uiEventCode, UInt32 uiEventInfo, UInt32 uiDataLength, char *caData)
 Utility function for adding an event to the main event queue. This is a very broadly useful facility - events are logged into storages by default, and placing an event into the queue can be used to schedule some action later on, to be taken when the event is read from the queue; e.g. starting and stopping acquisition uses both of these aspects of AddEvent.
 
virtual GmLoggingAppStateGetLoggingAppState ()
 Get the object that describes the state of the immediate base class for this object.
 
virtual UInt32 FlushInputQueue ()
 Event handlers and storage are called from this function, which is called from the main loop when the main event queue has queued data to be handled. Adding a new event source usually involves adding new cases to this function.
 
- Public Member Functions inherited from Geometrics::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. 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)
 
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)
 
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)
 

Static Public Member Functions

static void SystemStartup ()
 Most startup logic belongs here; called once during system startup.
 
static int Provision (struct _GeoMachineProvisioning *pBasicProvisioning)
 
static double OnMfamPps (unsigned int index)
 
- 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)
 

Public Attributes

CMfamApplicationState m_masApplicationState
 
GmMfamDataSourcem_pmsMfamDataSource
 
GmMfamFrequencyDetectormfamFrequencyDetector
 
volatile bool mStartedCache
 
volatile int mPacketsInCache
 
uint64_t mFirstIndexInCache
 
bool mHasDestination
 
double mDestinationLatitude
 
double mDestinationLongitude
 
int mDestinationIndex
 
I2C_Handle mOffboardI2cHandle
 
I2C_Params mOffboardI2cParams
 
- Public Attributes inherited from Geometrics::GmLoggingApp
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 TezzeretAppm_static_paTheSingleApp = NULL
 TezzeretApp is a singleton.
 
static char acWebInfoStr [200]
 
- Static Public Attributes inherited from Geometrics::GmLoggingApp
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

Startup

Several functions called during application startup.

int MainStartup ()
 Calls all the other startup functions.
 
void EarlyStartupRequirements ()
 A few components need to be started before anything else.
 
void StartSensors ()
 Sensor startups. Add a new function for the specific sensor or event source, and then call it from this function.
 
void StartMonitors ()
 Start monitors. Add startup logic here for new monitors.
 
void StartStorages ()
 Storage startups. Add startup and verification logic for storage - network, SD/USB, and other event consumers - in a separate function for each new consumer, and then call it from this function.
 
Ethernet-hook events

Network functionality called after core Ethernet starts or stops

void EthernetSetups ()
 Set up ethernet - daemons, file descriptors, etc. -, after having gotten notice of link, IPaddress, and application-ready. This must be called in main thread context. Called only in ethernet-based applications.
 
void EthernetShutdown ()
 
Caching

Some applications write data in block or arrays. Used only by applications that turn on GEO_WRITE_MFAM_BLOCKS

int CacheMagData ()
 
void EmptyMfamCache ()
 
Bool MfamCacheIsFull ()
 
int WriteMfamCache ()
 
- Protected Member Functions inherited from Geometrics::GmLoggingApp
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.
 
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)
 

Friends

class GmWebServer
 GmWebServer is a special class, with broad access to anything it wants inside Geometrics::TezzeretApp.
 

Additional Inherited Members

- Protected Attributes inherited from Geometrics::GmLoggingApp
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 inherited from Geometrics::GmLoggingApp
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...
 

Detailed Description

The top-level application object. It is a singleton, and a Tezzeret application runs in this object's functions. As the top-level object it is allowed to know about any other object in the system. Some of the important information about the application is coded in the immediate base class, Geometrics::GmLoggingApp.


Member Function Documentation

◆ OnMfamPps()

double TezzeretApp::OnMfamPps ( unsigned int  index)
static

Public only because needed for some core APIs. Not normally called by application objects.


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