00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "hddTemp.h"
00022
00023
00024 typedef struct _tag_screen_temp
00025 {
00026 double temp;
00027
00028
00029 } SCREEN_TEMP, * LPSCREEN_TEMP;
00030
00031
00032 void temperatureReport(void * context,
00033 unsigned int sensor_id,
00034 double degrees_c,
00035 const char * pszName);
00036
00037 int ModuleCreate(int handle, void ** context, LPMODULE_FN_ARRAY pFnArray)
00038 {
00039 LPSCREEN_TEMP pInst = NULL;
00040
00041
00042 pInst = malloc(sizeof(SCREEN_TEMP));
00043 *context = pInst;
00044
00045
00046 pFnArray->version = 1;
00047
00048
00049 pFnArray->pfnTextData = GetDisplayData;
00050 pFnArray->pfnTempReport = temperatureReport;
00051
00052 return 0;
00053 }
00054
00055
00056 int ModuleDestroy(void * context)
00057 {
00058 LPSCREEN_TEMP pInst = (LPSCREEN_TEMP) context;
00059
00060
00061 free(pInst);
00062
00063 return 0;
00064 }
00065
00066
00067 int GetDisplayData(void * context, LPSCREEN pScreen, char ** buf)
00068 {
00069 LPSCREEN_TEMP pInstance = (LPSCREEN_TEMP) context;
00070
00071 sprintf(*buf, "%.1f%cC", pInstance->temp, 0x80);
00072
00073 return 0;
00074 }
00075
00076 void temperatureReport(void * context, unsigned int sensor_id, double degrees_c, const char * pszName)
00077 {
00078 LPSCREEN_TEMP pInst = (LPSCREEN_TEMP) context;
00079
00080 pInst->temp = degrees_c;
00081 }