Skip to content
Snippets Groups Projects
Select Git revision
  • d3d2d5384cbb53c91c321c552cc56b42c90437fa
  • ballinvoher default protected
  • client-http-server-for-token
  • master
  • gitlab-auth-issue
  • windows
  • microsoft
  • message
  • azure_auth
  • prometheus
  • permission-templates
  • no-datastore
  • save-public-keys
  • gitlab-group-level-start
  • v1.1.0
  • v1.0.0
  • v0.1
17 results

sqldb.go

Blame
  • main.cc 7.42 KiB
    // **************************************************************************
    // File: main.cc
    //
    // Author:    Phil Gillaspy
    //
    // Description: Demonstration program for GQ GMC (geiger-muller counter).
    //
    //    Usage: gqgmc <usb-port-device-name>
    //    Example: gqgmc /dev/ttyUSB0
    //
    // **************************************************************************
    #include <string>
    #include <sstream>
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    #include <unistd.h>
    
    #include "gqgmc.hh"
    using namespace GQLLC;
    
    
    void mypause()
    {
      cout << "Paused: to continue, press ENTER.. " << flush;
      cin.ignore(1, '\n');
      return;
    }
    
    // Utility to show message to user. To be adapted to a pop-up window
    // when code developed for GUI.
    void Display_message(string msg)
    {
      cout << msg << endl;
    }
    
    // Utility to encapsulate the code to display an error message. This is
    // separated from Display_message() because this is specialized to
    // accessing and formulating the GQGMC error status, but not displaying.
    void Display_error(const GQGMC & gmc)
    {
      gmc_error_t  err;
      err = const_cast<GQGMC &>(gmc).getErrorCode();
      stringstream msg;
      msg << const_cast<GQGMC &>(gmc).getErrorText(err);
      Display_message(msg.str());
      return;
    }
    
    int
    main(int argc, char **argv)
    {
      // Open the USB port using a USB to serial converter device driver.
        // Using UDEV rule file 51-gqgmc.rules to create symlink to /dev/gqgmc.
      string  usb_device = "/dev/gqgmc";
    
      if (argc > 1)
        usb_device = argv[1];
      else
      {
        cout << "Usage: gqgmc <usb-port-device-name>" << endl;
        cout << "Example: gqgmc /dev/ttyUSB0" << endl;
        return 0;
      }
    
    //  cout << usb_device << endl; // debug
    
      // Instantiate the GQGMC object on the heap
      GQGMC * gqgmc = new GQGMC;