escort97.cpp

Go to the documentation of this file.
00001 //======================================================================
00002 // File:        escort97.cpp
00003 // Author:      Matthias Toussaint
00004 // Created:     Sun Nov 26 18:53:43 CET 2006
00005 // Project:     QtDMM
00006 // Description: Encapsulates a DMM class (protokoll)
00007 //----------------------------------------------------------------------
00008 // This file  may  be used under  the terms of  the GNU  General Public
00009 // License  version 2.0 as published   by the Free Software  Foundation
00010 // and appearing  in the file LICENSE.GPL included  in the packaging of
00011 // this file.
00012 // 
00013 // This file is provided AS IS with  NO WARRANTY OF ANY KIND, INCLUDING 
00014 // THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00015 // PURPOSE.
00016 //----------------------------------------------------------------------
00017 // Copyright 2006 Matthias Toussaint
00018 //======================================================================
00019 
00020 #include <escort97.h>
00021 
00022 #include <iostream>
00023 
00024 Escort97::Escort97() :
00025   DMMClass()
00026 {
00027   setNumValues( 2 );
00028 }
00029 
00030 Escort97::~Escort97()
00031 {
00032 }
00033 
00034 Port::Error Escort97::open_impl( const std::string & config )
00035 {
00036   return m_port.open( config );
00037 }
00038 
00039 Port::Error Escort97::close()
00040 {
00041   return m_port.close();
00042 }
00043 
00044 void Escort97::run()
00045 {
00046   unsigned char data[128];
00047   
00048   while (m_run)
00049   {
00050     int cnt = readData( &m_port, (unsigned char *)data, 
00051                          0x00, 21, 127 );
00052 
00053   }
00054 }
00055 
00056 std::string Escort97::byteToDigit( unsigned char byte )
00057 {
00058   std::string retval;
00059   
00060   switch (byte)
00061   {
00062     case 0x20:
00063       retval = "0";
00064       break;
00065     case 0x21:
00066       retval = "1";
00067       break;
00068     case 0x22:
00069       retval = "2";
00070       break;
00071     case 0x23:
00072       retval = "3";
00073       break;
00074     case 0x24:
00075       retval = "4";
00076       break;
00077     case 0x25:
00078       retval = "5";
00079       break;
00080     case 0x26:
00081       retval = "6";
00082       break;
00083     case 0x27:
00084       retval = "7";
00085       break;
00086     case 0x28:
00087       retval = "8";
00088       break;
00089     case 0x2a:
00090       retval = "9";
00091       break;
00092   }
00093 
00094   return retval;
00095 }

Generated on Mon Jan 22 23:24:18 2007 for cdmm by  doxygen 1.4.6