00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #include "schunk_libm5api/m5apiw32.h"
00019 #include "../Device/Device.h"
00020 #include "../Util/IOFunctions.h"
00021 #include "../Util/Message.h"
00022 
00023 
00024 
00025 
00026 
00027 #ifdef DEBUG_M5_API
00028 M5DLL_API int g_iM5DebugLevel = 5; 
00029 M5DLL_API int g_iM5DebugFile = 1; 
00030 M5DLL_API int g_iM5Debug = 0; 
00031 #else
00032 M5DLL_API int g_iM5DebugLevel = 0;
00033 M5DLL_API int g_iM5DebugFile = 0;
00034 M5DLL_API int g_iM5Debug = 0;
00035 #endif
00036 
00037 
00038 
00039 
00040 
00041 static std::vector<CDevice*> g_apclDevice;
00042 static std::vector<int> g_aiDeviceRefCount;
00043 
00044 
00045 #if defined (_WIN32)
00046 BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
00047 {       
00048 
00049 
00050 
00051         switch (ul_reason_for_call) 
00052     { 
00053         
00054         
00055  
00056           case DLL_PROCESS_ATTACH: 
00057 
00058             
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086             break; 
00087  
00088         
00089  
00090         case DLL_THREAD_ATTACH: 
00091 
00092 
00093          break; 
00094  
00095         
00096  
00097         case DLL_THREAD_DETACH: 
00098 
00099 
00100             break; 
00101  
00102         
00103         
00104  
00105         case DLL_PROCESS_DETACH: 
00106 
00107 
00108 
00109 
00110 
00111 
00112             break; 
00113  
00114         default: 
00115                         break; 
00116      } 
00117  
00118     return TRUE; 
00119     UNREFERENCED_PARAMETER(hModule); 
00120     UNREFERENCED_PARAMETER(lpReserved); 
00121 }
00122 #endif
00123 
00124 M5DLL_API int WINAPI PCube_getDllVersion()
00125 {       
00126         return M5DLLVERSION;
00127 }
00128 
00129 M5DLL_API int WINAPI PCube_setDllDebug( int iDebug, int iDebugLevel, int iDebugFile )
00130 {       
00131         g_iM5Debug = iDebug;
00132         g_iM5DebugLevel = iDebugFile;
00133         g_iM5DebugFile = iDebugLevel;
00134         for(int i = 0; i < g_aiDeviceRefCount.size();i++)
00135                 if( g_apclDevice[i] != NULL )
00136                 {
00137                         g_apclDevice[i]->setDebug(iDebug);
00138                         g_apclDevice[i]->setDebugLevel(iDebugLevel);
00139                         g_apclDevice[i]->setDebugFile(iDebugFile);
00140                 }
00141         return 0;
00142 }
00143 
00144 M5DLL_API int WINAPI PCube_configFromFile( const char* acFileName )
00145 {
00146         int iRetVal, i, j;
00147         char acBuffer[128];
00148         char acInitString[128];
00149         char acDevice[128];
00150         char acModule[128];
00151         char acDeviceName[128];
00152         int iDeviceNumber = 0;
00153         int iDeviceStart = 0;
00154         int iModuleNumber = 0;
00155         int iModuleStart = 0;
00156         int iDeviceId = -1;
00157         int iModuleId = -1;
00158         float fHomeOffset = 0.0;
00159         float fHomeVel = 0.0;
00160         int iC0 = 0;
00161         int iDamp = 0;
00162         int iA0 = 0;
00163         float fMinPos = 0.0;
00164         float fMaxPos = 0.0;
00165         float fMaxDeltaPos = 0.0;
00166         float fMaxVel = 0.0;
00167         float fMaxAcc = 0.0;
00168         float fMaxCur = 0.0;
00169         util_searchString("PROCESS", "Debug", "0", acBuffer, 128, acFileName);
00170         g_iM5Debug = atoi(acBuffer);
00171         util_searchString("PROCESS", "DebugLevel", "0", acBuffer, 128, acFileName);
00172         g_iM5DebugLevel = atoi(acBuffer);
00173         util_searchString("PROCESS", "DebugFile", "0", acBuffer, 128, acFileName);
00174         g_iM5DebugFile = atoi(acBuffer);
00175         CMessage clDebug("M5apiw32", g_iM5DebugLevel, g_iM5Debug, g_iM5DebugFile);
00176 
00177         iRetVal = util_searchString("PROCESS", "DeviceNumber", "0", acBuffer, 128, acFileName);
00178         if(iRetVal < 0)
00179         {
00180                 clDebug.warning("could not open file %s", acFileName);
00181                 return ERRID_DEV_OPENINIFILE;
00182         }
00183         iDeviceNumber = atoi(acBuffer);
00184         util_searchString("PROCESS", "DeviceStart", "0", acBuffer, 128, acFileName);
00185         iDeviceStart = atoi(acBuffer);
00186         util_searchString("PROCESS", "ModuleNumber", "0", acBuffer, 128, acFileName);
00187         iModuleNumber = atoi(acBuffer);
00188         util_searchString("PROCESS", "ModuleStart", "0", acBuffer, 128, acFileName);
00189         iModuleStart = atoi(acBuffer);
00190 
00191         for(i = 0; i < iDeviceNumber; i++)
00192         {
00193                 sprintf(acDevice,"DEVICE_%02d",i + iDeviceStart);
00194                 util_searchString(acDevice, "DeviceName", "not available", acDeviceName, 128, acFileName);
00195                 util_searchString(acDevice, "InitString", "not available", acInitString, 128, acFileName);
00196                 clDebug.debug(0,"Trying to open device %s with initstring %s", acDeviceName, acInitString);
00197                 iRetVal = PCube_openDevice(&iDeviceId, acInitString);
00198                 if(iRetVal < 0)
00199                 {
00200                         clDebug.debug(0,"Cound not open device %s with initstring %s", acDeviceName, acInitString);
00201                         return iRetVal;
00202                 }
00203                 (g_apclDevice[iDeviceId])->setName(acDeviceName);
00204                 clDebug.debug(0,"Successfully open device %s with initstring %s", acDeviceName, acInitString);
00205         }
00206 
00207         for(i = 0; i < iModuleNumber; i++)
00208         {
00209                 sprintf(acModule,"MODULE_%02d",i + iModuleStart);
00210                 util_searchString(acModule, "DeviceName", "CAN", acDeviceName, 128, acFileName);
00211                 util_searchString(acModule, "ModuleId", "-1", acBuffer, 128, acFileName);
00212                 iModuleId = atoi(acBuffer);
00213                 clDebug.debug(0,"Trying to config module %i on device %s ", iModuleId, acDeviceName);
00214                 iDeviceId = -1;
00215                 for(j = 0; j < g_apclDevice.size(); j++)
00216                 {
00217                         if(g_apclDevice[j] != NULL)
00218                                 if(strcmp(acDeviceName, (g_apclDevice[j])->getName()) == 0)
00219                                 {
00220                                         iDeviceId = j;
00221                                         break;
00222                                 }
00223                 }
00224                 if(iDeviceId < 0)
00225                 {
00226                         clDebug.debug(0,"Cound not found device %s", acDeviceName);
00227                         return ERRID_DEV_NODEVICENAME;
00228                 }
00229                 util_searchString(acModule, "HomeOffset", "not available", acBuffer, 128, acFileName);
00230                 if(strcmp(acBuffer, "not available") != 0)
00231                 {
00232                         fHomeOffset = atof(acBuffer);
00233                         iRetVal = PCube_setHomeOffset(iDeviceId, iModuleId, fHomeOffset);
00234                         if(iRetVal < 0)
00235                         {
00236                                 clDebug.debug(0,"Cound not set homeoffset of module %i on device %s", iModuleId, acDeviceName);
00237                                 return iRetVal;
00238                         }
00239                         clDebug.debug(0,"Set homeoffset to %f of module %i on device %s", fHomeOffset, iModuleId, acDeviceName);
00240                 }
00241                 util_searchString(acModule, "HomeVel", "not available", acBuffer, 128, acFileName);
00242                 if(strcmp(acBuffer, "not available") != 0)
00243                 {
00244                         fHomeVel = atof(acBuffer);
00245                         iRetVal = PCube_setHomeVel(iDeviceId, iModuleId, fHomeVel);
00246                         if(iRetVal < 0)
00247                         {
00248                                 clDebug.debug(0,"Cound not set homevel of module %i on device %s", iModuleId, acDeviceName);
00249                                 return iRetVal;
00250                         }
00251                         clDebug.debug(0,"Set homevel to %f of module %i on device %s", fHomeVel, iModuleId, acDeviceName);
00252                 }
00253                 util_searchString(acModule, "C0", "not available", acBuffer, 128, acFileName);
00254                 if(strcmp(acBuffer, "not available") != 0)
00255                 {
00256                         iC0 = atoi(acBuffer);
00257                         iRetVal = PCube_setC0(iDeviceId, iModuleId, iC0);
00258                         if(iRetVal < 0)
00259                         {
00260                                 clDebug.debug(0,"Cound not set C0 of module %i on device %s", iModuleId, acDeviceName);
00261                                 return iRetVal;
00262                         }
00263                         clDebug.debug(0,"Set CO to %i of module %i on device %s", iC0, iModuleId, acDeviceName);
00264                 }
00265                 util_searchString(acModule, "Damp", "not available", acBuffer, 128, acFileName);
00266                 if(strcmp(acBuffer, "not available") != 0)
00267                 {
00268                         iDamp= atoi(acBuffer);
00269                         iRetVal = PCube_setDamp(iDeviceId, iModuleId, iDamp);
00270                         if(iRetVal < 0)
00271                         {
00272                                 clDebug.debug(0,"Cound not set damp of module %i on device %s", iModuleId, acDeviceName);
00273                                 return iRetVal;
00274                         }
00275                         clDebug.debug(0,"Set damp to %i of module %i on device %s", iDamp, iModuleId, acDeviceName);
00276                 }
00277                 util_searchString(acModule, "A0", "not available", acBuffer, 128, acFileName);
00278                 if(strcmp(acBuffer, "not available") != 0)
00279                 {
00280                         iA0 = atoi(acBuffer);
00281                         iRetVal = PCube_setA0(iDeviceId, iModuleId, iA0);
00282                         if(iRetVal < 0)
00283                         {
00284                                 clDebug.debug(0,"Cound not set A0 of module %i on device %s", iModuleId, acDeviceName);
00285                                 return iRetVal;
00286                         }
00287                         clDebug.debug(0,"Set A0 to %i of module %i on device %s", iA0, iModuleId, acDeviceName);
00288                 }
00289                 util_searchString(acModule, "MinPos", "not available", acBuffer, 128, acFileName);
00290                 if(strcmp(acBuffer, "not available") != 0)
00291                 {
00292                         fMinPos = atof(acBuffer);
00293                         iRetVal = PCube_setMinPos(iDeviceId, iModuleId, fMinPos);
00294                         if(iRetVal < 0)
00295                         {
00296                                 clDebug.debug(0,"Cound not set minpos of module %i on device %s", iModuleId, acDeviceName);
00297                                 return iRetVal;
00298                         }
00299                         clDebug.debug(0,"Set minpos to %f of module %i on device %s", fMinPos, iModuleId, acDeviceName);
00300                 }
00301                 util_searchString(acModule, "MaxPos", "not available", acBuffer, 128, acFileName);
00302                 if(strcmp(acBuffer, "not available") != 0)
00303                 {
00304                         fMaxPos = atof(acBuffer);
00305                         iRetVal = PCube_setMaxPos(iDeviceId, iModuleId, fMaxPos);
00306                         if(iRetVal < 0)
00307                         {
00308                                 clDebug.debug(0,"Cound not set maxpos of module %i on device %s", iModuleId, acDeviceName);
00309                                 return iRetVal;
00310                         }
00311                         clDebug.debug(0,"Set maxpos to %f of module %i on device %s", fMaxPos, iModuleId, acDeviceName);
00312                 }
00313                 util_searchString(acModule, "MaxDeltaPos", "not available", acBuffer, 128, acFileName);
00314                 if(strcmp(acBuffer, "not available") != 0)
00315                 {
00316                         fMaxDeltaPos = atof(acBuffer);
00317                         iRetVal = PCube_setMaxDeltaPos(iDeviceId, iModuleId, fMaxDeltaPos);
00318                         if(iRetVal < 0)
00319                         {
00320                                 clDebug.debug(0,"Cound not set maxdeltapos of module %i on device %s", iModuleId, acDeviceName);
00321                                 return iRetVal;
00322                         }
00323                         clDebug.debug(0,"Set maxdeltapos to %f of module %i on device %s", fMaxDeltaPos, iModuleId, acDeviceName);
00324                 }
00325                 util_searchString(acModule, "MaxVel", "not available", acBuffer, 128, acFileName);
00326                 if(strcmp(acBuffer, "not available") != 0)
00327                 {
00328                         fMaxVel = atof(acBuffer);
00329                         iRetVal = PCube_setMaxVel(iDeviceId, iModuleId, fMaxVel);
00330                         if(iRetVal < 0)
00331                         {
00332                                 clDebug.debug(0,"Cound not set maxvel of module %i on device %s", iModuleId, acDeviceName);
00333                                 return iRetVal;
00334                         }
00335                         clDebug.debug(0,"Set maxvel to %f of module %i on device %s", fMaxVel, iModuleId, acDeviceName);
00336                 }
00337                 util_searchString(acModule, "MaxAcc", "not available", acBuffer, 128, acFileName);
00338                 if(strcmp(acBuffer, "not available") != 0)
00339                 {
00340                         fMaxAcc = atof(acBuffer);
00341                         iRetVal = PCube_setMaxAcc(iDeviceId, iModuleId, fMaxAcc);
00342                         if(iRetVal < 0)
00343                         {
00344                                 clDebug.debug(0,"Cound not set maxacc of module %i on device %s", iModuleId, acDeviceName);
00345                                 return iRetVal;
00346                         }
00347                         clDebug.debug(0,"Set maxacc to %f of module %i on device %s", fMaxAcc, iModuleId, acDeviceName);
00348                 }
00349                 util_searchString(acModule, "MaxCur", "not available", acBuffer, 128, acFileName);
00350                 if(strcmp(acBuffer, "not available") != 0)
00351                 {
00352                         fMaxCur = atof(acBuffer);
00353                         iRetVal = PCube_setMaxCur(iDeviceId, iModuleId, fMaxCur);
00354                         if(iRetVal < 0)
00355                         {
00356                                 clDebug.debug(0,"Cound not set maxcur of module %i on device %s", iModuleId, acDeviceName);
00357                                 return iRetVal;
00358                         }
00359                         clDebug.debug(0,"Set maxcur to %f of module %i on device %s", fMaxCur, iModuleId, acDeviceName);
00360                 }
00361                 clDebug.debug(0,"Successfully config module %i on device %s ", iModuleId, acDeviceName);
00362         }
00363         return 0;
00364 }
00365 
00366 M5DLL_API int WINAPI PCube_openDevice( int* piDeviceId, const char* acInitString )
00367 {
00368         int iRetVal = 0;
00369         int i, iDeviceNumber;
00370         bool bReplace = false;
00371         CMessage clDebug("M5apiw32", g_iM5DebugLevel, g_iM5Debug, g_iM5DebugFile);
00372         if(acInitString == NULL || strlen(acInitString) == 0)
00373         {
00374                 return ERRID_DEV_NOINITSTRING;
00375         }
00376         iDeviceNumber = g_apclDevice.size();
00377         clDebug.debug(0,"number of possible devices %i", iDeviceNumber);
00378         for (i=0;i<iDeviceNumber;i++)
00379         {
00380                 clDebug.debug(0,"checking device %i", i);
00381                 if(g_apclDevice[i] != NULL)
00382                         if(strcmp(g_apclDevice[i]->getInitString(),acInitString)==0)
00383                         {
00384                                 *piDeviceId = i;
00385                                 g_aiDeviceRefCount[i]++;
00386                                 clDebug.debug(0,"using device with id %i", i);
00387                                 return 0;
00388                         }
00389         }
00390         CDevice* pclDevice = newDevice(acInitString);
00391         if(pclDevice == NULL)
00392         {
00393                 return ERRID_DEV_NODEVICENAME;
00394         }
00395         clDebug.debug(0,"created new device");
00396         pclDevice->setDebug(g_iM5Debug);
00397         pclDevice->setDebugLevel(g_iM5DebugLevel);
00398         pclDevice->setDebugFile(g_iM5DebugFile);
00399         iRetVal = pclDevice->init(acInitString);
00400         if(iRetVal != 0)
00401         {
00402                 clDebug.debug(0,"init error device");
00403                 delete pclDevice;
00404                 return iRetVal;
00405         }
00406 
00407         for (i=0;i<iDeviceNumber;i++)
00408                 if(g_apclDevice[i] == NULL)
00409                 {
00410                         g_apclDevice[i] = pclDevice;
00411                         g_aiDeviceRefCount[i] = 1;
00412                         *piDeviceId = i;
00413                         bReplace = true;
00414                         clDebug.debug(0,"replacing device with id %i", i);
00415                         break;
00416                 }
00417         if(bReplace == false)
00418         {
00419                 g_apclDevice.push_back(pclDevice);
00420                 g_aiDeviceRefCount.push_back(1);
00421                 *piDeviceId = g_apclDevice.size()-1;
00422                 clDebug.debug(0,"adding device with id %i", *piDeviceId);
00423         }
00424         return iRetVal;
00425 }
00426 
00427 M5DLL_API int WINAPI PCube_closeDevice( int iDeviceId )
00428 {       
00429         if(0 > iDeviceId || iDeviceId >= g_aiDeviceRefCount.size())
00430                 return ERRID_DEV_WRONGDEVICEID;
00431         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00432                 return ERRID_DEV_WRONGDEVICEID;
00433         if( g_apclDevice[iDeviceId] == NULL )
00434                 return ERRID_DEV_NOTINITIALIZED;
00435 
00436         g_aiDeviceRefCount[iDeviceId]--;                
00437         if (g_aiDeviceRefCount[iDeviceId]>0)
00438                 return 0;
00439 
00440         int iRetVal = g_apclDevice[iDeviceId]->exit();
00441         delete g_apclDevice[iDeviceId];
00442         g_apclDevice[iDeviceId] = NULL;
00443         return iRetVal;
00444 }
00445 
00446 M5DLL_API int WINAPI PCube_closeDevices( void )
00447 {       
00448         int i;
00449         for(i = 0; i < g_aiDeviceRefCount.size();i++)
00450                 g_aiDeviceRefCount[i] = 0;              
00451         for(i = 0; i < g_aiDeviceRefCount.size();i++)
00452                 if( g_apclDevice[i] != NULL )
00453                 {
00454                         g_apclDevice[i]->exit();
00455                         delete g_apclDevice[i];
00456                         g_apclDevice[i] = NULL;
00457                 }
00458         return 0;
00459 }
00460 
00461 M5DLL_API const char* WINAPI PCube_getDeviceRevision( int iDeviceId )
00462 {       
00463         static const char acString[] = "";
00464         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00465                 return acString;
00466         if( g_apclDevice[iDeviceId] == NULL )
00467                 return acString;
00468 
00469         return g_apclDevice[iDeviceId]->getRevision();
00470 }
00471 
00472 M5DLL_API const char* WINAPI PCube_getDeviceName( int iDeviceId )
00473 {       
00474         static const char acString[] = "";
00475         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00476                 return acString;
00477         if( g_apclDevice[iDeviceId] == NULL )
00478                 return acString;
00479 
00480         return g_apclDevice[iDeviceId]->getName();
00481 }
00482 
00483 M5DLL_API const char* WINAPI PCube_getDeviceInitString( int iDeviceId )
00484 {       
00485         static const char acString[] = "";
00486         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00487                 return acString;
00488         if( g_apclDevice[iDeviceId] == NULL )
00489                 return acString;
00490 
00491         return g_apclDevice[iDeviceId]->getInitString();
00492 }
00493 
00494 M5DLL_API int WINAPI PCube_setDeviceName( int iDeviceId, const char* acDeviceName )
00495 {       
00496         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00497                 return ERRID_DEV_WRONGDEVICEID;
00498         if( g_apclDevice[iDeviceId] == NULL )
00499                 return ERRID_DEV_NOTINITIALIZED;
00500 
00501         g_apclDevice[iDeviceId]->setName(acDeviceName);
00502         return 0;
00503 }
00504 
00505 M5DLL_API int WINAPI PCube_setDeviceDebug( int iDeviceId, int iDebug, int iDebugLevel, int iDebugFile )
00506 {       
00507         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00508                 return ERRID_DEV_WRONGDEVICEID;
00509         if( g_apclDevice[iDeviceId] == NULL )
00510                 return ERRID_DEV_NOTINITIALIZED;
00511 
00512         g_apclDevice[iDeviceId]->setDebug(iDebug);
00513         g_apclDevice[iDeviceId]->setDebugLevel(iDebugLevel);
00514         g_apclDevice[iDeviceId]->setDebugFile(iDebugFile);
00515         return 0;
00516 }
00517 
00518 M5DLL_API int WINAPI PCube_getDeviceCount( void )
00519 {       
00520         int iDeviceCount = 0;
00521         for(int i = 0; i < g_apclDevice.size(); i++)
00522                 if( g_apclDevice[i] != NULL )
00523                         iDeviceCount++;
00524 
00525         return iDeviceCount;
00526 }
00527 
00528 M5DLL_API int WINAPI PCube_getDeviceIdMap( int* aiIdMap )
00529 {       
00530         int iDeviceCount = 0;
00531         for(int i = 0; i < g_apclDevice.size(); i++)
00532                 if( g_apclDevice[i] != NULL )
00533                 {
00534                         *(aiIdMap++) = i;
00535                         iDeviceCount++;
00536                 }
00537 
00538         return iDeviceCount;
00539 }
00540 
00541 M5DLL_API int WINAPI PCube_getModuleCount( int iDeviceId )
00542 {       
00543         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00544                 return ERRID_DEV_WRONGDEVICEID;
00545         if( g_apclDevice[iDeviceId] == NULL )
00546                 return ERRID_DEV_NOTINITIALIZED;
00547 
00548         return g_apclDevice[iDeviceId]->getModuleCount();
00549 }
00550 
00551 M5DLL_API int WINAPI PCube_getModuleIdMap( int iDeviceId, int* aiIdMap )
00552 {       
00553         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00554                 return ERRID_DEV_WRONGDEVICEID;
00555         if( g_apclDevice[iDeviceId] == NULL )
00556                 return ERRID_DEV_NOTINITIALIZED;
00557 
00558         int i;
00559         static std::vector<int> aiModules;
00560         int iRetVal = g_apclDevice[iDeviceId]->getModuleIdMap(aiModules);
00561         for(i = 0; i < aiModules.size(); i++)
00562                 *(aiIdMap++) = aiModules[i];
00563         for(i = aiModules.size(); i < MAX_MODULES; i++)
00564                 *(aiIdMap++) = 0;
00565         return iRetVal;
00566 }
00567 
00568 M5DLL_API int WINAPI PCube_getModuleState( int iDeviceId, int iModuleId, unsigned long* puiState )
00569 {       
00570         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00571                 return ERRID_DEV_WRONGDEVICEID;
00572         if( g_apclDevice[iDeviceId] == NULL )
00573                 return ERRID_DEV_NOTINITIALIZED;
00574 
00575         int iRetVal = g_apclDevice[iDeviceId]->getModuleState( iModuleId, puiState );
00576 
00577         return iRetVal;
00578 }
00579 
00580 M5DLL_API int WINAPI PCube_getModuleType( int iDeviceId, int iModuleId, unsigned char* pucValue )
00581 {       
00582         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00583                 return ERRID_DEV_WRONGDEVICEID;
00584         if( g_apclDevice[iDeviceId] == NULL )
00585                 return ERRID_DEV_NOTINITIALIZED;
00586 
00587         int iRetVal = g_apclDevice[iDeviceId]->getModuleType( iModuleId, pucValue );
00588 
00589         return iRetVal;
00590 }
00591 
00592 M5DLL_API int WINAPI PCube_getModuleVersion( int iDeviceId, int iModuleId, unsigned short* puiValue )
00593 {       
00594         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00595                 return ERRID_DEV_WRONGDEVICEID;
00596         if( g_apclDevice[iDeviceId] == NULL )
00597                 return ERRID_DEV_NOTINITIALIZED;
00598 
00599         int iRetVal = g_apclDevice[iDeviceId]->getModuleVersion( iModuleId, puiValue );
00600 
00601         return iRetVal;
00602 }
00603 
00604 M5DLL_API int WINAPI PCube_getModuleSerialNo( int iDeviceId, int iModuleId, unsigned long* puiValue )
00605 {       
00606         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00607                 return ERRID_DEV_WRONGDEVICEID;
00608         if( g_apclDevice[iDeviceId] == NULL )
00609                 return ERRID_DEV_NOTINITIALIZED;
00610 
00611         int iRetVal = g_apclDevice[iDeviceId]->getModuleSerialNo( iModuleId, puiValue );
00612 
00613         return iRetVal;
00614 }
00615 
00616 M5DLL_API int WINAPI PCube_getDefConfig( int iDeviceId, int iModuleId, unsigned long* puiValue )
00617 {       
00618         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00619                 return ERRID_DEV_WRONGDEVICEID;
00620         if( g_apclDevice[iDeviceId] == NULL )
00621                 return ERRID_DEV_NOTINITIALIZED;
00622 
00623         int iRetVal = g_apclDevice[iDeviceId]->getDefConfig( iModuleId, puiValue );
00624 
00625         return iRetVal;
00626 }
00627 
00628 M5DLL_API int WINAPI PCube_getDefSetup( int iDeviceId, int iModuleId, unsigned long* puiValue )
00629 {       
00630         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00631                 return ERRID_DEV_WRONGDEVICEID;
00632         if( g_apclDevice[iDeviceId] == NULL )
00633                 return ERRID_DEV_NOTINITIALIZED;
00634 
00635         int iRetVal = g_apclDevice[iDeviceId]->getDefSetup( iModuleId, puiValue );
00636 
00637         return iRetVal;
00638 }
00639 
00640 M5DLL_API int WINAPI PCube_getDefBaudRate( int iDeviceId, int iModuleId, unsigned char* pucValue )
00641 {       
00642         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00643                 return ERRID_DEV_WRONGDEVICEID;
00644         if( g_apclDevice[iDeviceId] == NULL )
00645                 return ERRID_DEV_NOTINITIALIZED;
00646 
00647         int iRetVal = g_apclDevice[iDeviceId]->getDefBaudRate( iModuleId, pucValue );
00648 
00649         return iRetVal;
00650 }
00651 
00652 M5DLL_API int WINAPI PCube_getDefBurnCount( int iDeviceId, int iModuleId, unsigned char* pucValue )
00653 {       
00654         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00655                 return ERRID_DEV_WRONGDEVICEID;
00656         if( g_apclDevice[iDeviceId] == NULL )
00657                 return ERRID_DEV_NOTINITIALIZED;
00658 
00659         int iRetVal = g_apclDevice[iDeviceId]->getDefBurnCount( iModuleId, pucValue );
00660 
00661         return iRetVal;
00662 }
00663 
00664 M5DLL_API int WINAPI PCube_getDefGearRatio( int iDeviceId, int iModuleId, float* pfValue )
00665 {       
00666         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00667                 return ERRID_DEV_WRONGDEVICEID;
00668         if( g_apclDevice[iDeviceId] == NULL )
00669                 return ERRID_DEV_NOTINITIALIZED;
00670 
00671         int iRetVal = g_apclDevice[iDeviceId]->getDefGearRatio( iModuleId, pfValue );
00672 
00673         return iRetVal;
00674 }
00675 
00676 M5DLL_API int WINAPI PCube_getDefLinearRatio( int iDeviceId, int iModuleId, float* pfValue )
00677 {       
00678         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00679                 return ERRID_DEV_WRONGDEVICEID;
00680         if( g_apclDevice[iDeviceId] == NULL )
00681                 return ERRID_DEV_NOTINITIALIZED;
00682 
00683         int iRetVal = g_apclDevice[iDeviceId]->getDefLinearRatio( iModuleId, pfValue );
00684 
00685         return iRetVal;
00686 }
00687 
00688 M5DLL_API int WINAPI PCube_getDefCurRatio( int iDeviceId, int iModuleId, float* pfValue )
00689 {       
00690         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00691                 return ERRID_DEV_WRONGDEVICEID;
00692         if( g_apclDevice[iDeviceId] == NULL )
00693                 return ERRID_DEV_NOTINITIALIZED;
00694 
00695         int iRetVal = g_apclDevice[iDeviceId]->getDefCurRatio( iModuleId, pfValue );
00696 
00697         return iRetVal;
00698 }
00699 
00700 M5DLL_API int WINAPI PCube_getDefBrakeTimeOut( int iDeviceId, int iModuleId, unsigned short* puiValue )
00701 {       
00702         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00703                 return ERRID_DEV_WRONGDEVICEID;
00704         if( g_apclDevice[iDeviceId] == NULL )
00705                 return ERRID_DEV_NOTINITIALIZED;
00706 
00707         int iRetVal = g_apclDevice[iDeviceId]->getDefBrakeTimeOut( iModuleId, puiValue );
00708 
00709         return iRetVal;
00710 }
00711 
00712 M5DLL_API int WINAPI PCube_getDefIncPerTurn( int iDeviceId, int iModuleId, unsigned long* puiValue )
00713 {       
00714         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00715                 return ERRID_DEV_WRONGDEVICEID;
00716         if( g_apclDevice[iDeviceId] == NULL )
00717                 return ERRID_DEV_NOTINITIALIZED;
00718 
00719         int iRetVal = g_apclDevice[iDeviceId]->getDefIncPerTurn( iModuleId, puiValue );
00720 
00721         return iRetVal;
00722 }
00723 
00724 M5DLL_API int WINAPI PCube_getDefDioData( int iDeviceId, int iModuleId, unsigned long* puiValue )
00725 {       
00726         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00727                 return ERRID_DEV_WRONGDEVICEID;
00728         if( g_apclDevice[iDeviceId] == NULL )
00729                 return ERRID_DEV_NOTINITIALIZED;
00730 
00731         int iRetVal = g_apclDevice[iDeviceId]->getDefDioData( iModuleId, puiValue );
00732 
00733         return iRetVal;
00734 }
00735 
00736 M5DLL_API int WINAPI PCube_getDefA0( int iDeviceId, int iModuleId, short* piValue )
00737 {       
00738         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00739                 return ERRID_DEV_WRONGDEVICEID;
00740         if( g_apclDevice[iDeviceId] == NULL )
00741                 return ERRID_DEV_NOTINITIALIZED;
00742 
00743         int iRetVal = g_apclDevice[iDeviceId]->getDefA0( iModuleId, piValue );
00744 
00745         return iRetVal;
00746 }
00747 
00748 M5DLL_API int WINAPI PCube_getDefC0( int iDeviceId, int iModuleId, short* piValue )
00749 {       
00750         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00751                 return ERRID_DEV_WRONGDEVICEID;
00752         if( g_apclDevice[iDeviceId] == NULL )
00753                 return ERRID_DEV_NOTINITIALIZED;
00754 
00755         int iRetVal = g_apclDevice[iDeviceId]->getDefC0( iModuleId, piValue );
00756 
00757         return iRetVal;
00758 }
00759 
00760 M5DLL_API int WINAPI PCube_getDefDamp( int iDeviceId, int iModuleId, short* piValue )
00761 {       
00762         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00763                 return ERRID_DEV_WRONGDEVICEID;
00764         if( g_apclDevice[iDeviceId] == NULL )
00765                 return ERRID_DEV_NOTINITIALIZED;
00766 
00767         int iRetVal = g_apclDevice[iDeviceId]->getDefDamp( iModuleId, piValue );
00768 
00769         return iRetVal;
00770 }
00771 
00772 M5DLL_API int WINAPI PCube_getDefHomeOffset( int iDeviceId, int iModuleId, float* pfValue )
00773 {       
00774         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00775                 return ERRID_DEV_WRONGDEVICEID;
00776         if( g_apclDevice[iDeviceId] == NULL )
00777                 return ERRID_DEV_NOTINITIALIZED;
00778 
00779         int iRetVal = g_apclDevice[iDeviceId]->getDefHomeOffset( iModuleId, pfValue );
00780 
00781         return iRetVal;
00782 }
00783 
00784 M5DLL_API int WINAPI PCube_getDefHomeVel( int iDeviceId, int iModuleId, float* pfValue )
00785 {       
00786         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00787                 return ERRID_DEV_WRONGDEVICEID;
00788         if( g_apclDevice[iDeviceId] == NULL )
00789                 return ERRID_DEV_NOTINITIALIZED;
00790 
00791         int iRetVal = g_apclDevice[iDeviceId]->getDefHomeVel( iModuleId, pfValue );
00792 
00793         return iRetVal;
00794 }
00795 
00796 M5DLL_API int WINAPI PCube_getDefMinPos( int iDeviceId, int iModuleId, float* pfValue )
00797 {       
00798         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00799                 return ERRID_DEV_WRONGDEVICEID;
00800         if( g_apclDevice[iDeviceId] == NULL )
00801                 return ERRID_DEV_NOTINITIALIZED;
00802 
00803         int iRetVal = g_apclDevice[iDeviceId]->getDefMinPos( iModuleId, pfValue );
00804 
00805         return iRetVal;
00806 }
00807 
00808 M5DLL_API int WINAPI PCube_getDefMaxPos( int iDeviceId, int iModuleId, float* pfValue )
00809 {       
00810         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00811                 return ERRID_DEV_WRONGDEVICEID;
00812         if( g_apclDevice[iDeviceId] == NULL )
00813                 return ERRID_DEV_NOTINITIALIZED;
00814 
00815         int iRetVal = g_apclDevice[iDeviceId]->getDefMaxPos( iModuleId, pfValue );
00816 
00817         return iRetVal;
00818 }
00819 
00820 M5DLL_API int WINAPI PCube_getDefMaxVel( int iDeviceId, int iModuleId, float* pfValue )
00821 {       
00822         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00823                 return ERRID_DEV_WRONGDEVICEID;
00824         if( g_apclDevice[iDeviceId] == NULL )
00825                 return ERRID_DEV_NOTINITIALIZED;
00826 
00827         int iRetVal = g_apclDevice[iDeviceId]->getDefMaxVel( iModuleId, pfValue );
00828 
00829         return iRetVal;
00830 }
00831 
00832 M5DLL_API int WINAPI PCube_getDefMaxAcc( int iDeviceId, int iModuleId, float* pfValue )
00833 {       
00834         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00835                 return ERRID_DEV_WRONGDEVICEID;
00836         if( g_apclDevice[iDeviceId] == NULL )
00837                 return ERRID_DEV_NOTINITIALIZED;
00838 
00839         int iRetVal = g_apclDevice[iDeviceId]->getDefMaxAcc( iModuleId, pfValue );
00840 
00841         return iRetVal;
00842 }
00843 
00844 M5DLL_API int WINAPI PCube_getDefMaxCur( int iDeviceId, int iModuleId, float* pfValue )
00845 {       
00846         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00847                 return ERRID_DEV_WRONGDEVICEID;
00848         if( g_apclDevice[iDeviceId] == NULL )
00849                 return ERRID_DEV_NOTINITIALIZED;
00850 
00851         int iRetVal = g_apclDevice[iDeviceId]->getDefMaxCur( iModuleId, pfValue );
00852 
00853         return iRetVal;
00854 }
00855 
00856 M5DLL_API int WINAPI PCube_getDefMaxDeltaPos( int iDeviceId, int iModuleId, float* pfValue )
00857 {       
00858         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00859                 return ERRID_DEV_WRONGDEVICEID;
00860         if( g_apclDevice[iDeviceId] == NULL )
00861                 return ERRID_DEV_NOTINITIALIZED;
00862 
00863         int iRetVal = g_apclDevice[iDeviceId]->getDefMaxDeltaPos( iModuleId, pfValue );
00864 
00865         return iRetVal;
00866 }
00867 
00868 M5DLL_API int WINAPI PCube_getConfig( int iDeviceId, int iModuleId, unsigned long* puiValue )
00869 {       
00870         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00871                 return ERRID_DEV_WRONGDEVICEID;
00872         if( g_apclDevice[iDeviceId] == NULL )
00873                 return ERRID_DEV_NOTINITIALIZED;
00874 
00875         int iRetVal = g_apclDevice[iDeviceId]->getConfig( iModuleId, puiValue );
00876 
00877         return iRetVal;
00878 }
00879 
00880 M5DLL_API int WINAPI PCube_getHomeOffset( int iDeviceId, int iModuleId, float* pValue )
00881 {       
00882         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00883                 return ERRID_DEV_WRONGDEVICEID;
00884         if( g_apclDevice[iDeviceId] == NULL )
00885                 return ERRID_DEV_NOTINITIALIZED;
00886 
00887         int iRetVal = g_apclDevice[iDeviceId]->getHomeOffset( iModuleId, pValue );
00888 
00889         return iRetVal;
00890 }
00891 
00892 M5DLL_API int WINAPI PCube_getHomeOffsetInc( int iDeviceId, int iModuleId, long* piValue )
00893 {       
00894         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00895                 return ERRID_DEV_WRONGDEVICEID;
00896         if( g_apclDevice[iDeviceId] == NULL )
00897                 return ERRID_DEV_NOTINITIALIZED;
00898 
00899         int iRetVal = g_apclDevice[iDeviceId]->getHomeOffsetInc( iModuleId, piValue );
00900 
00901         return iRetVal;
00902 }
00903 
00904 M5DLL_API int WINAPI PCube_getIncRatio( int iDeviceId, int iModuleId, float* pValue )
00905 {       
00906         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00907                 return ERRID_DEV_WRONGDEVICEID;
00908         if( g_apclDevice[iDeviceId] == NULL )
00909                 return ERRID_DEV_NOTINITIALIZED;
00910 
00911         int iRetVal = g_apclDevice[iDeviceId]->getIncRatio( iModuleId, pValue );
00912 
00913         return iRetVal;
00914 }
00915 
00916 M5DLL_API int WINAPI PCube_getDioData( int iDeviceId, int iModuleId, unsigned long* puiValue )
00917 {       
00918         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00919                 return ERRID_DEV_WRONGDEVICEID;
00920         if( g_apclDevice[iDeviceId] == NULL )
00921                 return ERRID_DEV_NOTINITIALIZED;
00922 
00923         int iRetVal = g_apclDevice[iDeviceId]->getDioData( iModuleId, puiValue );
00924 
00925         return iRetVal;
00926 }
00927 
00928 M5DLL_API int WINAPI PCube_getA0( int iDeviceId, int iModuleId, short* piValue )
00929 {       
00930         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00931                 return ERRID_DEV_WRONGDEVICEID;
00932         if( g_apclDevice[iDeviceId] == NULL )
00933                 return ERRID_DEV_NOTINITIALIZED;
00934 
00935         int iRetVal = g_apclDevice[iDeviceId]->getA0( iModuleId, piValue );
00936 
00937         return iRetVal;
00938 }
00939 
00940 M5DLL_API int WINAPI PCube_getC0( int iDeviceId, int iModuleId, short* piValue )
00941 {       
00942         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00943                 return ERRID_DEV_WRONGDEVICEID;
00944         if( g_apclDevice[iDeviceId] == NULL )
00945                 return ERRID_DEV_NOTINITIALIZED;
00946 
00947         int iRetVal = g_apclDevice[iDeviceId]->getC0( iModuleId, piValue );
00948 
00949         return iRetVal;
00950 }
00951 
00952 M5DLL_API int WINAPI PCube_getDamp( int iDeviceId, int iModuleId, short* piValue )
00953 {       
00954         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00955                 return ERRID_DEV_WRONGDEVICEID;
00956         if( g_apclDevice[iDeviceId] == NULL )
00957                 return ERRID_DEV_NOTINITIALIZED;
00958 
00959         int iRetVal = g_apclDevice[iDeviceId]->getDamp( iModuleId, piValue );
00960 
00961         return iRetVal;
00962 }
00963 
00964 M5DLL_API int WINAPI PCube_getPos( int iDeviceId, int iModuleId, float* pfPos )
00965 {       
00966         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00967                 return ERRID_DEV_WRONGDEVICEID;
00968         if( g_apclDevice[iDeviceId] == NULL )
00969                 return ERRID_DEV_NOTINITIALIZED;
00970 
00971         int iRetVal = g_apclDevice[iDeviceId]->getPos( iModuleId, pfPos );
00972 
00973         return iRetVal;
00974 }
00975 
00976 M5DLL_API int WINAPI PCube_getVel( int iDeviceId, int iModuleId, float* pfVel )
00977 {       
00978         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00979                 return ERRID_DEV_WRONGDEVICEID;
00980         if( g_apclDevice[iDeviceId] == NULL )
00981                 return ERRID_DEV_NOTINITIALIZED;
00982 
00983         int iRetVal = g_apclDevice[iDeviceId]->getVel( iModuleId, pfVel );
00984 
00985         return iRetVal;
00986 }
00987 
00988 M5DLL_API int WINAPI PCube_getCur( int iDeviceId, int iModuleId, float* pfCur )
00989 {       
00990         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
00991                 return ERRID_DEV_WRONGDEVICEID;
00992         if( g_apclDevice[iDeviceId] == NULL )
00993                 return ERRID_DEV_NOTINITIALIZED;
00994 
00995         int iRetVal = g_apclDevice[iDeviceId]->getCur( iModuleId, pfCur );
00996 
00997         return iRetVal;
00998 }
00999 
01000 M5DLL_API int WINAPI PCube_getMinPos( int iDeviceId, int iModuleId, float* pfValue )
01001 {       
01002         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01003                 return ERRID_DEV_WRONGDEVICEID;
01004         if( g_apclDevice[iDeviceId] == NULL )
01005                 return ERRID_DEV_NOTINITIALIZED;
01006 
01007         int iRetVal = g_apclDevice[iDeviceId]->getMinPos( iModuleId, pfValue );
01008 
01009         return iRetVal;
01010 }
01011 
01012 M5DLL_API int WINAPI PCube_getMaxPos( int iDeviceId, int iModuleId, float* pfValue )
01013 {       
01014         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01015                 return ERRID_DEV_WRONGDEVICEID;
01016         if( g_apclDevice[iDeviceId] == NULL )
01017                 return ERRID_DEV_NOTINITIALIZED;
01018 
01019         int iRetVal = g_apclDevice[iDeviceId]->getMaxPos( iModuleId, pfValue );
01020 
01021         return iRetVal;
01022 }
01023 
01024 M5DLL_API int WINAPI PCube_getMaxVel( int iDeviceId, int iModuleId, float* pfValue )
01025 {       
01026         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01027                 return ERRID_DEV_WRONGDEVICEID;
01028         if( g_apclDevice[iDeviceId] == NULL )
01029                 return ERRID_DEV_NOTINITIALIZED;
01030 
01031         int iRetVal = g_apclDevice[iDeviceId]->getMaxVel( iModuleId, pfValue );
01032 
01033         return iRetVal;
01034 }
01035 
01036 M5DLL_API int WINAPI PCube_getMaxAcc( int iDeviceId, int iModuleId, float* pfValue )
01037 {       
01038         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01039                 return ERRID_DEV_WRONGDEVICEID;
01040         if( g_apclDevice[iDeviceId] == NULL )
01041                 return ERRID_DEV_NOTINITIALIZED;
01042 
01043         int iRetVal = g_apclDevice[iDeviceId]->getMaxAcc( iModuleId, pfValue );
01044 
01045         return iRetVal;
01046 }
01047 
01048 M5DLL_API int WINAPI PCube_getMaxCur( int iDeviceId, int iModuleId, float* pfValue )
01049 {       
01050         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01051                 return ERRID_DEV_WRONGDEVICEID;
01052         if( g_apclDevice[iDeviceId] == NULL )
01053                 return ERRID_DEV_NOTINITIALIZED;
01054 
01055         int iRetVal = g_apclDevice[iDeviceId]->getMaxCur( iModuleId, pfValue );
01056 
01057         return iRetVal;
01058 }
01059 
01060 M5DLL_API int WINAPI PCube_getDeltaPos( int iDeviceId, int iModuleId, float* pfValue )
01061 {       
01062         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01063                 return ERRID_DEV_WRONGDEVICEID;
01064         if( g_apclDevice[iDeviceId] == NULL )
01065                 return ERRID_DEV_NOTINITIALIZED;
01066 
01067         int iRetVal = g_apclDevice[iDeviceId]->getDeltaPos( iModuleId, pfValue );
01068 
01069         return iRetVal;
01070 }
01071 
01072 M5DLL_API int WINAPI PCube_getMaxDeltaPos( int iDeviceId, int iModuleId, float* pfValue )
01073 {       
01074         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01075                 return ERRID_DEV_WRONGDEVICEID;
01076         if( g_apclDevice[iDeviceId] == NULL )
01077                 return ERRID_DEV_NOTINITIALIZED;
01078 
01079         int iRetVal = g_apclDevice[iDeviceId]->getMaxDeltaPos( iModuleId, pfValue );
01080 
01081         return iRetVal;
01082 }
01083 
01084 M5DLL_API int WINAPI PCube_getSavePos( int iDeviceId, int iModuleId, float* pfValue )
01085 {       
01086         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01087                 return ERRID_DEV_WRONGDEVICEID;
01088         if( g_apclDevice[iDeviceId] == NULL )
01089                 return ERRID_DEV_NOTINITIALIZED;
01090 
01091         int iRetVal = g_apclDevice[iDeviceId]->getSavePos( iModuleId, pfValue );
01092 
01093         return iRetVal;
01094 }
01095 
01096 M5DLL_API int WINAPI PCube_getIPolVel( int iDeviceId, int iModuleId, float* pValue )
01097 {       
01098         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01099                 return ERRID_DEV_WRONGDEVICEID;
01100         if( g_apclDevice[iDeviceId] == NULL )
01101                 return ERRID_DEV_NOTINITIALIZED;
01102 
01103         int iRetVal = g_apclDevice[iDeviceId]->getIPolVel( iModuleId, pValue );
01104 
01105         return iRetVal;
01106 }
01107 
01108 M5DLL_API int WINAPI PCube_getPosCountInc( int iDeviceId, int iModuleId, long* piValue )
01109 {       
01110         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01111                 return ERRID_DEV_WRONGDEVICEID;
01112         if( g_apclDevice[iDeviceId] == NULL )
01113                 return ERRID_DEV_NOTINITIALIZED;
01114 
01115         int iRetVal = g_apclDevice[iDeviceId]->getPosCountInc( iModuleId, piValue );
01116 
01117         return iRetVal;
01118 }
01119 
01120 M5DLL_API int WINAPI PCube_getPosInc( int iDeviceId, int iModuleId, long* piValue )
01121 {       
01122         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01123                 return ERRID_DEV_WRONGDEVICEID;
01124         if( g_apclDevice[iDeviceId] == NULL )
01125                 return ERRID_DEV_NOTINITIALIZED;
01126 
01127         int iRetVal = g_apclDevice[iDeviceId]->getPosInc( iModuleId, piValue );
01128 
01129         return iRetVal;
01130 }
01131 
01132 M5DLL_API int WINAPI PCube_getVelInc( int iDeviceId, int iModuleId, long* piValue )
01133 {       
01134         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01135                 return ERRID_DEV_WRONGDEVICEID;
01136         if( g_apclDevice[iDeviceId] == NULL )
01137                 return ERRID_DEV_NOTINITIALIZED;
01138 
01139         int iRetVal = g_apclDevice[iDeviceId]->getVelInc( iModuleId, piValue );
01140 
01141         return iRetVal;
01142 }
01143 
01144 M5DLL_API int WINAPI PCube_getCurInc( int iDeviceId, int iModuleId, short* piValue )
01145 {       
01146         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01147                 return ERRID_DEV_WRONGDEVICEID;
01148         if( g_apclDevice[iDeviceId] == NULL )
01149                 return ERRID_DEV_NOTINITIALIZED;
01150 
01151         int iRetVal = g_apclDevice[iDeviceId]->getCurInc( iModuleId, piValue );
01152 
01153         return iRetVal;
01154 }
01155 
01156 M5DLL_API int WINAPI PCube_getMinPosInc( int iDeviceId, int iModuleId, long* piValue )
01157 {       
01158         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01159                 return ERRID_DEV_WRONGDEVICEID;
01160         if( g_apclDevice[iDeviceId] == NULL )
01161                 return ERRID_DEV_NOTINITIALIZED;
01162 
01163         int iRetVal = g_apclDevice[iDeviceId]->getMinPosInc( iModuleId, piValue );
01164 
01165         return iRetVal;
01166 }
01167 
01168 M5DLL_API int WINAPI PCube_getMaxPosInc( int iDeviceId, int iModuleId, long* piValue )
01169 {       
01170         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01171                 return ERRID_DEV_WRONGDEVICEID;
01172         if( g_apclDevice[iDeviceId] == NULL )
01173                 return ERRID_DEV_NOTINITIALIZED;
01174 
01175         int iRetVal = g_apclDevice[iDeviceId]->getMaxPosInc( iModuleId, piValue );
01176 
01177         return iRetVal;
01178 }
01179 
01180 M5DLL_API int WINAPI PCube_getMaxVelInc( int iDeviceId, int iModuleId, long* piValue )
01181 {       
01182         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01183                 return ERRID_DEV_WRONGDEVICEID;
01184         if( g_apclDevice[iDeviceId] == NULL )
01185                 return ERRID_DEV_NOTINITIALIZED;
01186 
01187         int iRetVal = g_apclDevice[iDeviceId]->getMaxVelInc( iModuleId, piValue );
01188 
01189         return iRetVal;
01190 }
01191 
01192 M5DLL_API int WINAPI PCube_getMaxAccInc( int iDeviceId, int iModuleId, long* piValue )
01193 {       
01194         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01195                 return ERRID_DEV_WRONGDEVICEID;
01196         if( g_apclDevice[iDeviceId] == NULL )
01197                 return ERRID_DEV_NOTINITIALIZED;
01198 
01199         int iRetVal = g_apclDevice[iDeviceId]->getMaxAccInc( iModuleId, piValue );
01200 
01201         return iRetVal;
01202 }
01203 
01204 M5DLL_API int WINAPI PCube_getDeltaPosInc( int iDeviceId, int iModuleId, long* piValue )
01205 {       
01206         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01207                 return ERRID_DEV_WRONGDEVICEID;
01208         if( g_apclDevice[iDeviceId] == NULL )
01209                 return ERRID_DEV_NOTINITIALIZED;
01210 
01211         int iRetVal = g_apclDevice[iDeviceId]->getDeltaPosInc( iModuleId, piValue );
01212 
01213         return iRetVal;
01214 }
01215 
01216 M5DLL_API int WINAPI PCube_getMaxDeltaPosInc( int iDeviceId, int iModuleId, long* piValue )
01217 {       
01218         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01219                 return ERRID_DEV_WRONGDEVICEID;
01220         if( g_apclDevice[iDeviceId] == NULL )
01221                 return ERRID_DEV_NOTINITIALIZED;
01222 
01223         int iRetVal = g_apclDevice[iDeviceId]->getMaxDeltaPosInc( iModuleId, piValue );
01224 
01225         return iRetVal;
01226 }
01227 
01228 M5DLL_API int WINAPI PCube_getStateDioPos( int iDeviceId, int iModuleId, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01229 {       
01230         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01231                 return ERRID_DEV_WRONGDEVICEID;
01232         if( g_apclDevice[iDeviceId] == NULL )
01233                 return ERRID_DEV_NOTINITIALIZED;
01234 
01235         int iRetVal = g_apclDevice[iDeviceId]->getStateDioPos( iModuleId, puiState, pucDio, pfPos);
01236 
01237         return iRetVal;
01238 }
01239 
01240 M5DLL_API int WINAPI PCube_getHomeVel( int iDeviceId, int iModuleId, float* pValue )
01241 {       
01242         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01243                 return ERRID_DEV_WRONGDEVICEID;
01244         if( g_apclDevice[iDeviceId] == NULL )
01245                 return ERRID_DEV_NOTINITIALIZED;
01246 
01247         int iRetVal = g_apclDevice[iDeviceId]->getHomeVel( iModuleId, pValue );
01248 
01249         return iRetVal;
01250 }
01251 
01252 M5DLL_API int WINAPI PCube_getHomeVelInc( int iDeviceId, int iModuleId, long* piValue )
01253 {       
01254         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01255                 return ERRID_DEV_WRONGDEVICEID;
01256         if( g_apclDevice[iDeviceId] == NULL )
01257                 return ERRID_DEV_NOTINITIALIZED;
01258 
01259         int iRetVal = g_apclDevice[iDeviceId]->getHomeVelInc( iModuleId, piValue );
01260 
01261         return iRetVal;
01262 }
01263 
01264 M5DLL_API int WINAPI PCube_getSyncTime( int iDeviceId, int iModuleId, short* piValue )
01265 {       
01266         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01267                 return ERRID_DEV_WRONGDEVICEID;
01268         if( g_apclDevice[iDeviceId] == NULL )
01269                 return ERRID_DEV_NOTINITIALIZED;
01270 
01271         int iRetVal = g_apclDevice[iDeviceId]->getSyncTime( iModuleId, piValue );
01272 
01273         return iRetVal;
01274 }
01275 
01276 M5DLL_API int WINAPI PCube_setConfig( int iDeviceId, int iModuleId, unsigned long puiValue )
01277 {       
01278         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01279                 return ERRID_DEV_WRONGDEVICEID;
01280         if( g_apclDevice[iDeviceId] == NULL )
01281                 return ERRID_DEV_NOTINITIALIZED;
01282 
01283         int iRetVal = g_apclDevice[iDeviceId]->setConfig( iModuleId, puiValue );
01284 
01285         return iRetVal;
01286 }
01287 
01288 M5DLL_API int WINAPI PCube_setHomeOffset( int iDeviceId, int iModuleId, float fValue )
01289 {       
01290         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01291                 return ERRID_DEV_WRONGDEVICEID;
01292         if( g_apclDevice[iDeviceId] == NULL )
01293                 return ERRID_DEV_NOTINITIALIZED;
01294 
01295         int iRetVal = g_apclDevice[iDeviceId]->setHomeOffset( iModuleId, fValue );
01296 
01297         return iRetVal;
01298 }
01299 
01300 M5DLL_API int WINAPI PCube_setHomeOffsetInc( int iDeviceId, int iModuleId, long iValue )
01301 {       
01302         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01303                 return ERRID_DEV_WRONGDEVICEID;
01304         if( g_apclDevice[iDeviceId] == NULL )
01305                 return ERRID_DEV_NOTINITIALIZED;
01306 
01307         int iRetVal = g_apclDevice[iDeviceId]->setHomeOffsetInc( iModuleId, iValue );
01308 
01309         return iRetVal;
01310 }
01311 
01312 M5DLL_API int WINAPI PCube_setDioData( int iDeviceId, int iModuleId, unsigned long uiValue )
01313 {       
01314         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01315                 return ERRID_DEV_WRONGDEVICEID;
01316         if( g_apclDevice[iDeviceId] == NULL )
01317                 return ERRID_DEV_NOTINITIALIZED;
01318 
01319         int iRetVal = g_apclDevice[iDeviceId]->setDioData( iModuleId, uiValue );
01320 
01321         return iRetVal;
01322 }
01323 
01324 M5DLL_API int WINAPI PCube_setA0( int iDeviceId, int iModuleId, short iValue )
01325 {       
01326         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01327                 return ERRID_DEV_WRONGDEVICEID;
01328         if( g_apclDevice[iDeviceId] == NULL )
01329                 return ERRID_DEV_NOTINITIALIZED;
01330 
01331         int iRetVal = g_apclDevice[iDeviceId]->setA0( iModuleId, iValue );
01332 
01333         return iRetVal;
01334 }
01335 
01336 M5DLL_API int WINAPI PCube_setC0( int iDeviceId, int iModuleId, short iValue )
01337 {       
01338         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01339                 return ERRID_DEV_WRONGDEVICEID;
01340         if( g_apclDevice[iDeviceId] == NULL )
01341                 return ERRID_DEV_NOTINITIALIZED;
01342 
01343         int iRetVal = g_apclDevice[iDeviceId]->setC0( iModuleId, iValue );
01344 
01345         return iRetVal;
01346 }
01347 
01348 M5DLL_API int WINAPI PCube_setDamp( int iDeviceId, int iModuleId, short iValue )
01349 {       
01350         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01351                 return ERRID_DEV_WRONGDEVICEID;
01352         if( g_apclDevice[iDeviceId] == NULL )
01353                 return ERRID_DEV_NOTINITIALIZED;
01354 
01355         int iRetVal = g_apclDevice[iDeviceId]->setDamp( iModuleId, iValue );
01356 
01357         return iRetVal;
01358 }
01359 
01360 M5DLL_API int WINAPI PCube_setMinPos( int iDeviceId, int iModuleId, float fValue )
01361 {       
01362         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01363                 return ERRID_DEV_WRONGDEVICEID;
01364         if( g_apclDevice[iDeviceId] == NULL )
01365                 return ERRID_DEV_NOTINITIALIZED;
01366 
01367         int iRetVal = g_apclDevice[iDeviceId]->setMinPos( iModuleId, fValue );
01368 
01369         return iRetVal;
01370 }
01371 
01372 M5DLL_API int WINAPI PCube_setMaxPos( int iDeviceId, int iModuleId, float fValue )
01373 {       
01374         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01375                 return ERRID_DEV_WRONGDEVICEID;
01376         if( g_apclDevice[iDeviceId] == NULL )
01377                 return ERRID_DEV_NOTINITIALIZED;
01378 
01379         int iRetVal = g_apclDevice[iDeviceId]->setMaxPos( iModuleId, fValue );
01380 
01381         return iRetVal;
01382 }
01383 
01384 M5DLL_API int WINAPI PCube_setMaxVel( int iDeviceId, int iModuleId, float fValue )
01385 {       
01386         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01387                 return ERRID_DEV_WRONGDEVICEID;
01388         if( g_apclDevice[iDeviceId] == NULL )
01389                 return ERRID_DEV_NOTINITIALIZED;
01390 
01391         int iRetVal = g_apclDevice[iDeviceId]->setMaxVel( iModuleId, fValue );
01392 
01393         return iRetVal;
01394 }
01395 
01396 M5DLL_API int WINAPI PCube_setMaxAcc( int iDeviceId, int iModuleId, float fValue )
01397 {       
01398         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01399                 return ERRID_DEV_WRONGDEVICEID;
01400         if( g_apclDevice[iDeviceId] == NULL )
01401                 return ERRID_DEV_NOTINITIALIZED;
01402 
01403         int iRetVal = g_apclDevice[iDeviceId]->setMaxAcc( iModuleId, fValue );
01404 
01405         return iRetVal;
01406 }
01407 
01408 M5DLL_API int WINAPI PCube_setMaxCur( int iDeviceId, int iModuleId, float fValue )
01409 {       
01410         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01411                 return ERRID_DEV_WRONGDEVICEID;
01412         if( g_apclDevice[iDeviceId] == NULL )
01413                 return ERRID_DEV_NOTINITIALIZED;
01414 
01415         int iRetVal = g_apclDevice[iDeviceId]->setMaxCur( iModuleId, fValue );
01416 
01417         return iRetVal;
01418 }
01419 
01420 M5DLL_API int WINAPI PCube_setMaxDeltaPos( int iDeviceId, int iModuleId, float fValue )
01421 {       
01422         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01423                 return ERRID_DEV_WRONGDEVICEID;
01424         if( g_apclDevice[iDeviceId] == NULL )
01425                 return ERRID_DEV_NOTINITIALIZED;
01426 
01427         int iRetVal = g_apclDevice[iDeviceId]->setMaxDeltaPos( iModuleId, fValue );
01428 
01429         return iRetVal;
01430 }
01431 
01432 M5DLL_API int WINAPI PCube_setMinPosInc( int iDeviceId, int iModuleId, long iValue )
01433 {       
01434         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01435                 return ERRID_DEV_WRONGDEVICEID;
01436         if( g_apclDevice[iDeviceId] == NULL )
01437                 return ERRID_DEV_NOTINITIALIZED;
01438 
01439         int iRetVal = g_apclDevice[iDeviceId]->setMinPosInc( iModuleId, iValue );
01440 
01441         return iRetVal;
01442 }
01443 
01444 M5DLL_API int WINAPI PCube_setMaxPosInc( int iDeviceId, int iModuleId, long iValue )
01445 {       
01446         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01447                 return ERRID_DEV_WRONGDEVICEID;
01448         if( g_apclDevice[iDeviceId] == NULL )
01449                 return ERRID_DEV_NOTINITIALIZED;
01450 
01451         int iRetVal = g_apclDevice[iDeviceId]->setMaxPosInc( iModuleId, iValue );
01452 
01453         return iRetVal;
01454 }
01455 
01456 M5DLL_API int WINAPI PCube_setMaxVelInc( int iDeviceId, int iModuleId, long iValue )
01457 {       
01458         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01459                 return ERRID_DEV_WRONGDEVICEID;
01460         if( g_apclDevice[iDeviceId] == NULL )
01461                 return ERRID_DEV_NOTINITIALIZED;
01462 
01463         int iRetVal = g_apclDevice[iDeviceId]->setMaxVelInc( iModuleId, iValue );
01464 
01465         return iRetVal;
01466 }
01467 
01468 M5DLL_API int WINAPI PCube_setMaxAccInc( int iDeviceId, int iModuleId, long iValue )
01469 {       
01470         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01471                 return ERRID_DEV_WRONGDEVICEID;
01472         if( g_apclDevice[iDeviceId] == NULL )
01473                 return ERRID_DEV_NOTINITIALIZED;
01474 
01475         int iRetVal = g_apclDevice[iDeviceId]->setMaxAccInc( iModuleId, iValue );
01476 
01477         return iRetVal;
01478 }
01479 
01480 M5DLL_API int WINAPI PCube_setMaxDeltaPosInc( int iDeviceId, int iModuleId, long iValue )
01481 {       
01482         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01483                 return ERRID_DEV_WRONGDEVICEID;
01484         if( g_apclDevice[iDeviceId] == NULL )
01485                 return ERRID_DEV_NOTINITIALIZED;
01486 
01487         int iRetVal = g_apclDevice[iDeviceId]->setMaxDeltaPosInc( iModuleId, iValue );
01488 
01489         return iRetVal;
01490 }
01491 
01492 M5DLL_API int WINAPI PCube_setHomeVel( int iDeviceId, int iModuleId, float fValue )                     
01493 {       
01494         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01495                 return ERRID_DEV_WRONGDEVICEID;
01496         if( g_apclDevice[iDeviceId] == NULL )
01497                 return ERRID_DEV_NOTINITIALIZED;
01498 
01499         int iRetVal = g_apclDevice[iDeviceId]->setHomeVel( iModuleId, fValue );
01500 
01501         return iRetVal;
01502 }
01503 
01504 M5DLL_API int WINAPI PCube_setHomeVelInc( int iDeviceId, int iModuleId, long iValue )
01505 {       
01506         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01507                 return ERRID_DEV_WRONGDEVICEID;
01508         if( g_apclDevice[iDeviceId] == NULL )
01509                 return ERRID_DEV_NOTINITIALIZED;
01510 
01511         int iRetVal = g_apclDevice[iDeviceId]->setHomeVelInc( iModuleId, iValue );
01512 
01513         return iRetVal;
01514 }
01515 
01516 M5DLL_API int WINAPI PCube_setRampVel( int iDeviceId, int iModuleId, float fValue )                     
01517 {       
01518         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01519                 return ERRID_DEV_WRONGDEVICEID;
01520         if( g_apclDevice[iDeviceId] == NULL )
01521                 return ERRID_DEV_NOTINITIALIZED;
01522 
01523         int iRetVal = g_apclDevice[iDeviceId]->setRampVel( iModuleId, fValue );
01524 
01525         return iRetVal;
01526 }
01527 
01528 M5DLL_API int WINAPI PCube_setRampVelInc( int iDeviceId, int iModuleId, long iValue )
01529 {       
01530         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01531                 return ERRID_DEV_WRONGDEVICEID;
01532         if( g_apclDevice[iDeviceId] == NULL )
01533                 return ERRID_DEV_NOTINITIALIZED;
01534 
01535         int iRetVal = g_apclDevice[iDeviceId]->setRampVelInc( iModuleId, iValue );
01536 
01537         return iRetVal;
01538 }
01539 
01540 M5DLL_API int WINAPI PCube_setRampAcc( int iDeviceId, int iModuleId, float fValue )                     
01541 {       
01542         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01543                 return ERRID_DEV_WRONGDEVICEID;
01544         if( g_apclDevice[iDeviceId] == NULL )
01545                 return ERRID_DEV_NOTINITIALIZED;
01546 
01547         int iRetVal = g_apclDevice[iDeviceId]->setRampAcc( iModuleId, fValue );
01548 
01549         return iRetVal;
01550 }
01551 
01552 M5DLL_API int WINAPI PCube_setRampAccInc( int iDeviceId, int iModuleId, long iValue )
01553 {       
01554         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01555                 return ERRID_DEV_WRONGDEVICEID;
01556         if( g_apclDevice[iDeviceId] == NULL )
01557                 return ERRID_DEV_NOTINITIALIZED;
01558 
01559         int iRetVal = g_apclDevice[iDeviceId]->setRampAccInc( iModuleId, iValue );
01560 
01561         return iRetVal;
01562 }
01563 
01564 M5DLL_API int WINAPI PCube_setSyncTime( int iDeviceId, int iModuleId, short iValue )
01565 {       
01566         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01567                 return ERRID_DEV_WRONGDEVICEID;
01568         if( g_apclDevice[iDeviceId] == NULL )
01569                 return ERRID_DEV_NOTINITIALIZED;
01570 
01571         int iRetVal = g_apclDevice[iDeviceId]->setSyncTime( iModuleId, iValue );
01572 
01573         return iRetVal;
01574 }
01575 
01576 M5DLL_API int WINAPI PCube_updateModuleIdMap( int iDeviceId )
01577 {       
01578         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01579                 return ERRID_DEV_WRONGDEVICEID;
01580         if( g_apclDevice[iDeviceId] == NULL )
01581                 return ERRID_DEV_NOTINITIALIZED;
01582 
01583         int iRetVal = g_apclDevice[iDeviceId]->updateModuleIdMap();
01584 
01585         return iRetVal;
01586 }
01587 
01588 M5DLL_API int WINAPI PCube_homeModule( int iDeviceId, int iModuleId )
01589 {       
01590         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01591                 return ERRID_DEV_WRONGDEVICEID;
01592         if( g_apclDevice[iDeviceId] == NULL )
01593                 return ERRID_DEV_NOTINITIALIZED;
01594 
01595         int iRetVal = g_apclDevice[iDeviceId]->homeModule( iModuleId );
01596 
01597         return iRetVal;
01598 }
01599 
01600 M5DLL_API int WINAPI PCube_haltModule( int iDeviceId, int iModuleId )
01601 {
01602         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01603                 return ERRID_DEV_WRONGDEVICEID;
01604         if( g_apclDevice[iDeviceId] == NULL )
01605                 return ERRID_DEV_NOTINITIALIZED;
01606 
01607         int iRetVal = g_apclDevice[iDeviceId]->haltModule( iModuleId );
01608 
01609         return iRetVal;
01610 }
01611 
01612 M5DLL_API int WINAPI PCube_resetModule( int iDeviceId, int iModuleId )
01613 {
01614         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01615                 return ERRID_DEV_WRONGDEVICEID;
01616         if( g_apclDevice[iDeviceId] == NULL )
01617                 return ERRID_DEV_NOTINITIALIZED;
01618 
01619         int iRetVal = g_apclDevice[iDeviceId]->resetModule( iModuleId );
01620 
01621         return iRetVal;
01622 }
01623 
01624 M5DLL_API int WINAPI PCube_recalcPIDParams( int iDeviceId, int iModuleId )
01625 {
01626         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01627                 return ERRID_DEV_WRONGDEVICEID;
01628         if( g_apclDevice[iDeviceId] == NULL )
01629                 return ERRID_DEV_NOTINITIALIZED;
01630 
01631         int iRetVal = g_apclDevice[iDeviceId]->recalcPIDParams( iModuleId );
01632 
01633         return iRetVal;
01634 }
01635 
01636 M5DLL_API int WINAPI PCube_movePos( int iDeviceId, int iModuleId, float fPos )
01637 {
01638         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01639                 return ERRID_DEV_WRONGDEVICEID;
01640         if( g_apclDevice[iDeviceId] == NULL )
01641                 return ERRID_DEV_NOTINITIALIZED;
01642 
01643         int iRetVal = g_apclDevice[iDeviceId]->movePos( iModuleId, fPos );
01644 
01645         return iRetVal;
01646 }
01647 
01648 M5DLL_API int WINAPI PCube_moveRamp( int iDeviceId, int iModuleId, float fPos, float fVel, float fAcc )
01649 {
01650         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01651                 return ERRID_DEV_WRONGDEVICEID;
01652         if( g_apclDevice[iDeviceId] == NULL )
01653                 return ERRID_DEV_NOTINITIALIZED;
01654 
01655         int iRetVal = g_apclDevice[iDeviceId]->moveRamp( iModuleId, fPos, fVel, fAcc );
01656 
01657         return iRetVal;
01658 }
01659 
01660 M5DLL_API int WINAPI PCube_moveVel( int iDeviceId, int iModuleId, float fVel )
01661 {
01662         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01663                 return ERRID_DEV_WRONGDEVICEID;
01664         if( g_apclDevice[iDeviceId] == NULL )
01665                 return ERRID_DEV_NOTINITIALIZED;
01666 
01667         int iRetVal = g_apclDevice[iDeviceId]->moveVel( iModuleId, fVel );
01668 
01669         return iRetVal;
01670 }
01671 
01672 M5DLL_API int WINAPI PCube_moveCur( int iDeviceId, int iModuleId, float fCur )
01673 {
01674         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01675                 return ERRID_DEV_WRONGDEVICEID;
01676         if( g_apclDevice[iDeviceId] == NULL )
01677                 return ERRID_DEV_NOTINITIALIZED;
01678 
01679         int iRetVal = g_apclDevice[iDeviceId]->moveCur( iModuleId, fCur );
01680 
01681         return iRetVal;
01682 }
01683 
01684 M5DLL_API int WINAPI PCube_moveStep( int iDeviceId, int iModuleId, float fPos, unsigned short uiTime )
01685 {
01686         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01687                 return ERRID_DEV_WRONGDEVICEID;
01688         if( g_apclDevice[iDeviceId] == NULL )
01689                 return ERRID_DEV_NOTINITIALIZED;
01690 
01691         int iRetVal = g_apclDevice[iDeviceId]->moveStep( iModuleId, fPos, uiTime );
01692 
01693         return iRetVal;
01694 }
01695 
01696 M5DLL_API int WINAPI PCube_movePosInc( int iDeviceId, int iModuleId, long iPos )
01697 {
01698         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01699                 return ERRID_DEV_WRONGDEVICEID;
01700         if( g_apclDevice[iDeviceId] == NULL )
01701                 return ERRID_DEV_NOTINITIALIZED;
01702 
01703         int iRetVal = g_apclDevice[iDeviceId]->movePosInc( iModuleId, iPos );
01704 
01705         return iRetVal;
01706 }
01707 
01708 M5DLL_API int WINAPI PCube_moveRampInc( int iDeviceId, int iModuleId, long iPos, long iVel, long iAcc )
01709 {
01710         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01711                 return ERRID_DEV_WRONGDEVICEID;
01712         if( g_apclDevice[iDeviceId] == NULL )
01713                 return ERRID_DEV_NOTINITIALIZED;
01714 
01715         int iRetVal = g_apclDevice[iDeviceId]->moveRampInc( iModuleId, iPos, iVel, iAcc );
01716 
01717         return iRetVal;
01718 }
01719 
01720 M5DLL_API int WINAPI PCube_moveVelInc( int iDeviceId, int iModuleId, long iVel )
01721 {
01722         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01723                 return ERRID_DEV_WRONGDEVICEID;
01724         if( g_apclDevice[iDeviceId] == NULL )
01725                 return ERRID_DEV_NOTINITIALIZED;
01726 
01727         int iRetVal = g_apclDevice[iDeviceId]->moveVelInc( iModuleId, iVel );
01728 
01729         return iRetVal;
01730 }
01731 
01732 M5DLL_API int WINAPI PCube_moveCurInc( int iDeviceId, int iModuleId, long iCur )
01733 {
01734         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01735                 return ERRID_DEV_WRONGDEVICEID;
01736         if( g_apclDevice[iDeviceId] == NULL )
01737                 return ERRID_DEV_NOTINITIALIZED;
01738 
01739         int iRetVal = g_apclDevice[iDeviceId]->moveCurInc( iModuleId, iCur );
01740 
01741         return iRetVal;
01742 }
01743 
01744 M5DLL_API int WINAPI PCube_moveStepInc( int iDeviceId, int iModuleId, long iPos, unsigned short uiTime )
01745 {
01746         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01747                 return ERRID_DEV_WRONGDEVICEID;
01748         if( g_apclDevice[iDeviceId] == NULL )
01749                 return ERRID_DEV_NOTINITIALIZED;
01750 
01751         int iRetVal = g_apclDevice[iDeviceId]->moveStepInc( iModuleId, iPos, uiTime );
01752 
01753         return iRetVal;
01754 }
01755 
01756 M5DLL_API int WINAPI PCube_movePosExtended( int iDeviceId, int iModuleId, float fPos, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01757 {
01758         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01759                 return ERRID_DEV_WRONGDEVICEID;
01760         if( g_apclDevice[iDeviceId] == NULL )
01761                 return ERRID_DEV_NOTINITIALIZED;
01762 
01763         int iRetVal = g_apclDevice[iDeviceId]->movePosExtended( iModuleId, fPos, puiState, pucDio, pfPos );
01764 
01765         return iRetVal;
01766 }
01767 
01768 M5DLL_API int WINAPI PCube_moveRampExtended( int iDeviceId, int iModuleId, float fPos, float fVel, float fAcc, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01769 {
01770         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01771                 return ERRID_DEV_WRONGDEVICEID;
01772         if( g_apclDevice[iDeviceId] == NULL )
01773                 return ERRID_DEV_NOTINITIALIZED;
01774 
01775         int iRetVal = g_apclDevice[iDeviceId]->moveRampExtended( iModuleId, fPos, fVel, fAcc, puiState, pucDio, pfPos );
01776 
01777         return iRetVal;
01778 }
01779 
01780 M5DLL_API int WINAPI PCube_moveVelExtended( int iDeviceId, int iModuleId, float fCur, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01781 {
01782         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01783                 return ERRID_DEV_WRONGDEVICEID;
01784         if( g_apclDevice[iDeviceId] == NULL )
01785                 return ERRID_DEV_NOTINITIALIZED;
01786 
01787         int iRetVal = g_apclDevice[iDeviceId]->moveVelExtended( iModuleId, fCur, puiState, pucDio, pfPos );
01788 
01789         return iRetVal;
01790 }
01791 
01792 M5DLL_API int WINAPI PCube_moveCurExtended( int iDeviceId, int iModuleId, float fCur, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01793 {
01794         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01795                 return ERRID_DEV_WRONGDEVICEID;
01796         if( g_apclDevice[iDeviceId] == NULL )
01797                 return ERRID_DEV_NOTINITIALIZED;
01798 
01799         int iRetVal = g_apclDevice[iDeviceId]->moveCurExtended( iModuleId, fCur, puiState, pucDio, pfPos );
01800 
01801         return iRetVal;
01802 }
01803 
01804 M5DLL_API int WINAPI PCube_moveStepExtended( int iDeviceId, int iModuleId, float fPos, unsigned short uiTime, unsigned long* puiState, unsigned char* pucDio, float* pfPos )
01805 {
01806         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01807                 return ERRID_DEV_WRONGDEVICEID;
01808         if( g_apclDevice[iDeviceId] == NULL )
01809                 return ERRID_DEV_NOTINITIALIZED;
01810 
01811         int iRetVal = g_apclDevice[iDeviceId]->moveStepExtended( iModuleId, fPos, uiTime, puiState, pucDio, pfPos );
01812 
01813         return iRetVal;
01814 }
01815 
01816 M5DLL_API int WINAPI PCube_homeAll( int iDeviceId )
01817 {
01818         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01819                 return ERRID_DEV_WRONGDEVICEID;
01820         if( g_apclDevice[iDeviceId] == NULL )
01821                 return ERRID_DEV_NOTINITIALIZED;
01822 
01823         int iRetVal = g_apclDevice[iDeviceId]->homeAll();
01824 
01825         return iRetVal;
01826 }
01827 
01828 M5DLL_API int WINAPI PCube_resetAll( int iDeviceId )
01829 {
01830         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01831                 return ERRID_DEV_WRONGDEVICEID;
01832         if( g_apclDevice[iDeviceId] == NULL )
01833                 return ERRID_DEV_NOTINITIALIZED;
01834 
01835         int iRetVal = g_apclDevice[iDeviceId]->resetAll();
01836 
01837         return iRetVal;
01838 }
01839 
01840 M5DLL_API int WINAPI PCube_haltAll( int iDeviceId )
01841 {
01842         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01843                 return ERRID_DEV_WRONGDEVICEID;
01844         if( g_apclDevice[iDeviceId] == NULL )
01845                 return ERRID_DEV_NOTINITIALIZED;
01846 
01847         int iRetVal = g_apclDevice[iDeviceId]->haltAll();
01848 
01849         return iRetVal;
01850 }
01851 
01852 M5DLL_API int WINAPI PCube_serveWatchdogAll( int iDeviceId )
01853 {
01854         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01855                 return ERRID_DEV_WRONGDEVICEID;
01856         if( g_apclDevice[iDeviceId] == NULL )
01857                 return ERRID_DEV_NOTINITIALIZED;
01858 
01859         int iRetVal = g_apclDevice[iDeviceId]->serveWatchdogAll();
01860 
01861         return iRetVal;
01862 }
01863 
01864 M5DLL_API int WINAPI PCube_setBaudRateAll( int iDeviceId, unsigned char ucValue )
01865 {
01866         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01867                 return ERRID_DEV_WRONGDEVICEID;
01868         if( g_apclDevice[iDeviceId] == NULL )
01869                 return ERRID_DEV_NOTINITIALIZED;
01870 
01871         int iRetVal = g_apclDevice[iDeviceId]->setBaudRateAll(ucValue);
01872 
01873         return iRetVal;
01874 }
01875 
01876 M5DLL_API int WINAPI PCube_startMotionAll( int iDeviceId )
01877 {
01878         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01879                 return ERRID_DEV_WRONGDEVICEID;
01880         if( g_apclDevice[iDeviceId] == NULL )
01881                 return ERRID_DEV_NOTINITIALIZED;
01882 
01883         int iRetVal = g_apclDevice[iDeviceId]->startMotionAll();
01884 
01885         return iRetVal;
01886 }
01887 
01888 M5DLL_API int WINAPI PCube_savePosAll( int iDeviceId )
01889 {
01890         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01891                 return ERRID_DEV_WRONGDEVICEID;
01892         if( g_apclDevice[iDeviceId] == NULL )
01893                 return ERRID_DEV_NOTINITIALIZED;
01894 
01895         int iRetVal = g_apclDevice[iDeviceId]->savePosAll();
01896 
01897         return iRetVal;
01898 }
01899 
01900 M5DLL_API int WINAPI PCube_waitForHomeEnd( int iDeviceId, int iModuleId, unsigned long uiTime )
01901 {
01902         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01903                 return ERRID_DEV_WRONGDEVICEID;
01904         if( g_apclDevice[iDeviceId] == NULL )
01905                 return ERRID_DEV_NOTINITIALIZED;
01906 
01907         int iRetVal = g_apclDevice[iDeviceId]->waitForHomeEnd( iModuleId, uiTime );
01908 
01909         return iRetVal;
01910 }
01911 
01912 M5DLL_API int WINAPI PCube_waitForMotionEnd( int iDeviceId, int iModuleId, unsigned long uiTime )
01913 {
01914         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01915                 return ERRID_DEV_WRONGDEVICEID;
01916         if( g_apclDevice[iDeviceId] == NULL )
01917                 return ERRID_DEV_NOTINITIALIZED;
01918 
01919         int iRetVal = g_apclDevice[iDeviceId]->waitForMotionEnd( iModuleId, uiTime );
01920 
01921         return iRetVal;
01922 }
01923 
01924 M5DLL_API int WINAPI PCube_waitForRampEnd( int iDeviceId, int iModuleId, unsigned long uiTime )
01925 {
01926         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01927                 return ERRID_DEV_WRONGDEVICEID;
01928         if( g_apclDevice[iDeviceId] == NULL )
01929                 return ERRID_DEV_NOTINITIALIZED;
01930 
01931         int iRetVal = g_apclDevice[iDeviceId]->waitForRampEnd( iModuleId, uiTime );
01932 
01933         return iRetVal;
01934 }
01935 
01936 M5DLL_API int WINAPI PCube_waitForRampDec( int iDeviceId, int iModuleId, unsigned long uiTime )
01937 {
01938         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01939                 return ERRID_DEV_WRONGDEVICEID;
01940         if( g_apclDevice[iDeviceId] == NULL )
01941                 return ERRID_DEV_NOTINITIALIZED;
01942 
01943         int iRetVal = g_apclDevice[iDeviceId]->waitForRampDec( iModuleId, uiTime );
01944 
01945         return iRetVal;
01946 }
01947 
01948 M5DLL_API int WINAPI PCube_waitForRampSteady( int iDeviceId, int iModuleId, unsigned long uiTime )
01949 {
01950         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01951                 return ERRID_DEV_WRONGDEVICEID;
01952         if( g_apclDevice[iDeviceId] == NULL )
01953                 return ERRID_DEV_NOTINITIALIZED;
01954 
01955         int iRetVal = g_apclDevice[iDeviceId]->waitForRampSteady( iModuleId, uiTime );
01956 
01957         return iRetVal;
01958 }
01959 
01960 M5DLL_API int WINAPI PCube_waitForHomeEndAll( int iDeviceId, unsigned long uiTime )
01961 {
01962         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01963                 return ERRID_DEV_WRONGDEVICEID;
01964         if( g_apclDevice[iDeviceId] == NULL )
01965                 return ERRID_DEV_NOTINITIALIZED;
01966 
01967         int iRetVal = g_apclDevice[iDeviceId]->waitForHomeEndAll( uiTime );
01968 
01969         return iRetVal;
01970 }
01971 
01972 M5DLL_API int WINAPI PCube_waitForMotionEndAll( int iDeviceId, unsigned long uiTime )
01973 {
01974         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01975                 return ERRID_DEV_WRONGDEVICEID;
01976         if( g_apclDevice[iDeviceId] == NULL )
01977                 return ERRID_DEV_NOTINITIALIZED;
01978 
01979         int iRetVal = g_apclDevice[iDeviceId]->waitForMotionEndAll( uiTime );
01980 
01981         return iRetVal;
01982 }
01983 
01984 M5DLL_API int WINAPI PCube_waitForRampEndAll( int iDeviceId, unsigned long uiTime )
01985 {
01986         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01987                 return ERRID_DEV_WRONGDEVICEID;
01988         if( g_apclDevice[iDeviceId] == NULL )
01989                 return ERRID_DEV_NOTINITIALIZED;
01990 
01991         int iRetVal = g_apclDevice[iDeviceId]->waitForRampEndAll( uiTime );
01992 
01993         return iRetVal;
01994 }
01995 
01996 M5DLL_API int WINAPI PCube_waitForStartMotionAll( int iDeviceId )
01997 {
01998         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
01999                 return ERRID_DEV_WRONGDEVICEID;
02000         if( g_apclDevice[iDeviceId] == NULL )
02001                 return ERRID_DEV_NOTINITIALIZED;
02002 
02003         int iRetVal = g_apclDevice[iDeviceId]->waitForStartMotionAll();
02004 
02005         return iRetVal;
02006 }
02007 
02008 M5DLL_API int WINAPI PCube_xmit8Bytes( int iDeviceId, int iModuleId, void* pBytes )
02009 {
02010         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02011                 return ERRID_DEV_WRONGDEVICEID;
02012         if( g_apclDevice[iDeviceId] == NULL )
02013                 return ERRID_DEV_NOTINITIALIZED;
02014 
02015         int iRetVal = g_apclDevice[iDeviceId]->xmit8Bytes( iModuleId, pBytes );
02016 
02017         return iRetVal;
02018 }
02019 
02020 M5DLL_API int WINAPI PCube_xack8Bytes( int iDeviceId, int iModuleId, void* pBytes )
02021 {
02022         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02023                 return ERRID_DEV_WRONGDEVICEID;
02024         if( g_apclDevice[iDeviceId] == NULL )
02025                 return ERRID_DEV_NOTINITIALIZED;
02026 
02027         int iRetVal = g_apclDevice[iDeviceId]->xack8Bytes( iModuleId, pBytes );
02028 
02029         return iRetVal;
02030 }
02031 
02032 M5DLL_API int WINAPI PCube_doInternal( int iDeviceId, int iModuleId, void* pBytes )
02033 {
02034         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02035                 return ERRID_DEV_WRONGDEVICEID;
02036         if( g_apclDevice[iDeviceId] == NULL )
02037                 return ERRID_DEV_NOTINITIALIZED;
02038 
02039         int iRetVal = g_apclDevice[iDeviceId]->doInternal( iModuleId, pBytes );
02040 
02041         return iRetVal;
02042 }
02043 
02044 M5DLL_API int WINAPI PCube_getStateInternal( int iDeviceId, int iModuleId, unsigned long* pStat )
02045 {
02046         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02047                 return ERRID_DEV_WRONGDEVICEID;
02048         if( g_apclDevice[iDeviceId] == NULL )
02049                 return ERRID_DEV_NOTINITIALIZED;
02050 
02051         int iRetVal = g_apclDevice[iDeviceId]->getStateInternal( iModuleId, pStat );
02052 
02053         return iRetVal;
02054 }
02055 
02056 M5DLL_API int WINAPI PCube_initDLR_FTS( int iDeviceId )
02057 {       
02058         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02059                 return ERRID_DEV_WRONGDEVICEID;
02060         if( g_apclDevice[iDeviceId] == NULL )
02061                 return ERRID_DEV_NOTINITIALIZED;
02062 
02063         int iRetVal = g_apclDevice[iDeviceId]->initDLR_FTS();
02064 
02065         return iRetVal;
02066 }
02067 
02068 M5DLL_API int WINAPI PCube_getDataDLR_FTS( int iDeviceId, float* fVal0, float* fVal1, float* fVal2, float* fVal3, float* fVal4, float* fVal5, long* piState )
02069 {       
02070         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02071                 return ERRID_DEV_WRONGDEVICEID;
02072         if( g_apclDevice[iDeviceId] == NULL )
02073                 return ERRID_DEV_NOTINITIALIZED;
02074 
02075         static std::vector<float> afVector;
02076         int iRetVal = g_apclDevice[iDeviceId]->getDataDLR_FTS( afVector, piState );
02077         *fVal0 = afVector[0];
02078         *fVal1 = afVector[1];
02079         *fVal2 = afVector[2];
02080         *fVal3 = afVector[3];
02081         *fVal4 = afVector[4];
02082         *fVal5 = afVector[5];
02083 
02084         return iRetVal;
02085 }
02086 
02087 M5DLL_API int WINAPI PCube_getDataSCHUNK_FTC( int iDeviceId, int iModulId, int iChannelTypeId, float* fVal0, float* fVal1, float* fVal2, float* fVal3, float* fVal4, float* fVal5, short* piState )
02088 {       
02089         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02090                 return ERRID_DEV_WRONGDEVICEID;
02091         if( g_apclDevice[iDeviceId] == NULL )
02092                 return ERRID_DEV_NOTINITIALIZED;
02093 
02094         static std::vector<float> afVector;
02095         int iRetVal = g_apclDevice[iDeviceId]->getDataSCHUNK_FTC( iModulId, iChannelTypeId, afVector, piState );
02096         *fVal0 = afVector[0];
02097         *fVal1 = afVector[1];
02098         *fVal2 = afVector[2];
02099         *fVal3 = afVector[3];
02100         *fVal4 = afVector[4];
02101         *fVal5 = afVector[5];
02102 
02103         return iRetVal;
02104 }
02105 
02106 M5DLL_API int WINAPI PCube_setNullSCHUNK_FTC( int iDeviceId, int iModulId, short* piState )
02107 {       
02108         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02109                 return ERRID_DEV_WRONGDEVICEID;
02110         if( g_apclDevice[iDeviceId] == NULL )
02111                 return ERRID_DEV_NOTINITIALIZED;
02112 
02113         int iRetVal = g_apclDevice[iDeviceId]->setNullSCHUNK_FTC( iModulId, piState );
02114 
02115         return iRetVal;
02116 }
02117 
02118 M5DLL_API int WINAPI PCube_initEMS_IO( int iDeviceId, unsigned char ucType, unsigned long uiSerialNo )
02119 {       
02120         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02121                 return ERRID_DEV_WRONGDEVICEID;
02122         if( g_apclDevice[iDeviceId] == NULL )
02123                 return ERRID_DEV_NOTINITIALIZED;
02124 
02125 
02126 
02127         return ERRID_DEV_WRONGDEVICEID;
02128 }
02129 
02130 M5DLL_API int WINAPI PCube_getDataEMS_DIO( int iDeviceId, int iModuleId, int iChannelId, int* pData )
02131 {       
02132         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02133                 return ERRID_DEV_WRONGDEVICEID;
02134         if( g_apclDevice[iDeviceId] == NULL )
02135                 return ERRID_DEV_NOTINITIALIZED;
02136 
02137         bool bData = false;
02138 
02139 
02140 
02141         return ERRID_DEV_WRONGDEVICEID;
02142 }
02143 
02144 M5DLL_API int WINAPI PCube_setDataEMS_DIO( int iDeviceId, int iModuleId, int iChannelId, int iData )
02145 {       
02146         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02147                 return ERRID_DEV_WRONGDEVICEID;
02148         if( g_apclDevice[iDeviceId] == NULL )
02149                 return ERRID_DEV_NOTINITIALIZED;
02150 
02151         bool bData = (bool)iData;
02152 
02153 
02154         return ERRID_DEV_WRONGDEVICEID;
02155 }
02156 
02157 M5DLL_API int WINAPI PCube_getDataEMS_AIO( int iDeviceId, int iModuleId, int iChannelId, float* pfData )
02158 {       
02159         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02160                 return ERRID_DEV_WRONGDEVICEID;
02161         if( g_apclDevice[iDeviceId] == NULL )
02162                 return ERRID_DEV_NOTINITIALIZED;
02163 
02164 
02165 
02166         return ERRID_DEV_WRONGDEVICEID;
02167 }
02168 
02169 M5DLL_API int WINAPI PCube_setDataEMS_AIO( int iDeviceId, int iModuleId, int iChannelId, float fData )
02170 {       
02171         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02172                 return ERRID_DEV_WRONGDEVICEID;
02173         if( g_apclDevice[iDeviceId] == NULL )
02174                 return ERRID_DEV_NOTINITIALIZED;
02175 
02176 
02177 
02178         return ERRID_DEV_WRONGDEVICEID;
02179 }
02180 
02181 M5DLL_API int WINAPI PCube_getDataMP55_IO( int iDeviceId, int iModuleId, float* pfData )
02182 {       
02183         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02184                 return ERRID_DEV_WRONGDEVICEID;
02185         if( g_apclDevice[iDeviceId] == NULL )
02186                 return ERRID_DEV_NOTINITIALIZED;
02187 
02188         int iRetVal = g_apclDevice[iDeviceId]->getDataMP55_IO( iModuleId, pfData );
02189 
02190         return iRetVal;
02191 }
02192 
02193 M5DLL_API int WINAPI PCube_setTaraMP55_IO( int iDeviceId, int iModuleId, float fData )
02194 {       
02195         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02196                 return ERRID_DEV_WRONGDEVICEID;
02197         if( g_apclDevice[iDeviceId] == NULL )
02198                 return ERRID_DEV_NOTINITIALIZED;
02199 
02200         int iRetVal = g_apclDevice[iDeviceId]->setTaraMP55_IO( iModuleId, fData );
02201 
02202         return iRetVal;
02203 }
02204 
02205 M5DLL_API int WINAPI PCube_getDefCurOffset( int iDeviceId, int iModuleId, float* pfValue )
02206 {       
02207         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02208                 return ERRID_DEV_WRONGDEVICEID;
02209         if( g_apclDevice[iDeviceId] == NULL )
02210                 return ERRID_DEV_NOTINITIALIZED;
02211 
02212         int iRetVal = g_apclDevice[iDeviceId]->getDefCurOffset( iModuleId, pfValue );
02213 
02214         return iRetVal;
02215 }
02216 
02217 M5DLL_API int WINAPI PCube_setInitMP55_IO_fast( int iDeviceId, int iModuleId )
02218 {       
02219         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02220                 return ERRID_DEV_WRONGDEVICEID;
02221         if( g_apclDevice[iDeviceId] == NULL )
02222                 return ERRID_DEV_NOTINITIALIZED;
02223 
02224         int iRetVal = g_apclDevice[iDeviceId]->setInitMP55_IO_fast( iModuleId );
02225 
02226         return iRetVal;
02227 }
02228 
02229 M5DLL_API int WINAPI PCube_getDataMP55_IO_fast( int iDeviceId, int iModuleId, float* pfData )
02230 {       
02231         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02232                 return ERRID_DEV_WRONGDEVICEID;
02233         if( g_apclDevice[iDeviceId] == NULL )
02234                 return ERRID_DEV_NOTINITIALIZED;
02235 
02236         int iRetVal = g_apclDevice[iDeviceId]->getDataMP55_IO_fast( iModuleId, pfData );
02237 
02238         return iRetVal;
02239 }
02240 
02241 M5DLL_API int WINAPI PCube_getRawMotorCurrent( int iDeviceId, int iModuleId, short* piValue )
02242 {       
02243         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02244                 return ERRID_DEV_WRONGDEVICEID;
02245         if( g_apclDevice[iDeviceId] == NULL )
02246                 return ERRID_DEV_NOTINITIALIZED;
02247 
02248         int iRetVal = g_apclDevice[iDeviceId]->getRawMotorCurrent( iModuleId, piValue );
02249 
02250         return iRetVal;
02251 }
02252 
02253 M5DLL_API int WINAPI PCube_getRawMotorSupply( int iDeviceId, int iModuleId, short* piValue )
02254 {       
02255         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02256                 return ERRID_DEV_WRONGDEVICEID;
02257         if( g_apclDevice[iDeviceId] == NULL )
02258                 return ERRID_DEV_NOTINITIALIZED;
02259 
02260         int iRetVal = g_apclDevice[iDeviceId]->getRawMotorSupply( iModuleId, piValue );
02261 
02262         return iRetVal;
02263 }
02264 
02265 M5DLL_API int WINAPI PCube_getRawTemperature( int iDeviceId, int iModuleId, short* piValue )
02266 {       
02267         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02268                 return ERRID_DEV_WRONGDEVICEID;
02269         if( g_apclDevice[iDeviceId] == NULL )
02270                 return ERRID_DEV_NOTINITIALIZED;
02271 
02272         int iRetVal = g_apclDevice[iDeviceId]->getRawTemperature( iModuleId, piValue );
02273 
02274         return iRetVal;
02275 }
02276 
02277 M5DLL_API int WINAPI PCube_getRawLogicSupply( int iDeviceId, int iModuleId, short* piValue )
02278 {       
02279         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02280                 return ERRID_DEV_WRONGDEVICEID;
02281         if( g_apclDevice[iDeviceId] == NULL )
02282                 return ERRID_DEV_NOTINITIALIZED;
02283 
02284         int iRetVal = g_apclDevice[iDeviceId]->getRawLogicSupply( iModuleId, piValue );
02285 
02286         return iRetVal;
02287 }
02288 
02289 M5DLL_API int WINAPI PCube_getCanOpenRawAbsEnc( int iDeviceId, int iModuleId, short* piValue )
02290 {
02291         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02292                 return ERRID_DEV_WRONGDEVICEID;
02293         if( g_apclDevice[iDeviceId] == NULL )
02294                 return ERRID_DEV_NOTINITIALIZED;
02295 
02296         int iRetVal = g_apclDevice[iDeviceId]->getCanOpenRawAbsEnc( iModuleId, piValue );
02297 
02298         return iRetVal;
02299 }
02300 
02301 M5DLL_API int WINAPI PCube_getLoadLimit( int iDeviceId, int iModuleId, long* piValue)
02302 {
02303         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02304                 return ERRID_DEV_WRONGDEVICEID;
02305         if( g_apclDevice[iDeviceId] == NULL )
02306                 return ERRID_DEV_NOTINITIALIZED;
02307 
02308         int iRetVal = g_apclDevice[iDeviceId]->getLoadLimit( iModuleId, piValue );
02309 
02310         return iRetVal;
02311 }
02312 
02313 M5DLL_API int WINAPI PCube_getMaxLoadGradient( int iDeviceId, int iModuleId, long* piValue)
02314 {
02315         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02316                 return ERRID_DEV_WRONGDEVICEID;
02317         if( g_apclDevice[iDeviceId] == NULL )
02318                 return ERRID_DEV_NOTINITIALIZED;
02319 
02320         int iRetVal = g_apclDevice[iDeviceId]->getMaxLoadGradient( iModuleId, piValue );
02321 
02322         return iRetVal;
02323 }
02324 
02325 M5DLL_API int WINAPI PCube_getLoadDeltaTime( int iDeviceId, int iModuleId, unsigned short* piValue)
02326 {
02327         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02328                 return ERRID_DEV_WRONGDEVICEID;
02329         if( g_apclDevice[iDeviceId] == NULL )
02330                 return ERRID_DEV_NOTINITIALIZED;
02331 
02332         int iRetVal = g_apclDevice[iDeviceId]->getLoadDeltaTime( iModuleId, piValue );
02333 
02334         return iRetVal;
02335 }
02336 
02337 M5DLL_API int WINAPI PCube_setLoadLimit( int iDeviceId, int iModuleId, long iValue)
02338 {
02339         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02340                 return ERRID_DEV_WRONGDEVICEID;
02341         if( g_apclDevice[iDeviceId] == NULL )
02342                 return ERRID_DEV_NOTINITIALIZED;
02343 
02344         int iRetVal = g_apclDevice[iDeviceId]->setLoadLimit( iModuleId, iValue );
02345 
02346         return iRetVal;
02347 }
02348 
02349 M5DLL_API int WINAPI PCube_setMaxLoadGradient( int iDeviceId, int iModuleId, long iValue)
02350 {
02351         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02352                 return ERRID_DEV_WRONGDEVICEID;
02353         if( g_apclDevice[iDeviceId] == NULL )
02354                 return ERRID_DEV_NOTINITIALIZED;
02355 
02356         int iRetVal = g_apclDevice[iDeviceId]->setMaxLoadGradient( iModuleId, iValue );
02357 
02358         return iRetVal;
02359 }
02360 
02361 M5DLL_API int WINAPI PCube_setLoadDeltaTime( int iDeviceId, int iModuleId, unsigned short iValue)
02362 {
02363         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02364                 return ERRID_DEV_WRONGDEVICEID;
02365         if( g_apclDevice[iDeviceId] == NULL )
02366                 return ERRID_DEV_NOTINITIALIZED;
02367 
02368         int iRetVal = g_apclDevice[iDeviceId]->setLoadDeltaTime( iModuleId, iValue );
02369 
02370         return iRetVal;
02371 }
02372 
02373 M5DLL_API int WINAPI PCube_saveParameters( int iDeviceId, int iModuleId )
02374 {
02375         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02376                 return ERRID_DEV_WRONGDEVICEID;
02377         if( g_apclDevice[iDeviceId] == NULL )
02378                 return ERRID_DEV_NOTINITIALIZED;
02379 
02380         int iRetVal = g_apclDevice[iDeviceId]->saveParameters( iModuleId );
02381 
02382         return iRetVal;
02383 }
02384 
02385 M5DLL_API int WINAPI PCube_getDefCANBaudRate( int iDeviceId, int iModuleId, unsigned char* pucValue )
02386 {
02387         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02388                 return ERRID_DEV_WRONGDEVICEID;
02389         if( g_apclDevice[iDeviceId] == NULL )
02390                 return ERRID_DEV_NOTINITIALIZED;
02391 
02392         int iRetVal = g_apclDevice[iDeviceId]->getDefCANBaudRate( iModuleId, pucValue );
02393 
02394         return iRetVal;
02395 }
02396 
02397 M5DLL_API int WINAPI PCube_getDefRSBaudRate( int iDeviceId, int iModuleId, unsigned char* pucValue )
02398 {
02399         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02400                 return ERRID_DEV_WRONGDEVICEID;
02401         if( g_apclDevice[iDeviceId] == NULL )
02402                 return ERRID_DEV_NOTINITIALIZED;
02403 
02404         int iRetVal = g_apclDevice[iDeviceId]->getDefRSBaudRate( iModuleId, pucValue );
02405 
02406         return iRetVal;
02407 }
02408 
02409 M5DLL_API int WINAPI PCube_setDefGearRatio( int iDeviceId, int iModuleId, float fValue )
02410 {
02411         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02412                 return ERRID_DEV_WRONGDEVICEID;
02413         if( g_apclDevice[iDeviceId] == NULL )
02414                 return ERRID_DEV_NOTINITIALIZED;
02415 
02416         int iRetVal = g_apclDevice[iDeviceId]->setDefGearRatio( iModuleId, fValue );
02417 
02418         return iRetVal;
02419 }
02420 
02421 M5DLL_API int WINAPI PCube_setDefLinRatio( int iDeviceId, int iModuleId, float fValue )
02422 {
02423         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02424                 return ERRID_DEV_WRONGDEVICEID;
02425         if( g_apclDevice[iDeviceId] == NULL )
02426                 return ERRID_DEV_NOTINITIALIZED;
02427 
02428         int iRetVal = g_apclDevice[iDeviceId]->setDefLinRatio( iModuleId, fValue );
02429 
02430         return iRetVal;
02431 }
02432 
02433 M5DLL_API int WINAPI PCube_setDefCurRatio( int iDeviceId, int iModuleId, float fValue )
02434 {
02435         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02436                 return ERRID_DEV_WRONGDEVICEID;
02437         if( g_apclDevice[iDeviceId] == NULL )
02438                 return ERRID_DEV_NOTINITIALIZED;
02439 
02440         int iRetVal = g_apclDevice[iDeviceId]->setDefCurRatio( iModuleId, fValue );
02441 
02442         return iRetVal;
02443 }
02444 
02445 M5DLL_API int WINAPI PCube_setDefHomeAcc( int iDeviceId, int iModuleId, float fValue )
02446 {
02447         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02448                 return ERRID_DEV_WRONGDEVICEID;
02449         if( g_apclDevice[iDeviceId] == NULL )
02450                 return ERRID_DEV_NOTINITIALIZED;
02451 
02452         int iRetVal = g_apclDevice[iDeviceId]->setDefHomeAcc( iModuleId, fValue );
02453 
02454         return iRetVal;
02455 }
02456 
02457 M5DLL_API int WINAPI PCube_setModuleSerialNo( int iDeviceId, int iModuleId, unsigned long uiValue )
02458 {
02459         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02460                 return ERRID_DEV_WRONGDEVICEID;
02461         if( g_apclDevice[iDeviceId] == NULL )
02462                 return ERRID_DEV_NOTINITIALIZED;
02463 
02464         int iRetVal = g_apclDevice[iDeviceId]->setModuleSerialNo( iModuleId, uiValue );
02465 
02466         return iRetVal;
02467 }
02468 
02469 M5DLL_API int WINAPI PCube_setDefIncPerTurn( int iDeviceId, int iModuleId, unsigned long uiValue )
02470 {
02471         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02472                 return ERRID_DEV_WRONGDEVICEID;
02473         if( g_apclDevice[iDeviceId] == NULL )
02474                 return ERRID_DEV_NOTINITIALIZED;
02475 
02476         int iRetVal = g_apclDevice[iDeviceId]->setDefIncPerTurn( iModuleId, uiValue );
02477 
02478         return iRetVal;
02479 }
02480 
02481 M5DLL_API int WINAPI PCube_setDefBrakeTimeOut( int iDeviceId, int iModuleId, unsigned short uiValue )
02482 {
02483         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02484                 return ERRID_DEV_WRONGDEVICEID;
02485         if( g_apclDevice[iDeviceId] == NULL )
02486                 return ERRID_DEV_NOTINITIALIZED;
02487 
02488         int iRetVal = g_apclDevice[iDeviceId]->setDefBrakeTimeOut( iModuleId, uiValue );
02489 
02490         return iRetVal;
02491 }
02492 
02493 M5DLL_API int WINAPI PCube_setDefAddress( int iDeviceId, int iModuleId, unsigned char uiValue )
02494 {
02495         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02496                 return ERRID_DEV_WRONGDEVICEID;
02497         if( g_apclDevice[iDeviceId] == NULL )
02498                 return ERRID_DEV_NOTINITIALIZED;
02499 
02500         int iRetVal = g_apclDevice[iDeviceId]->setDefAddress( iModuleId, uiValue );
02501 
02502         return iRetVal;
02503 }
02504 
02505 M5DLL_API int WINAPI PCube_setDefCANBaudRate( int iDeviceId, int iModuleId, unsigned char uiValue )
02506 {
02507         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02508                 return ERRID_DEV_WRONGDEVICEID;
02509         if( g_apclDevice[iDeviceId] == NULL )
02510                 return ERRID_DEV_NOTINITIALIZED;
02511 
02512         int iRetVal = g_apclDevice[iDeviceId]->setDefCANBaudRate( iModuleId, uiValue );
02513 
02514         return iRetVal;
02515 }
02516 
02517 M5DLL_API int WINAPI PCube_setDefRSBaudRate( int iDeviceId, int iModuleId, unsigned char uiValue )
02518 {
02519         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02520                 return ERRID_DEV_WRONGDEVICEID;
02521         if( g_apclDevice[iDeviceId] == NULL )
02522                 return ERRID_DEV_NOTINITIALIZED;
02523 
02524         int iRetVal = g_apclDevice[iDeviceId]->setDefRSBaudRate( iModuleId, uiValue );
02525 
02526         return iRetVal;
02527 }
02528 
02529 M5DLL_API int WINAPI PCube_setDefSetup( int iDeviceId, int iModuleId, unsigned long uiValue )
02530 {
02531         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02532                 return ERRID_DEV_WRONGDEVICEID;
02533         if( g_apclDevice[iDeviceId] == NULL )
02534                 return ERRID_DEV_NOTINITIALIZED;
02535 
02536         int iRetVal = g_apclDevice[iDeviceId]->setDefSetup( iModuleId, uiValue );
02537 
02538         return iRetVal;
02539 }
02540 
02541 M5DLL_API int WINAPI PCube_getMotorCurrent( int iDeviceId, int iModuleId, float* pfValue )
02542 {
02543         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02544                 return ERRID_DEV_WRONGDEVICEID;
02545         if( g_apclDevice[iDeviceId] == NULL )
02546                 return ERRID_DEV_NOTINITIALIZED;
02547 
02548         int iRetVal = g_apclDevice[iDeviceId]->getMotorCurrent( iModuleId, pfValue );
02549 
02550         return iRetVal;
02551 }
02552 
02553 M5DLL_API int WINAPI PCube_getMotorSupply( int iDeviceId, int iModuleId, float* pfValue )
02554 {
02555         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02556                 return ERRID_DEV_WRONGDEVICEID;
02557         if( g_apclDevice[iDeviceId] == NULL )
02558                 return ERRID_DEV_NOTINITIALIZED;
02559 
02560         int iRetVal = g_apclDevice[iDeviceId]->getMotorSupply( iModuleId, pfValue );
02561 
02562         return iRetVal;
02563 }
02564 
02565 M5DLL_API int WINAPI PCube_getTemperature( int iDeviceId, int iModuleId, float* pfValue )
02566 {
02567         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02568                 return ERRID_DEV_WRONGDEVICEID;
02569         if( g_apclDevice[iDeviceId] == NULL )
02570                 return ERRID_DEV_NOTINITIALIZED;
02571 
02572         int iRetVal = g_apclDevice[iDeviceId]->getTemperature( iModuleId, pfValue );
02573 
02574         return iRetVal;
02575 }
02576 
02577 M5DLL_API int WINAPI PCube_getLogicSupply( int iDeviceId, int iModuleId, float* pfValue )
02578 {
02579         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02580                 return ERRID_DEV_WRONGDEVICEID;
02581         if( g_apclDevice[iDeviceId] == NULL )
02582                 return ERRID_DEV_NOTINITIALIZED;
02583 
02584         int iRetVal = g_apclDevice[iDeviceId]->getLogicSupply( iModuleId, pfValue );
02585 
02586         return iRetVal;
02587 }
02588 
02589 M5DLL_API int WINAPI PCube_getMinLogicVoltage( int iDeviceId, int iModuleId, float* pfValue )
02590 {
02591         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02592                 return ERRID_DEV_WRONGDEVICEID;
02593         if( g_apclDevice[iDeviceId] == NULL )
02594                 return ERRID_DEV_NOTINITIALIZED;
02595 
02596         int iRetVal = g_apclDevice[iDeviceId]->getMinLogicVoltage( iModuleId, pfValue );
02597 
02598         return iRetVal;
02599 }
02600 
02601 M5DLL_API int WINAPI PCube_getMaxLogicVoltage( int iDeviceId, int iModuleId, float* pfValue )
02602 {
02603         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02604                 return ERRID_DEV_WRONGDEVICEID;
02605         if( g_apclDevice[iDeviceId] == NULL )
02606                 return ERRID_DEV_NOTINITIALIZED;
02607 
02608         int iRetVal = g_apclDevice[iDeviceId]->getMaxLogicVoltage( iModuleId, pfValue );
02609 
02610         return iRetVal;
02611 }
02612 
02613 M5DLL_API int WINAPI PCube_getMinMotorVoltage( int iDeviceId, int iModuleId, float* pfValue )
02614 {
02615         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02616                 return ERRID_DEV_WRONGDEVICEID;
02617         if( g_apclDevice[iDeviceId] == NULL )
02618                 return ERRID_DEV_NOTINITIALIZED;
02619 
02620         int iRetVal = g_apclDevice[iDeviceId]->getMinMotorVoltage( iModuleId, pfValue );
02621 
02622         return iRetVal;
02623 }
02624 
02625 M5DLL_API int WINAPI PCube_getMaxMotorVoltage( int iDeviceId, int iModuleId, float* pfValue )
02626 {
02627         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02628                 return ERRID_DEV_WRONGDEVICEID;
02629         if( g_apclDevice[iDeviceId] == NULL )
02630                 return ERRID_DEV_NOTINITIALIZED;
02631 
02632         int iRetVal = g_apclDevice[iDeviceId]->getMaxMotorVoltage( iModuleId, pfValue );
02633 
02634         return iRetVal;
02635 }
02636 
02637 M5DLL_API int WINAPI PCube_getNominalMotorCurrent( int iDeviceId, int iModuleId, float* pfValue )
02638 {
02639         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02640                 return ERRID_DEV_WRONGDEVICEID;
02641         if( g_apclDevice[iDeviceId] == NULL )
02642                 return ERRID_DEV_NOTINITIALIZED;
02643 
02644         int iRetVal = g_apclDevice[iDeviceId]->getNominalMotorCurrent( iModuleId, pfValue );
02645 
02646         return iRetVal;
02647 }
02648 
02649 M5DLL_API int WINAPI PCube_getMaximumMotorCurrent( int iDeviceId, int iModuleId, float* pfValue )
02650 {
02651         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02652                 return ERRID_DEV_WRONGDEVICEID;
02653         if( g_apclDevice[iDeviceId] == NULL )
02654                 return ERRID_DEV_NOTINITIALIZED;
02655 
02656         int iRetVal = g_apclDevice[iDeviceId]->getMaximumMotorCurrent( iModuleId, pfValue );
02657 
02658         return iRetVal;
02659 }
02660 
02661 M5DLL_API int WINAPI PCube_getLogicUndershootTime( int iDeviceId, int iModuleId, long* piValue )
02662 {
02663         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02664                 return ERRID_DEV_WRONGDEVICEID;
02665         if( g_apclDevice[iDeviceId] == NULL )
02666                 return ERRID_DEV_NOTINITIALIZED;
02667 
02668         int iRetVal = g_apclDevice[iDeviceId]->getLogicUndershootTime( iModuleId, piValue );
02669 
02670         return iRetVal;
02671 }
02672 
02673 M5DLL_API int WINAPI PCube_getLogicOvershootTime( int iDeviceId, int iModuleId, long* piValue )
02674 {
02675         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02676                 return ERRID_DEV_WRONGDEVICEID;
02677         if( g_apclDevice[iDeviceId] == NULL )
02678                 return ERRID_DEV_NOTINITIALIZED;
02679 
02680         int iRetVal = g_apclDevice[iDeviceId]->getLogicOvershootTime( iModuleId, piValue );
02681 
02682         return iRetVal;
02683 }
02684 
02685 M5DLL_API int WINAPI PCube_getMotorUndershootTime( int iDeviceId, int iModuleId, long* piValue )
02686 {
02687         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02688                 return ERRID_DEV_WRONGDEVICEID;
02689         if( g_apclDevice[iDeviceId] == NULL )
02690                 return ERRID_DEV_NOTINITIALIZED;
02691 
02692         int iRetVal = g_apclDevice[iDeviceId]->getMotorUndershootTime( iModuleId, piValue );
02693 
02694         return iRetVal;
02695 }
02696 
02697 M5DLL_API int WINAPI PCube_getMotorOvershootTime( int iDeviceId, int iModuleId, long* piValue )
02698 {
02699         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02700                 return ERRID_DEV_WRONGDEVICEID;
02701         if( g_apclDevice[iDeviceId] == NULL )
02702                 return ERRID_DEV_NOTINITIALIZED;
02703 
02704         int iRetVal = g_apclDevice[iDeviceId]->getMotorOvershootTime( iModuleId, piValue );
02705 
02706         return iRetVal;
02707 }
02708 
02709 M5DLL_API int WINAPI PCube_getNomCurOvershootTime( int iDeviceId, int iModuleId, long* piValue )
02710 {
02711         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02712                 return ERRID_DEV_WRONGDEVICEID;
02713         if( g_apclDevice[iDeviceId] == NULL )
02714                 return ERRID_DEV_NOTINITIALIZED;
02715 
02716         int iRetVal = g_apclDevice[iDeviceId]->getNomCurOvershootTime( iModuleId, piValue );
02717 
02718         return iRetVal;
02719 }
02720 
02721 M5DLL_API int WINAPI PCube_getHMaxCurOvershootTime( int iDeviceId, int iModuleId, long* piValue )
02722 {
02723         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02724                 return ERRID_DEV_WRONGDEVICEID;
02725         if( g_apclDevice[iDeviceId] == NULL )
02726                 return ERRID_DEV_NOTINITIALIZED;
02727 
02728         int iRetVal = g_apclDevice[iDeviceId]->getHMaxCurOvershootTime( iModuleId, piValue );
02729 
02730         return iRetVal;
02731 }
02732 
02733 M5DLL_API int WINAPI PCube_setMinLogicVoltage( int iDeviceId, int iModuleId, float fValue )
02734 {
02735         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02736                 return ERRID_DEV_WRONGDEVICEID;
02737         if( g_apclDevice[iDeviceId] == NULL )
02738                 return ERRID_DEV_NOTINITIALIZED;
02739 
02740         int iRetVal = g_apclDevice[iDeviceId]->setMinLogicVoltage( iModuleId, fValue );
02741 
02742         return iRetVal;
02743 }
02744 
02745 M5DLL_API int WINAPI PCube_setMaxLogicVoltage( int iDeviceId, int iModuleId, float fValue )
02746 {
02747         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02748                 return ERRID_DEV_WRONGDEVICEID;
02749         if( g_apclDevice[iDeviceId] == NULL )
02750                 return ERRID_DEV_NOTINITIALIZED;
02751 
02752         int iRetVal = g_apclDevice[iDeviceId]->setMaxLogicVoltage( iModuleId, fValue );
02753 
02754         return iRetVal;
02755 }
02756 
02757 M5DLL_API int WINAPI PCube_setMinMotorVoltage( int iDeviceId, int iModuleId, float fValue )
02758 {
02759         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02760                 return ERRID_DEV_WRONGDEVICEID;
02761         if( g_apclDevice[iDeviceId] == NULL )
02762                 return ERRID_DEV_NOTINITIALIZED;
02763 
02764         int iRetVal = g_apclDevice[iDeviceId]->setMinMotorVoltage( iModuleId, fValue );
02765 
02766         return iRetVal;
02767 }
02768 
02769 M5DLL_API int WINAPI PCube_setMaxMotorVoltage( int iDeviceId, int iModuleId, float fValue )
02770 {
02771         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02772                 return ERRID_DEV_WRONGDEVICEID;
02773         if( g_apclDevice[iDeviceId] == NULL )
02774                 return ERRID_DEV_NOTINITIALIZED;
02775 
02776         int iRetVal = g_apclDevice[iDeviceId]->setMaxMotorVoltage( iModuleId, fValue );
02777 
02778         return iRetVal;
02779 }
02780 
02781 M5DLL_API int WINAPI PCube_setNominalMotorCurrent( int iDeviceId, int iModuleId, float fValue )
02782 {
02783         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02784                 return ERRID_DEV_WRONGDEVICEID;
02785         if( g_apclDevice[iDeviceId] == NULL )
02786                 return ERRID_DEV_NOTINITIALIZED;
02787 
02788         int iRetVal = g_apclDevice[iDeviceId]->setNominalMotorCurrent( iModuleId, fValue );
02789 
02790         return iRetVal;
02791 }
02792 
02793 M5DLL_API int WINAPI PCube_setMaximumMotorCurrent( int iDeviceId, int iModuleId, float fValue )
02794 {
02795         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02796                 return ERRID_DEV_WRONGDEVICEID;
02797         if( g_apclDevice[iDeviceId] == NULL )
02798                 return ERRID_DEV_NOTINITIALIZED;
02799 
02800         int iRetVal = g_apclDevice[iDeviceId]->setMaximumMotorCurrent( iModuleId, fValue );
02801 
02802         return iRetVal;
02803 }
02804 
02805 M5DLL_API int WINAPI PCube_setLogicUndershootTime( int iDeviceId, int iModuleId, long iValue )
02806 {
02807         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02808                 return ERRID_DEV_WRONGDEVICEID;
02809         if( g_apclDevice[iDeviceId] == NULL )
02810                 return ERRID_DEV_NOTINITIALIZED;
02811 
02812         int iRetVal = g_apclDevice[iDeviceId]->setLogicUndershootTime( iModuleId, iValue );
02813 
02814         return iRetVal;
02815 }
02816 
02817 M5DLL_API int WINAPI PCube_setLogicOvershootTime( int iDeviceId, int iModuleId, long iValue )
02818 {
02819         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02820                 return ERRID_DEV_WRONGDEVICEID;
02821         if( g_apclDevice[iDeviceId] == NULL )
02822                 return ERRID_DEV_NOTINITIALIZED;
02823 
02824         int iRetVal = g_apclDevice[iDeviceId]->setLogicOvershootTime( iModuleId, iValue );
02825 
02826         return iRetVal;
02827 }
02828 
02829 M5DLL_API int WINAPI PCube_setMotorUndershootTime( int iDeviceId, int iModuleId, long iValue )
02830 {
02831         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02832                 return ERRID_DEV_WRONGDEVICEID;
02833         if( g_apclDevice[iDeviceId] == NULL )
02834                 return ERRID_DEV_NOTINITIALIZED;
02835 
02836         int iRetVal = g_apclDevice[iDeviceId]->setMotorUndershootTime( iModuleId, iValue );
02837 
02838         return iRetVal;
02839 }
02840 
02841 M5DLL_API int WINAPI PCube_setMotorOvershootTime( int iDeviceId, int iModuleId, long iValue )
02842 {
02843         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02844                 return ERRID_DEV_WRONGDEVICEID;
02845         if( g_apclDevice[iDeviceId] == NULL )
02846                 return ERRID_DEV_NOTINITIALIZED;
02847 
02848         int iRetVal = g_apclDevice[iDeviceId]->setMotorOvershootTime( iModuleId, iValue );
02849 
02850         return iRetVal;
02851 }
02852 
02853 M5DLL_API int WINAPI PCube_setNomCurOvershootTime( int iDeviceId, int iModuleId, long iValue )
02854 {
02855         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02856                 return ERRID_DEV_WRONGDEVICEID;
02857         if( g_apclDevice[iDeviceId] == NULL )
02858                 return ERRID_DEV_NOTINITIALIZED;
02859 
02860         int iRetVal = g_apclDevice[iDeviceId]->setNomCurOvershootTime( iModuleId, iValue );
02861 
02862         return iRetVal;
02863 }
02864 
02865 M5DLL_API int WINAPI PCube_setHMaxCurOvershootTime( int iDeviceId, int iModuleId, long iValue )
02866 {
02867         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02868                 return ERRID_DEV_WRONGDEVICEID;
02869         if( g_apclDevice[iDeviceId] == NULL )
02870                 return ERRID_DEV_NOTINITIALIZED;
02871 
02872         int iRetVal = g_apclDevice[iDeviceId]->setHMaxCurOvershootTime( iModuleId, iValue );
02873 
02874         return iRetVal;
02875 }
02876 
02877 M5DLL_API int WINAPI PCube_getKpPWMLimit( int iDeviceId, int iModuleId, long* piValue )
02878 {
02879         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02880                 return ERRID_DEV_WRONGDEVICEID;
02881         if( g_apclDevice[iDeviceId] == NULL )
02882                 return ERRID_DEV_NOTINITIALIZED;
02883 
02884         int iRetVal = g_apclDevice[iDeviceId]->getKpPWMLimit( iModuleId, piValue );
02885 
02886         return iRetVal;
02887 }
02888 
02889 M5DLL_API int WINAPI PCube_getCurrentLimit( int iDeviceId, int iModuleId, float* pfValue )
02890 {
02891         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02892                 return ERRID_DEV_WRONGDEVICEID;
02893         if( g_apclDevice[iDeviceId] == NULL )
02894                 return ERRID_DEV_NOTINITIALIZED;
02895 
02896         int iRetVal = g_apclDevice[iDeviceId]->getCurrentLimit( iModuleId, pfValue );
02897 
02898         return iRetVal;
02899 }
02900 
02901 M5DLL_API int WINAPI PCube_getMaxPWMOutput( int iDeviceId, int iModuleId, long* piValue )
02902 {
02903         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02904                 return ERRID_DEV_WRONGDEVICEID;
02905         if( g_apclDevice[iDeviceId] == NULL )
02906                 return ERRID_DEV_NOTINITIALIZED;
02907 
02908         int iRetVal = g_apclDevice[iDeviceId]->getMaxPWMOutput( iModuleId, piValue );
02909 
02910         return iRetVal;
02911 }
02912 
02913 M5DLL_API int WINAPI PCube_setKpPWMLimit( int iDeviceId, int iModuleId, long iValue )
02914 {
02915         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02916                 return ERRID_DEV_WRONGDEVICEID;
02917         if( g_apclDevice[iDeviceId] == NULL )
02918                 return ERRID_DEV_NOTINITIALIZED;
02919 
02920         int iRetVal = g_apclDevice[iDeviceId]->setKpPWMLimit( iModuleId, iValue );
02921 
02922         return iRetVal;
02923 }
02924 
02925 M5DLL_API int WINAPI PCube_setCurrentLimit( int iDeviceId, int iModuleId, float fValue )
02926 {
02927         if(0 > iDeviceId || iDeviceId >= g_apclDevice.size())
02928                 return ERRID_DEV_WRONGDEVICEID;
02929         if( g_apclDevice[iDeviceId] == NULL )
02930                 return ERRID_DEV_NOTINITIALIZED;
02931 
02932         int iRetVal = g_apclDevice[iDeviceId]->setCurrentLimit( iModuleId, fValue );
02933 
02934         return iRetVal;
02935 }