common/module.h

Go to the documentation of this file.
00001 /*
00002  * Copyright Ian Burnett 2005, 2006.
00003  *
00004  * This file is part of Ian's Interactive LCD controller (IILC).
00005  * 
00006  * IILC is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU General Public License as published by the Free
00008  * Software Foundation; either version 2 of the License, or (at your
00009  * option) any later version.
00010  *
00011  * IILC is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00013  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00014  * for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License along
00017  * with IILC; if not, write to the Free Software Foundation, Inc.,
00018  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
00019  */
00020 
00021 #if !defined(__MODULE_H__)
00022 #define __MODULE_H__
00023 
00041 #include "lcd.h"
00042 
00043 typedef struct _tag_module * LPMODULE;
00044 
00045 
00046 /*
00047  * Typedefs for module callbacks
00048  */
00049 
00050 /*
00051 typedef int (* pfnModuleInit)(LPSCREEN pScreen,
00052                               void ** context);
00053 
00054 typedef int (* pfnModuleReadText)(LPSCREEN pScreen,
00055                                   char ** pWindow);
00056 
00057 typedef int (* pfnModuleReadValue)(LPSCREEN pScreen,
00058                                    unsigned int * nPercentage);
00059 
00060 typedef int (* pfnModuleClose)(void * context);
00061 */
00062 
00063 
00064 
00065 
00066 typedef struct _tag_module_func_array * LPMODULE_FN_ARRAY;
00067 
00068 typedef int (* pfnModuleCreate)(int moduleHandle,
00069                                 void ** context,
00070                                 LPMODULE_FN_ARRAY pFnArray);
00071 
00072 
00073 typedef int (* pfnModuleDestroy)(void * context);
00074 
00075 /*
00076  * Callback used to report device temperatures.
00077  *
00078  * \param context Context data supplied by the client module during creation.
00079  * \param sensor_id A zero-based sensor for which the report is being made.
00080  * \param degrees_c The temperature reported by the sensor.
00081  */
00082 
00083 typedef void (* pfnTemperatureReport)(void * context,
00084                                       unsigned int sensor_id,
00085                                       double degrees_c,
00086                                       const char * pszName);
00087 
00088 /*
00089  * Callback used to query LED status.
00090  *
00091  * \param context Context data supplied by the client module during creation.
00092  * \param led_id Zero-based index of LED to use
00093  * \param pColourOn Pointer to a colour structure to indicate the ON colour.
00094  * \param pColourOff Pointer to a colour structure to indicate the OFF colour.
00095  * \param dutyCycle Percentage value (0-100) to indicate how long the LED is ON for.
00096  * \param freq Frequency of cycle in Hz/100
00097  */
00098 
00099 /*
00100  * Callback used to report fans speeds.
00101  *
00102  * \param context Context data supplied by the client module during creation.
00103  * \param fan_number A zero-based index of the fan speed being reported.
00104  * \param fan_speed The speed of the fan in RPM.
00105  *
00106  * \retval An integer - zero on success. Any other value indicates failure.
00107  */
00108 typedef void (* pfnFanSpeedReport)(void * context,
00109                                    unsigned int fan_id,
00110                                    unsigned int rpm,
00111                                    const char * pszName);
00112 
00113 
00126 typedef int (* pfnGetTextData)(void * context,
00127                                int nRow,
00128                                int nWidth,
00129                                char * buf);
00130 
00131 /*
00132 typedef int (* pfnGetNumericData)(void * context,
00133                                   LPSCREEN pScreen,
00134                                   unsigned int * value);
00135 */
00136 
00137 typedef struct _tag_module_func_array
00138 {
00139     /* The function array version this module understands */
00140     int              version;
00141 
00142     /* Device temperature report callback */
00143     pfnTemperatureReport pfnTempReport;
00144 
00145     /* Fan speed report callback */
00146     pfnFanSpeedReport pfnFanSpeedReport;
00147 
00149     pfnGetTextData pfnTextData;
00150 
00152     void * /* pfnGetLEDStatus */ pfnReadLEDStatus;
00153 
00155     void * /* pfnGetFanPower */ pfnReadFanPower;
00156 
00157 } MODULE_FN_ARRAY;
00158 
00159 
00160 
00161 typedef struct _tag_module
00162 {
00164     void *            libraryHandle;
00165 
00167     void *            moduleContext;
00168 
00170     pfnModuleCreate   pfnCreate;
00171 
00173     pfnModuleDestroy  pfnDestroy;
00174 
00175     /* All other functions */
00176     LPMODULE_FN_ARRAY pFnArray;
00177 
00179     pthread_mutex_t   mtxModule;
00180 
00181 } MODULE;
00182 
00183 int moduleInit(const char * moduleName, 
00184                LPMODULE * ppModule);
00185 
00186 /*
00187 LCD_API void moduleTemperatureReport(void * context,
00188                                     unsigned int sensor_id,
00189                                     double degrees_c);
00190 
00191 LCD_API void moduleFanSpeedReport(void * context,
00192                                  unsigned int fan_id,
00193                                  const char * pszFanName,
00194                                  unsigned int rpm);
00195 */
00196 
00197 /*
00198 LCD_API int moduleGetDisplayData(LPMODULE pModule,
00199                                  LPSCREEN pScreen,
00200                                  unsigned int row,
00201                                  char ** buf);
00202 */
00203 
00204 LCD_API int moduleGetLEDStatus(LPMODULE pModule,
00205                                unsigned int led_id,
00206                                LPCOLOUR pColourOn, 
00207                                LPCOLOUR pColourOff,
00208                                unsigned int * dutyCycle, 
00209                                unsigned int * freq);
00210 
00211 LCD_API int moduleGetFanPower(LPMODULE pModule,
00212                               int fan_id,
00213                               unsigned int * pFanPower);
00214 
00215 LCD_API int moduleRender(LPMODULE pModule,
00216                          int nRow,
00217                          int nWidth,
00218                          char * pBuffer);
00219 
00220 
00221 #endif /* __MODULE_H__ */
00222 

Generated on Mon Jul 17 01:36:11 2006 for IILC by  doxygen 1.4.6