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


schunk_libm5api
Author(s): Florian Weisshardt
autogenerated on Tue Mar 5 2013 14:44:33