00001 #ifndef _REMOTECONFIGTEST_H__
00002 #define _REMOTECONFIGTEST_H__
00003
00004 #include <awds/configVariable.h>
00005 #include <awds/config.h>
00006
00007
00008 class RemoteConfigTestModule
00009 {
00010
00011 private:
00012 int testint;
00013 double testdouble;
00014 float testfloat;
00015 char* testchar;
00016 bool testbool;
00017
00018
00019 protected:
00020
00021 public:
00022 RemoteConfigTestModule();
00023
00024 int addRemoteConfigTestModulCmd();
00025 void print();
00026
00027 static int remoteconfigTestModule_command_fn(ShellClient &sc, void *data, int argc, char **argv);
00028
00029 static int setint( void* thisref,const int* value)
00030 {
00031 ((RemoteConfigTestModule*)thisref)->testint=*((int*)value);
00032 return CONFIG_VARIABLE_SUCCESS;
00033 }
00034 static int getint (void* thisref,int* value)
00035 {
00036 *((int*)value)=((RemoteConfigTestModule*)thisref)->testint;
00037 return CONFIG_VARIABLE_SUCCESS;
00038 }
00039
00040 static int setfloat( void* thisref,const float* value)
00041 {
00042
00043 ((RemoteConfigTestModule*)thisref)->testfloat=*((float*)value);
00044 return CONFIG_VARIABLE_SUCCESS;
00045 }
00046 static int getfloat (void* thisref,float* value)
00047 {
00048 *((float*)value)=((RemoteConfigTestModule*)thisref)->testfloat;
00049 return CONFIG_VARIABLE_SUCCESS;
00050 }
00051
00052 static int setdouble( void* thisref,const double* value)
00053 {
00054
00055 ((RemoteConfigTestModule*)thisref)->testdouble=*((double*)value);
00056 return CONFIG_VARIABLE_SUCCESS;
00057 }
00058 static int getdouble (void* thisref,double* value)
00059 {
00060 *((double*)value)=((RemoteConfigTestModule*)thisref)->testdouble;
00061 return CONFIG_VARIABLE_SUCCESS;
00062 }
00063
00064 static int setchar( void* thisref,const char* value)
00065 {
00066 if(((RemoteConfigTestModule*)thisref)->testchar)
00067 {
00068 delete ((RemoteConfigTestModule*)thisref)->testchar;
00069 ((RemoteConfigTestModule*)thisref)->testchar=NULL;
00070 }
00071 int length=strlen(((char*)value));
00072 if(length>0)
00073 {
00074 ((RemoteConfigTestModule*)thisref)->testchar=new char[length+1];
00075 memset(((RemoteConfigTestModule*)thisref)->testchar,0,length+1);
00076 memcpy(((RemoteConfigTestModule*)thisref)->testchar,((char*)value),length);
00077 return CONFIG_VARIABLE_SUCCESS;
00078 }
00079 return CONFIG_VARIABLE_FAILURE;
00080 }
00081 static int getchar (void* thisref,char* value)
00082 {
00083 memcpy(value,((RemoteConfigTestModule*)thisref)->testchar,strlen(((RemoteConfigTestModule*)thisref)->testchar));
00084 return CONFIG_VARIABLE_SUCCESS;
00085 }
00086
00087 static int setbool( void* thisref,const bool* value)
00088 {
00089
00090 ((RemoteConfigTestModule*)thisref)->testbool=*((bool*)value);
00091 return CONFIG_VARIABLE_SUCCESS;
00092 }
00093 static int getbool(void* thisref,bool* value)
00094 {
00095 *((bool*)value)=((RemoteConfigTestModule*)thisref)->testbool;
00096 return CONFIG_VARIABLE_SUCCESS;
00097 }
00098
00099 };
00100
00101 #endif