comedi_hwi.C

Go to the documentation of this file.
00001 /* Gnome gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  *
00005  * Gxsm Hardware Interface Plugin Name: comedi_hwi.C
00006  * ===============================================
00007  * 
00008  * Copyright (C) 1999 The Free Software Foundation
00009  *
00010  * Authors: Percy Zahl <zahl@fkp.uni-hannover.de>
00011  * additional features: Andreas Klust <klust@fkp.uni-hannover.de>
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00026  */
00027 
00028 
00029 /* Please do not change the Begin/End lines of this comment section!
00030  * this is a LaTeX style section used for auto generation of the PlugIn Manual 
00031  * Chapter. Add a complete PlugIn documentation inbetween the Begin/End marks!
00032  * All "% PlugInXXX" commentary tags are mandatory
00033  * All "% OptPlugInXXX" tags are optional and can be removed or commented in
00034  * --------------------------------------------------------------------------------
00035 % PlugInModuleIgnore
00036 
00037 % BeginPlugInDocuSection
00038 % PlugInDocuCaption: Comedi Demonstration/Experimental Hardware Interface (OBSOLETE)
00039 % PlugInName: comedi_hwi
00040 % PlugInAuthor: Percy Zahl
00041 % PlugInAuthorEmail: zahl@users.sf.net
00042 % PlugInMenuPath: Hardware/Comedi:SPM-HwI
00043 
00044 % PlugInDescription
00045 This provides a dummy data simulating hardware interface for GXSM. For
00046 demonstartive purpose only.
00047 
00048 % PlugInUsage
00049 Set the \GxsmPref{Hardware}{Card} to ''Comedi:SPM''.
00050 
00051 %% OptPlugInSources
00052 
00053 %% OptPlugInDest
00054 
00055 % OptPlugInNote
00056 For experimental and demonstrational/template purpose only.
00057 
00058 % EndPlugInDocuSection
00059  * -------------------------------------------------------------------------------- 
00060  */
00061 
00062 #include <sys/ioctl.h>
00063 
00064 #include "config.h"
00065 #include "gxsm/plugin.h"
00066 #include "gxsm/xsmhard.h"
00067 
00068 // Define HwI PlugIn reference name here, this is what is listed later within "Preferenced Dialog"
00069 // i.e. the string selected for "Hardware/Card"!
00070 #define THIS_HWI_PLUGIN_NAME "Comedi:SPM"
00071 
00072 // Plugin Prototypes
00073 static void comedi_hwi_init( void );
00074 static void comedi_hwi_about( void );
00075 static void comedi_hwi_configure( void );
00076 static void comedi_hwi_cleanup( void );
00077 
00078 // Fill in the GxsmPlugin Description here
00079 GxsmPlugin comedi_hwi_pi = {
00080   NULL,                   // filled in and used by Gxsm, don't touch !
00081   NULL,                   // filled in and used by Gxsm, don't touch !
00082   0,                      // filled in and used by Gxsm, don't touch !
00083   NULL,                   // The Gxsm-App Class Ref.pointer (called "gapp" in Gxsm) is 
00084                           // filled in here by Gxsm on Plugin load, 
00085                           // just after init() is called !!!
00086   // ----------------------------------------------------------------------
00087   // Plugins Name, CodeStly is like: Name-M1S|M2S-BG|F1D|F2D|ST|TR|Misc
00088   "comedi_hwi-"
00089   "HW-INT-1S-SHORT",
00090   // Plugin's Category - used to autodecide on Pluginloading or ignoring
00091   // In this case of Hardware-Interface-Plugin here is the interface-name required
00092   // this is the string selected for "Hardware/Card"!
00093   THIS_HWI_PLUGIN_NAME,
00094   // Description, is shown by PluginViewer (Plugin: listplugin, Tools->Plugin Details)
00095   "Comedi hardware interface.",
00096   // Author(s)
00097   "Percy Zahl",
00098   // Menupath to position where it is appendet to -- not used by HwI PIs
00099   N_("Hardware/"),
00100   // Menuentry -- not used by HwI PIs
00101   N_(THIS_HWI_PLUGIN_NAME"-HwI"),
00102   // help text shown on menu
00103   N_("This is the "THIS_HWI_PLUGIN_NAME" - GXSM Hardware Interface"),
00104   // more info...
00105   "N/A",
00106   NULL,          // error msg, plugin may put error status msg here later
00107   NULL,          // Plugin Status, managed by Gxsm, plugin may manipulate it too
00108   // init-function pointer, can be "NULL", 
00109   // called if present at plugin load
00110   comedi_hwi_init,  
00111   // query-function pointer, can be "NULL", 
00112   // called if present after plugin init to let plugin manage it install itself
00113   NULL, // query should be "NULL" for Gxsm-Math-Plugin !!!
00114   // about-function, can be "NULL"
00115   // can be called by "Plugin Details"
00116   comedi_hwi_about,
00117   // configure-function, can be "NULL"
00118   // can be called by "Plugin Details"
00119   comedi_hwi_configure,
00120   // run-function, can be "NULL", if non-Zero and no query defined, 
00121   // it is called on menupath->"plugin"
00122   NULL, // run should be "NULL" for Gxsm-Math-Plugin !!!
00123   // cleanup-function, can be "NULL"
00124   // called if present at plugin removeal
00125   comedi_hwi_cleanup
00126 };
00127 
00128 
00129 // Text used in Aboutbox, please update!!
00130 static const char *about_text = N_("GXSM comedi_hwi Plugin\n\n"
00131                                    "Comedi Hardware Interface for SPM.");
00132 
00133 /* Here we go... */
00134 
00135 #include "comedi_hwi.h"
00136 
00137 /*
00138  * PI global
00139  */
00140 
00141 comedi_hwi_dev *comedi_hwi_hardware = NULL;
00142 
00143 /* 
00144  * PI essential members
00145  */
00146 
00147 // Symbol "get_gxsm_plugin_info" is resolved by dlsym from Gxsm, used to get Plugin's info!! 
00148 // Essential Plugin Function!!
00149 GxsmPlugin *get_gxsm_plugin_info ( void ){ 
00150   comedi_hwi_pi.description = g_strdup_printf(N_("GXSM HwI comedi_hwi plugin %s"), VERSION);
00151   return &comedi_hwi_pi; 
00152 }
00153 
00154 // Symbol "get_gxsm_hwi_hardware_class" is resolved by dlsym from Gxsm for all HwI type PIs, 
00155 // Essential Plugin Function!!
00156 XSM_Hardware *get_gxsm_hwi_hardware_class ( void *data ) {
00157         return comedi_hwi_hardware;
00158 }
00159 
00160 // init-Function
00161 static void comedi_hwi_init(void)
00162 {
00163         PI_DEBUG (DBG_L2, "comedi_hwi Plugin Init");
00164         comedi_hwi_hardware = new comedi_hwi_spm ();
00165  }
00166 
00167 // about-Function
00168 static void comedi_hwi_about(void)
00169 {
00170         const gchar *authors[] = { comedi_hwi_pi.authors, NULL};
00171         gtk_widget_show(gnome_about_new ( comedi_hwi_pi.name,
00172                                           VERSION,
00173                                           N_("(C) 2000 the Free Software Foundation"),
00174                                           about_text,
00175                                           authors,
00176                                           NULL, NULL, NULL
00177                                 ));
00178 }
00179 
00180 // configure-Function
00181 static void comedi_hwi_configure(void)
00182 {
00183         if(comedi_hwi_pi.app)
00184                 comedi_hwi_pi.app->message("comedi_hwi Plugin Configuration");
00185 }
00186 
00187 // cleanup-Function
00188 static void comedi_hwi_cleanup(void)
00189 {
00190         PI_DEBUG (DBG_L2, "comedi_hwi Plugin Cleanup");
00191         delete comedi_hwi_hardware;
00192         comedi_hwi_hardware = NULL;
00193 }
00194 

Generated on Sat Apr 1 09:04:14 2006 for GXSM by  doxygen 1.4.6