GQLLC GMC-300  0.1
GQ Electronics Geiger-Counter Model 300
/home/phil/Projects/gqgmc/gqgmc.hh
Go to the documentation of this file.
00001 // **************************************************************************
00002 // File: gqgmc.hh
00003 //
00004 // Author:    Phil Gillaspy
00005 //
00006 // Last Modified: 04/26/2012
00007 //
00008 // Description:
00009 //    Declare the class and its methods describing the capabilities
00010 //    of the GQ Electronics LLC Geiger-Muller Counter (GQ GMC).
00011 //    This code covers the GMC-300 and later models.
00012 //
00013 // INTRODUCTION:
00014 //
00015 // Detailed design documentation is embedded in the source code files.
00016 // The intent is to combine source code and documentation such that a
00017 // separate design document is unnecessary. The author's philosophy is that
00018 // the source code should be considered as part of the design documentation.
00019 // This philosophy was developed over many years of experience wherein the
00020 // design document replicated so much information that was in the source
00021 // code, that doing so generated needless opportunity for inconsistency.
00022 // It is widely recognized that replicating information only increases
00023 // the chances for human error and undue maintenance hardship.
00024 //
00025 // Since the design documentation will be embedded in the source code,
00026 // the organization is constrained to the C/C++ compilation requirements
00027 // that there exist a separate include and source body files. However,
00028 // the author's philosophy is that sofware engineers find the separation
00029 // of information between two files to be an annoyance. It would be much
00030 // preferred that all information were located at the point where the
00031 // software engineer needs to read the code to understand its operation,
00032 // in other words, the source body file (.c,.cc). However, the C/C++
00033 // convention of separate header and body files precludes that idealism.
00034 // It will be realized that various C/C++ constructs and objects appear
00035 // in both the header and source body files. So the following convention
00036 // is followed as to where to embed the documentation: the documentation
00037 // should appear where the object is defined, not where it declared.
00038 // For example, an enumeration which must be defined as publicly
00039 // visible, will be defined only in the header file and consequently
00040 // should be documented in the header file. As another example, a
00041 // class method is declared in the header file, but defined in the source
00042 // file. Therefore the bulk of the documentation for the method should
00043 // be placed in the source file.
00044 //
00045 // The documentation presented here will not cover any nuclear physics
00046 // technical aspects of the GQ Geiger-Muller counter.
00047 //
00048 // GQ GEIGER-MULLER FEATURES
00049 //
00050 // The discussion of the GQ LLC geiger counter is drawn principally
00051 // from the the GMC-300 model with firmware revision 2.15 and later.
00052 // The GMC-300 records high energy particles which when passing through
00053 // geiger-muller tube ionize the gas and create a transient current.
00054 // Each transient pulsed current is considered a 'count'.
00055 // The basic measured form of the radiation is reported in terms of
00056 // counts per second, counts per minute, or the counts per minute
00057 // averaged over an hour. The GMC-300 is also capable of recording
00058 // the aforementioned measures in a history buffer of 64K bytes.
00059 // The GMC-300 provides a USB interface which, however, is physically
00060 // and logically implemented as a traditional RS-232 serial interface.
00061 // The GMC-300 provides a variety of commands to collect data and
00062 // set operational parameters. The reader is referred to the GQ
00063 // Electronics LLC GMC-200 User Manual for a more thorough
00064 // discussion of the its features.
00065 //
00066 //
00067 // SOFTWARE LICENSE STATEMENT
00068 //
00069 // This software contained in the gqgmc.hh and gqgmc.cc files are
00070 // licensed to the public domain under terms of the GNU GPL
00071 // reproduced here.
00072 // Copyright (C) 2012  Phil Gillaspy
00073 //
00074 // This program is free software: you can redistribute it and/or modify
00075 // it under the terms of the GNU General Public License as published by
00076 // the Free Software Foundation, either version 3 of the License, or
00077 // (at your option) any later version.
00078 
00079 // This program is distributed in the hope that it will be useful,
00080 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00081 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00082 // GNU General Public License for more details.
00083 //
00084 // Additionally, the author, Phil Gillaspy, requires that no copyright
00085 // notice nor acknowledgement to the author is necessary for any
00086 // derivative software using any or all part of this software.
00087 //
00088 // DEVELOPMENT AND BUILD OVERVIEW
00089 //
00090 // The code as written is Linux dependent, however, it should not
00091 // be word-size dependent. So far it has only been compiled for
00092 // 64-bit word size on Linux using GNU g++ 4.6.1. The Eclipse
00093 // IDE was used for software development but this is not a
00094 // necessity. A Makefile is provided so that it is perfectly
00095 // acceptable to compile from the command line using
00096 // "make all", "make bin", or "make lib".  The makefile creates
00097 // a library containing the gqgmc class and its methods. This was
00098 // done so third party usage could simply link to the library.
00099 // Along with the makefile there are three associated files,
00100 // Defines.mk, Targets.mk, and Patterns.mk. Defines.mk defines
00101 // the root path of the development directory and various
00102 // compile macros. Targets.mk defines the makefile targets and
00103 // Patterns.mk defines makefile compilation dependencies.
00104 // The makefile expects a specific directory structure. Given the
00105 // the root directory of the source, there should be the following
00106 // subdirectories existing; libs, bin, obj. The libGQGMC.a is
00107 // located in the libs directory. Object files are placed in the
00108 // obj directory. A sample main.c is compiled into a executable,
00109 // gqgmc, and placed in the bin directory. The main.c contains
00110 // sample test code to excercise the various capabilities of
00111 // the GQ GMC geiger counter.
00112 //
00113 //
00114 // DESIGN OVERVIEW
00115 //
00116 // This code provides an interface to GQ Electronics LLC GMC-300
00117 // geiger counter. Therefore the functionality implemented by this
00118 // software consists of providing access to the capabilities
00119 // provided by the geiger counter. These capabilities are
00120 // elucidated in the interface document titled GQ-GMC-ICD.odt.
00121 // Generally, the public methods defined for the gqgmc class
00122 // are matched one for one with the capabilities of the
00123 // GMC-300. Therefore, the user is referred to the interface
00124 // document to ascertain what functionality can be expected of
00125 // this software. The software does make an attempt to abstract
00126 // or otherwise mask the details of the communications mechanism.
00127 // Some capabilities of the GMC-300 are not implemented for the
00128 // reason that they are not meaningful to accessing the radiation
00129 // measurements through a remote computer, or in other words,
00130 // the capability is only useful if the user carries the geiger
00131 // counter in hand. For example, only two of the approximately
00132 // 50 configuration parameters are provided with get and set methods.
00133 //
00134 //
00135 // INCLUDE FILE DOCUMENTATION
00136 //
00137 // This include for C++ string handling
00138 #include <string>
00139 
00140 // This include allows use of Linux predefined types
00141 #include <stdint.h>
00142 
00143 #ifndef gqgmc_hh_
00144 #define gqgmc_hh_
00145 
00146 // Define a name space for the GQ LLC geiger counter product line
00147 namespace GQLLC
00148 {
00149 
00150   // CONFIGURATION PARAMETER ENUMERATION
00151   //
00152   // Declare a globally visible enumeration to be used for calling the
00153   // writeConfigurationData() method. The value of the enumeration is
00154   // equal to the offset of the parameter in the configuration data
00155   // structure. This is then used as the first parameter in the call to
00156   // writeConfigurationData(). See writeConfigurationData() method in
00157   // gqgmc.cc.
00158   enum cfg_param_t
00159   {
00160     ePowerOnOff                    = 0,
00161     eAlarmOnOff                    = 1,
00162     eSpeakerOnOff                  = 2,
00163     eGraphicModeOnOff              = 3,
00164     eBacklightTimeoutSeconds       = 4,
00165     eIdleTitleDisplayMode          = 5,
00166     eAlarmCPMValue                 = 6,
00167     eCalibrationCPM0               = 8,
00168     eCalibrationSvUc0              = 10,
00169     eCalibrationCPM1               = 14,
00170     eCalibrationSvUc1              = 16,
00171     eCalibrationCPM2               = 20,
00172     eCalibrationSvUc2              = 22,
00173     eIdleDisplayMode               = 26,
00174     eAlarmValueuSvUc               = 27,
00175     eAlarmType                     = 31,
00176     eSaveDataType                  = 32,
00177     eSwivelDisplay                 = 33,
00178     eZoom                          = 34,
00179     eDataSaveAddress               = 38,
00180     eDataReadAddress               = 41,
00181     eNPowerSavingMode              = 44,
00182     eNSensitivityMode              = 45,
00183     eNCounterDelay                 = 46,
00184     eNVoltageOffset                = 48,
00185     eMaxCPM                        = 49,
00186     eNSensitivityAutoModeThreshold = 51,
00187     eSaveDate                      = 52,
00188     eSaveTime                      = 55,
00189     eMaxBytes                      = 58
00190   }; // end enum cfg_param_t
00191 
00192   // CONFIGURATION PARAMETER DATA BYTE COUNT
00193   //
00194   // Declare an globally visible enumeration to be used for calling the
00195   // writeConfigurationData() method. The value of the enumeration is equal
00196   // to the number of bytes of data passed to the writeConfigurationData()
00197   // method. For each enumeration element, enum cfg_param_t, there is a
00198   // matching enum cfg_bytecnt_t entry.
00199   enum cfg_bytecnt_t
00200   {
00201     ePowerOnOff_bytecnt                    = 1,
00202     eAlarmOnOff_bytecnt                    = 1,
00203     eSpeakerOnOff_bytecnt                  = 1,
00204     eGraphicModeOnOff_bytecnt              = 1,
00205     eBacklightTimeoutSeconds_bytecnt       = 1,
00206     eIdleTitleDisplayMode_bytecnt          = 1,
00207     eAlarmCPMValue_bytecnt                 = 2,
00208     eCalibrationCPM0_bytecnt               = 2,
00209     eCalibrationSvUc0_bytecnt              = 4,
00210     eCalibrationCPM1_bytecnt               = 2,
00211     eCalibrationSvUc1_bytecnt              = 4,
00212     eCalibrationCPM2_bytecnt               = 2,
00213     eCalibrationSvUc2_bytecnt              = 4,
00214     eIdleDisplayMode_bytecnt               = 1,
00215     eAlarmValueuSvUc_bytecnt               = 4,
00216     eAlarmType_bytecnt                     = 1,
00217     eSaveDataType_bytecnt                  = 1,
00218     eSwivelDisplay_bytecnt                 = 1,
00219     eZoom_bytecnt                          = 4,
00220     eDataSaveAddress_bytecnt               = 3,
00221     eDataReadAddress_bytecnt               = 3,
00222     eNPowerSavingMode_bytecnt              = 1,
00223     eNSensitivityMode_bytecnt              = 1,
00224     eNCounterDelay_bytecnt                 = 2,
00225     eNVoltageOffset_bytecnt                = 1,
00226     eMaxCPM_bytecnt                        = 2,
00227     eNSensitivityAutoModeThreshold_bytecnt = 1,
00228     eSaveDate_bytecnt                      = 3,
00229     eSaveTime_bytecnt                      = 3,
00230     eMaxBytes_bytecnt                      = 1
00231   }; // end enum cfg_bytecnt_t
00232 
00233   // SAVE DATA TYPE ENUMERATON
00234   // Define a globally visible enumeration which defines the
00235   // type of data that will be logged in the history buffer.
00236   // This enumeration is to be used in the get and set method
00237   // for the eSaveDataType configuration parameter. See
00238   // getSaveDataType() and setSaveDataType() methods in gqgmc.cc.
00239   enum saveDataType_t
00240   {
00241       eSaveOff = 0, // data logging is off
00242       eCPS     = 1, // counts per second
00243       eCPM     = 2, // counts per minute
00244       eCPH     = 3, // CPM averaged per hour
00245       eMaxSaveDataType = 4
00246   };
00247 
00248   // SOFTWARE KEY ENUMERATION
00249   //
00250   // Define a globally visible enumeration for use in calling the
00251   // sendKey (send software key) command. The software key command
00252   // emulates the same menu keys available on the front panel of
00253   // the GMC-300. The user uses this enumeration as the parameter
00254   // to the sendKey() call. See sendKey() method in gqgmc.cc.
00255   enum softkey_t
00256   {
00257     // The GQGMC User Manual numbers the software keys 1 through 4,
00258     // but the actual value is ASCII 0 through 3.
00259     // We provide one enum named following the User Manual convention.
00260     eKey1 = '0', eKey2 = '1', eKey3 = '2', eKey4 = '3',
00261     // The user can use a second, more intuitive, enumeration:
00262     // key 1 is the left arrow
00263     // key 2 is the up arrow
00264     // key 3 is the down arrow
00265     // key 4 is the enter/menu key
00266     eLeftArrow = '0', eUpArrow = '1', eDownArrow = '2', eEnter = '3'
00267   };
00268 
00269   // GMC ERROR CODES
00270   //
00271   // Define an enumeration of all possible error conditions. This needs
00272   // to be globally visible so external routines can use the error code
00273   // to access error text with the idea that the display of the error
00274   // condition and its associated text message to the end user can
00275   // be separated from this class. The idea is that this is a low level
00276   // driver which should be not contain high level GUI functionality.
00277   enum gmc_error_t
00278   {
00279     eNoProblem, eUSB_open_failed, eOlder_firmware, eGet_version,
00280     eGet_serial_number, eGet_CPM, eGet_CPS, eGet_AutoCPS, eGet_CFG,
00281     eErase_CFG, eUpdate_CFG, eWrite_CFG, eClear_USB,
00282     eGet_battery_voltage, eGet_history_data,
00283     eGet_history_data_length, eGet_history_data_address,
00284     eGet_history_data_overrun, eLast_error_code
00285   };
00286 
00287   // PUBLIC CONSTANTS
00288   //
00289   // Publicly available constants which specify the maximum allowed
00290   // requested length of history data and the maximum address in history
00291   // buffer, respectively. External users can use this to guard against
00292   // erroneous requests for history data. Actually, getHistoryData()
00293   // method has guards also.
00294   uint32_t const kHistory_Data_Maxsize = 0x1000;  //  4k bytes
00295   uint32_t const kHistory_Addr_Maxsize = 0x10000; // 64k bytes
00296 
00297   // CLASS DECLARATION
00298   //
00299   // The Class declaration - see gqgmc.cc for documentation
00300   class GQGMC
00301   {
00302     // PUBLIC METHODS
00303     public:
00304 
00305     // Constructor
00306     GQGMC();
00307 
00308     // Destructor is trivial, so coded inline
00309     virtual
00310     ~GQGMC()
00311     {
00312       delete[] mHistory_data;
00313     };
00314 
00315     // SUPPORTING PUBLIC METHODS
00316 
00317     // Method to call to open USB port.
00318     virtual
00319     void
00320     openUSB(string usb_device_name);
00321 
00322     // Method to close USB port
00323     virtual
00324     void
00325     closeUSB(void);
00326 
00327     // Method to clear the read (input) buffer of the USB-serial port.
00328     // This arguably should be a private method, but I can see the
00329     // outside possibility that a third party might need this.
00330     virtual
00331     void
00332     clearUSB();
00333 
00334     // Method to call to check any and all error conditions exihibited
00335     // by the GQGMC class, implementation is trivial so coded inline.
00336     virtual
00337     enum gmc_error_t
00338     getErrorCode()
00339     {
00340       return mError_code;
00341     };
00342 
00343     // Method to get a text description of the error code.
00344     virtual
00345     std::string
00346     getErrorText(gmc_error_t err);
00347 
00348     // PUBLIC METHODS PROVIDING ACCESS TO GQ GMC CAPABILITIES
00349     // Begin the public methods for issuing commands to the GQ GMC
00350     // and returning data (if any).
00351 
00352     // Method to get GQ GMC version.
00353     virtual
00354     std::string
00355     getVersion();
00356 
00357     // Method to get serial number
00358     virtual
00359     std::string
00360     getSerialNumber();
00361 
00362     // Method to get the count per minute value.
00363     virtual
00364     uint16_t
00365     getCPM();
00366 
00367 
00368     // Method to get the count per second value.
00369     virtual
00370     uint16_t
00371     getCPS();
00372 
00373     // Method to get voltage value of battery.
00374     virtual
00375     float
00376     getBatteryVoltage();
00377 
00378     // Method to get history data from internal flash. Returned
00379     // pointer points to private data history data buffer.
00380     virtual
00381     uint8_t * const
00382     getHistoryData(uint32_t address, uint32_t length);
00383 
00384     // Method to enable automatic reporting of count per second value.
00385     virtual
00386     void
00387     turnOnCPS();
00388 
00389     // Method to disable automatic reporting of count per second value.
00390     virtual
00391     void
00392     turnOffCPS();
00393 
00394     // Method to read the automatically transmitted CPS value.
00395     virtual
00396     uint16_t
00397     getAutoCPS();
00398 
00399     // Method to turn off the GQ GMC.
00400     virtual
00401     void
00402     turnOffPower();
00403 
00404     // Method to read configuration data.
00405     virtual
00406     void
00407     getConfigurationData();
00408 
00409     // Method to retrieve the data type logged in the history buffer.
00410     virtual
00411     enum saveDataType_t
00412     getSaveDataType();
00413 
00414     // Method to set the data type logged in the history buffer.
00415     virtual
00416     void
00417     setSaveDataType(enum saveDataType_t newSaveDataType);
00418 
00419     // Method to retrieve the address in the history buffer
00420     // where the logged data begins.
00421     virtual
00422     uint32_t
00423     getDataSaveAddress();
00424 
00425     // Method to set DataSaveAddress to zero, in other words,
00426     // set the address of data logging to begin in the
00427     // history buffer at address zero.
00428     virtual
00429     void
00430     resetDataSaveAddress();
00431 
00432     // Method to write configuration data.
00433     virtual
00434     void
00435     writeConfigurationData(enum cfg_param_t        cfgParameter,
00436                            enum cfg_bytecnt_t      cfgDataCount,
00437                            uint8_t const * const   cfgData);
00438 
00439     // Method to erase configuration data.
00440     virtual
00441     void
00442     eraseConfigurationData();
00443 
00444     // Method to make latest changes to configuration data take effect.
00445     // Invoke this method after setting configuration data using
00446     // writeConfiguration(), setDataSaveAddress(), or setSaveDataType().
00447     virtual
00448     void
00449     updateConfigurationData();
00450 
00451     // Public method to send key (emulate one of the 4 keys on the
00452     // front panel of the GQ GMC).
00453     virtual
00454     void
00455     sendKey(enum softkey_t key);
00456 
00457     // There are no public data members
00458 
00459 
00460     private:
00461 
00462     // PRIVATE DATA
00463 
00464     // The device name of the USB port connected to the GQ GMC.
00465     std::string             mUSB_device;
00466 
00467     // Forced to use C style IO because C++ streams does not support
00468     // setting line discipline sufficiently on the serial port.
00469     int                     mUSB_serial;
00470 
00471     // Error flag for indicating failure, see enumeration of error codes
00472     // declared above enum gmc_error_t.
00473     enum gmc_error_t        mError_code;
00474 
00475     // The failure of each command results from failing to read the
00476     // returned data. So we need a separate status for the read failure
00477     // so it can be tested privately.
00478     bool                    mRead_status;
00479 
00480     // Special flag indicating that automatic reporting of counts per
00481     // second is turned off or on (off==false, on==true). This should
00482     // and is intended to be implemented as a mutex if and when threading
00483     // is implemented.
00484     bool                    mCPS_is_on;
00485 
00486     // The USB port uses big endian transfer (ie, MSB transmitted 1st).
00487     // This flag indicates the endianess of the host CPU. This is set
00488     // in the constructor by calling isBigEndian() method.
00489     bool                    mBig_endian;
00490 
00491     // This real number is the GQ GMC's firmware revision. This is needed
00492     // because the GQ GMC changed the command string for various commands
00493     // between versions of the firmware. This means that not all commands
00494     // will work with firmware prior to 2.15.
00495     float                   mFirmware_revision;
00496 
00497     // Storage for the history data, maximum of 4K bytes to be allocated
00498     // in constructor. The user can only request a max of 4K at a time.
00499     uint8_t *               mHistory_data;
00500 
00501     // Declare a structure for storage of the configuration data.
00502     // This is a replica of the GQ GMC's internal configuration data.
00503     // This is referred to as the host computer's local copy of the
00504     // GQ GMC's NVM configuration data elsewhere in the documentation.
00505     // The getConfigurationData method will deposit the GQ GMC's NVM data
00506     // into this structure. All configuration data is the binary value.
00507     // Booleans are just 0 or 1. But remember that the byte order is
00508     // big endian for multibyte data. So multibyte data may require
00509     // reversing the byte order for display to a user. Those data
00510     // whose semantics are understood are documented below, otherwise
00511     // no explanation means either we have no interest or the parameter
00512     // is better left to being updated physically using the GQ GMC's
00513     // front panel keys.
00514     struct cfg_data_t
00515     {
00516       uint8_t powerOnOff;              // byte 0
00517       uint8_t alarmOnOff;
00518       uint8_t speakerOnOff;
00519       uint8_t graphicModeOnOff;
00520       uint8_t backlightTimeoutSeconds; // byte 4
00521       uint8_t idleTitleDisplayMode;
00522       uint8_t alarmCPMValueHiByte;
00523       uint8_t alarmCPMValueLoByte;
00524       uint8_t calibrationCPMHiByte_0; // byte 8
00525       uint8_t calibrationCPMLoByte_0;
00526       uint8_t calibrationSvUcByte3_0;
00527       uint8_t calibrationSvUcByte2_0;
00528       uint8_t calibrationSvUcByte1_0; // byte 12
00529       uint8_t calibrationSvUcByte0_0;
00530       uint8_t calibrationCPMHiByte_1;
00531       uint8_t calibrationCPMLoByte_1;
00532       uint8_t calibrationSvUcByte3_1; // byte 16
00533       uint8_t calibrationSvUcByte2_1;
00534       uint8_t calibrationSvUcByte1_1;
00535       uint8_t calibrationSvUcByte0_1;
00536       uint8_t calibrationCPMHiByte_2; // byte 20
00537       uint8_t calibrationCPMLoByte_2;
00538       uint8_t calibrationSvUcByte3_2;
00539       uint8_t calibrationSvUcByte2_2;
00540       uint8_t calibrationSvUcByte1_2; // byte 24
00541       uint8_t calibrationSvUcByte0_2;
00542       uint8_t idleDisplayMode;
00543       uint8_t alarmValueuSvUcByte3;
00544       uint8_t alarmValueuSvUcByte2;   // byte 28
00545       uint8_t alarmValueuSvUcByte1;
00546       uint8_t alarmValueuSvUcByte0;
00547       uint8_t alarmType;
00548       // saveDataType specifies both the interval of data logging where
00549       // 0 = data logging is off, 1 = once per second, 2 = once per minute,
00550       // 3 = once per hour and the type of data saved where 0 = don't care,
00551       // 1 = counts/second, 2 = counts/minute, 3 = CPM averaged over hour.
00552       // Whenever this is changed, the GQ GMC inserts a date/timestamp
00553       // into the history data buffer.
00554       uint8_t saveDataType;           // byte 32
00555       uint8_t swivelDisplay;
00556       uint8_t zoomByte3;
00557       uint8_t zoomByte2;
00558       uint8_t zoomByte1;              // byte 36
00559       uint8_t zoomByte0;
00560       // dataSaveAddress represents the address of the first sample following
00561       // the insertion of a date/timestamp or label tag into the data buffer.
00562       // Periodically, a label or date/timestamp will be put into the buffer
00563       // without a change made to dataSaveAddress. So you always have to be
00564       // on the lookout for 55AA sequence when parsing data buffer. But you
00565       // have to do that anyway because you might encounter double byte data.
00566       uint8_t dataSaveAddress2;
00567       uint8_t dataSaveAddress1;
00568       uint8_t dataSaveAddress0;       // byte 40
00569       // dataReadAddress semantics is unknown. As far as I have seen,
00570       // its value is always zero.
00571       uint8_t dataReadAddress2;
00572       uint8_t dataReadAddress1;
00573       uint8_t dataReadAddress0;
00574       uint8_t nPowerSavingMode;       // byte 44
00575       uint8_t nSensitivityMode;
00576       uint8_t nCounterDelayHiByte;
00577       uint8_t nCounterDelayLoByte;
00578       uint8_t nVoltageOffset;         // byte 48
00579       uint8_t maxCPMHiByte;
00580       uint8_t maxCPMLoByte;
00581       uint8_t nSensitivityAutoModeThreshold;
00582       // saveDateTimeStamp is the date/timestamp of the logging run,
00583       // all data following up to the next date/timestamp are marked
00584       // in time by this date/timestamp, where
00585       uint8_t saveDateTimeStampByte5; // = year (last two digits) // byte 52
00586       uint8_t saveDateTimeStampByte4; // = month
00587       uint8_t saveDateTimeStampByte3; // = day
00588       uint8_t saveDateTimeStampByte2; // = hour
00589       uint8_t saveDateTimeStampByte1; // = minute // byte 56
00590       uint8_t saveDateTimeStampByte0; // = second
00591       // maxBytes is always 0xff
00592       uint8_t maxBytes;
00593       uint8_t spare[197]; // add spare to total 256 bytes
00594     } mCFG_Data;
00595 
00596     // PRIVATE METHODS
00597 
00598 
00599     // Method to load configuration data which writes all 256 bytes
00600     // of the configuration data to the GQ GMC in sequence. This is
00601     // called by updateConfigurationData().
00602     virtual
00603     void
00604     loadConfigurationData();
00605 
00606     // Because of the returned byte stream from the GQ GMC has no protocol,
00607     // that is, it is just a sequence of N bytes, we need a specialized
00608     // read. The write is straight forward, but is combined with the read
00609     // for reasons of code commonality. So we will call the write followed
00610     // by read as the 'communicate' method.
00611     void
00612     communicate(const std::string cmd, char * retdata, uint32_t retbytes);
00613 
00614     // This is the basic method to transmit the command to the GQ GMC.
00615     // communicate() calls this to transmit command.
00616     void
00617     sendCmd(const std::string cmd);
00618 
00619     // This is the basic method to read the return bytes from the command.
00620     // communicate() calls this to read the return byte stream of the
00621     // command.
00622     void
00623     readCmdReturn(char * retdata, uint32_t retbytes);
00624 
00625     // This is the method to determine endianess of host CPU. This is to be
00626     // called by constructor once and once only.
00627     bool
00628     isBigEndian(void);
00629 
00630   }; // end class GQGMC
00631 
00632 } // end namespace GQLLC
00633 
00634 // DOCUMENTATION CONTINUES IN gqgmc.cc
00635 #endif  // gqgmc_hh_
 All Classes Namespaces Files Functions Variables Enumerations Enumerator