fdhwlib  2.0.25
/home/kopmann/git-mirror/fdhwlib/fdhwlib/akutil/wgcommand.h
Go to the documentation of this file.
00001 /***************************************************************************
00002     WGCommand.h  -  description
00003 
00004     begin                : Mon Sep 04 2006
00005     copyright            : (C) 2006 by Andreas Kopmann
00006     email                : kopmann@ipe.fzk.de
00007  ***************************************************************************/
00008 
00009 
00010 #ifndef WGCOMMAND_H
00011 #define WGCOMMAND_H
00012 
00013 
00014 #include <unistd.h>
00015 #include <termios.h>
00016 #include <string>
00017 #include <cstdio>
00018 
00019 
00031 class WGCommand {
00032 public: 
00033   WGCommand();
00034 
00035   ~WGCommand();
00036 
00039   void openDevice(const char *device = "/dev/ttyS0");
00040 
00043   void closeDevice();
00044 
00047   void sendCmd(unsigned char *cmd, unsigned char *ack);
00048 
00050   int getParameter(char cmdId);
00051 
00053   void setParameter(char cmdId, int par1=0, int par2=0);
00054   
00056   void setDebug(int debug);
00057 
00059   void getType(int *model, int *nChannel = 0, int *morph = 0);
00060 
00064   int getVersion(char *version);
00065 
00066   
00068   void setDefaults();
00069 
00071   void setMode(int mode);
00072 
00074   int getMode();
00075 
00077   void setAmplitude(double amplitude);
00078 
00080   double getAmplitude();
00081 
00083   void setFrequency(double frequency);
00084 
00086   double getFrequency();
00087 
00089   void setOffset(double offset);
00090 
00092   double getOffset();
00093 
00096   void setOffsetMode(int mode);
00097 
00099   int getOffsetMode();
00100 
00102   void setFilterMode(int mode);
00103   
00105   int getFilterMode();
00106 
00108   void setDutyCycle(int dutycycle);
00109 
00111   int getDutyCycle();
00112 
00114   void setSyncPosition(int pos);
00115 
00117   int getSyncPosition();
00118 
00120   void setModulation(int mode);
00121 
00123   int getModulation();
00124 
00126   void setTriggerMode();
00127   
00129   int getTriggerMode();
00130   
00132   void setClock(int source);
00133   
00135   int getClock();
00136 
00138   void setWaveForm(int mode);
00139 
00141   int getWaveForm();      
00142 
00144   void setGain(int gain);
00145 
00147   int getGain();  
00148 
00149   
00150   // TODO: Add programming modes
00151   //
00152 
00153 
00155   double exp10(double exp);
00156   
00157                                                                                                                                        
00158 private:
00159 
00161   int debug;
00162 
00164   std::string device;
00165   
00167   int fd;
00168 
00170   struct termios wgTio;
00171 
00173   struct termios bufferedTio;
00174 
00176   char lastAck[7];
00177 
00179   double gain;
00180   
00181 };
00182 
00183 #endif