Tezzeret  1
Tezzeret
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Geometrics::GmCm221 Class Reference

The sensor class for the traditional cesium mags used by the G-864. More...

#include <GmCm221.hpp>

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

Public Member Functions

 GmCm221 (UInt8 iSubject, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 
int Initialize (int iBoardID)
 
virtual Void OnPreProcessUartString (char *pscString)
 
virtual int ConvertToCustomRecord (UInt8 *pscUartData, UInt8 *pcCustomRecordBuffer)
 
int Parse860String (char *pc860SerialString, struct _MagBody *pMagDatum)
 
virtual int WriteToStorage (UInt32 ui32Topic, char *pData, UInt32 iSize, GmStorage *psStorage, UInt32 ui32FormatId)
 
void SetSamplePeriod (unsigned int samplePeriodInMilliseconds)
 
int SetCycleTimeMilliseconds (int cycleTimeMilliseconds)
 
int RuntimeSetCycleTimeMilliseconds (int cycleTimeMilliseconds)
 
int GetCycleTimeMilliseconds ()
 
int WriteData (const char *pcData, unsigned int iDataSize, UInt32 ui32Topic)
 
- Public Member Functions inherited from Geometrics::GmUartLineSensor
 GmUartLineSensor (UInt8 iSubject, int iLineLength, int iMaxBuffered, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 
 GmUartLineSensor (UInt8 iSubject, int iLineLength, int iMaxBuffered, int iCustomRecordSize, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 
 GmUartLineSensor (UInt8 iSubject, int iLineLength, int iMaxBuffered, int iCustomRecordSize, UInt8 *puiBuffer, UInt32 uiBufferSize, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 
int Start ()
 
Void UartReadLoop ()
 
int WriteData (const char *pcData, unsigned int iDataSize, UInt32 ui32Topic)
 
- Public Member Functions inherited from Geometrics::GmBufferedSensor
 GmBufferedSensor (UInt8 iSubjectId, int iRingCount, int iDataSize, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 Constructor for derived classes, when it's OK to allocate a local buffer dynamically. More...
 
 GmBufferedSensor (UInt8 iSubjectId, int iRingCount, int iDataSize, UInt8 *puiBuffer, UInt32 uiBufferSize, GmManagedArrayRingBuffer< uint8_t, GM_SIZE_OF_APP_DATA_QUEUE > *mainEventQueue)
 Constructor used by most derived classes on memory-constrained systems. In this case the derived class provides a buffer, usually static, so that the buffer doesn't need to be allocated dynamically. More...
 
int Start ()
 
int ResetBuffers ()
 
Bool HasData ()
 
int ReadRecord (char *pcDestination, int iSize)
 The main interface for consumers of a sensors data to get that data. It simply copies the data in the sensor's buffer into the caller's buffer. It is up to the caller to know what to do with that data, and how to free any local memory. (This function should have been name ReadNextRecord)
 
virtual int DeleteNextRecord ()
 DeleteNextRecord allows a caller to discard the next record without retrieving it. The subclasses that implement DeleteNextRecord must be able to deal with any memory that needs to be freed, or other such concerns.
 
- Public Member Functions inherited from Geometrics::GmEventSource
void SetSensorId (int iSensorId)
 
int GetSensorId ()
 
- Public Member Functions inherited from Geometrics::GmStorage
virtual int Close (int iFileIndex)
 
virtual int EnterTransaction ()
 
virtual int LeaveTransaction ()
 
virtual int RollAndSynchFile ()
 
virtual int SelectSurveyEx (const char *strSurveyId)
 
virtual int IsDataStorage ()
 
virtual int GetLastError ()
 
virtual bool IsOpen ()
 
void SetDatasetId (const int iDataset)
 
int GetDatasetId (bool increment)
 
virtual int Shutdown ()
 

Public Attributes

int m_iCycleTimeMilliseconds
 
struct s_Indexed860MagBodyWithHeader m_i8mbwhMagRecord
 
- Public Attributes inherited from Geometrics::GmUartLineSensor
Bool m_bPing
 
Bool m_bCustomRecord
 
UART_Handle m_uhUartHandle
 
static int m_static_iMaxUarts = 0
 
static int m_static_iNextUart = 0
 
- Public Attributes inherited from Geometrics::GmBufferedSensor
CChildRingBufferm_rbBuffer
 The local buffer into which the sensor or event source stores each of its events or measurements. When an item is committed to this buffer, it also adds an event (consisting of the sensor's subject ID) into the application main event queue. The full event or measurement remains here, until the application reads the subject ID out of the main queue and then asks this sensor object for the full information by calling ReadRecord.
 
UInt8 m_iSubjectId
 

Protected Member Functions

int InitBaudRate ()
 
int AutoBaud (int *baudRateResult)
 
int SendCommand (const char *command)
 
int SendRuntimeCommand (const char *command)
 
- Protected Member Functions inherited from Geometrics::GmUartLineSensor
void PauseRead ()
 
void UnpauseRead ()
 

Protected Attributes

int m_iBoardId
 
UART_Params * m_pUartParams
 
- Protected Attributes inherited from Geometrics::GmUartLineSensor
Task_Handle m_thTask
 
bool m_boolInitialized
 
bool m_bReadPaused
 
int m_iLineLength
 
int m_iPrefixLength
 
int m_iCustomRecordSize
 
GeoIndexedStringWithHeaderm_pgiswhBuffer
 
int m_iIndexThisUart
 
UInt8 * m_caCustomRecordBuffer
 
- Protected Attributes inherited from Geometrics::GmEventSource
int m_iSensorId
 
- Protected Attributes inherited from Geometrics::GmStorage
bool m_bIsOpen
 
int m_iCurrentDataSetId
 
bool mIncrementDatasetId
 

Additional Inherited Members

- Static Public Member Functions inherited from Geometrics::GmUartLineSensor
static int InitUarts (int iMaxUarts)
 
- Static Public Member Functions inherited from Geometrics::GmStorage
static int DecodeDownloadName (const char *szDownloadName, char *strSurveyId, char *strAcquisitionId, char *strFileName)
 
- Static Public Attributes inherited from Geometrics::GmUartLineSensor
static GmUartLineSensor ** m_static_aulsUarts = NULL
 
- Static Public Attributes inherited from Geometrics::GmStorage
static int s_recordsPerFile = BLOCKS_PER_ACQUISITION_DATA_FILE
 

Detailed Description

The sensor class for the traditional cesium mags used by the G-864.

A note about timing and record counters for the G-864 magnetometer: Each record in the acquisition - mag, gps, pps, events, etc. - is placed in the database in order in relation to all the other records by a dataset and a counter. The dataset is ID of the set of records between any particular start and stop of acquisition, and the counter is simply a count of the magnetometer readings since the instrument was powered on. The counter may not be unique in a survey - the system might have been powered on multiple times over a few days, each time resetting the timer - but because the dataset is unique, the index of dataset+timer will be unique.

These counters are used to match times and locations of records with each other. A GPS time and location should be associated with the correct mag reading. When the PPS is available, the counters and timing work like this: The magnetometer is acquiring at a certain sample rate f samples / second, and a certain sample period p = 1/f When the instrument requests a data point from the mag (by sending a '$' to the mag), the mag provides the accumuluated measurement from the last period, and starts collecting data for the next period. When the PPS and GPS are available, in order to match the PPS as closely as possible with the magnetometer readings, the '$' requests to the sensor are offset by 1/2 of the period p. That is, a '$' is sent at p/2 BEFORE the PPS arrives, then another one at p/2 after, then at 3p/2, 5p/2, etc. This way, the '$' sent at p/2 AFTER the PPS retrieves the data that the sensor started collecting at p/2 BEFORE the PPS, i.e. the measurement that was averaged over the period centering on the PPS. To align these records correctly in later data processing, counters are assigned as follows, using a system counter

Member Function Documentation

◆ WriteToStorage()

int GmCm221::WriteToStorage ( UInt32  ui32Topic,
char *  pData,
UInt32  iSize,
GmStorage psStorage,
UInt32  ui32FormatId 
)
virtual

Virtual function, abstract in this class, called when a sensor should write its data to a storage or other event handler.

Parameters
ui32TopicHint to the storage (MQTT is one) about adding some topic or header information about the data. Not all storages use the hint.
pDataThe data to be written.
iSizeSize of the data to be written.
psStorageStorage or event handler to which the data will be written.
ui32FormatIdFormatting information to be used by the sensor. Within a single application, a sensor might be asked to write different formats to different storages or event handlers. Very likely the per-storage, per-mode information was stored in an instance of Geometrics::SensorStorageModeInfo.

Implements Geometrics::GmEventSource.


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