From 78410125e9a5ca2bfe500da9cf7eecd08366a15e Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 22 Mar 2011 21:27:53 +0000 Subject: [PATCH] New version from Newport 2.6.2 firmware release; minor mods by MLR to fix bugs and for EPICS --- motorApp/NewportSrc/XPS_C8_drivers.cpp | 2297 +++++++++++++++++++++--- 1 file changed, 2018 insertions(+), 279 deletions(-) diff --git a/motorApp/NewportSrc/XPS_C8_drivers.cpp b/motorApp/NewportSrc/XPS_C8_drivers.cpp index 6fd97b70..8bc8270c 100644 --- a/motorApp/NewportSrc/XPS_C8_drivers.cpp +++ b/motorApp/NewportSrc/XPS_C8_drivers.cpp @@ -1,6 +1,6 @@ -//////////////////////////////////////////////////////////////////// -// Created source file XPS_C8_drivers.cpp for API description -// +/* + * Created source file xps_c8_drivers.cpp for API description + */ #include @@ -10,38 +10,30 @@ #include "Socket.h" #ifdef _WIN32 - #ifdef _DLL /* _DLL is defined by EPICS if we are being compiled to call DLLs */ - #define DLL _declspec(dllexport) - #else - #define DLL - #endif - #include "strtok_r.h" + #define DLL _declspec(dllexport) + #include "strtok_r.h" #else #define DLL #endif - #include "XPS_C8_drivers.h" - - -#define SIZE_SMALL 256 -#define SIZE_NOMINAL 512 +#define SIZE_SMALL 1024 +#define SIZE_NOMINAL 1024 #define SIZE_BIG 2048 -#define SIZE_HUGE 32768 +#define SIZE_HUGE 65536 #define SIZE_EXECUTE_METHOD 1024 #define SIZE_NAME 100 - - #ifdef __cplusplus extern "C" { +#else +#typedef int bool; /* C does not know bool, only C++ */ #endif - -#define DLL_VERSION "Library version for XPS-C8 Firmware V2.1.0" +#define DLL_VERSION "Library version for XPS-C8 Firmware V2.6.x" /***********************************************************************/ int __stdcall TCP_ConnectToServer(char *Ip_Address, int Ip_Port, double TimeOut) @@ -69,6 +61,150 @@ char * __stdcall GetLibraryVersion(void) return (DLL_VERSION); } +/*********************************************************************** + * ControllerMotionKernelTimeLoadGet : Get controller motion kernel time load + * + * - Parameters : + * int SocketIndex + * double *CPUTotalLoadRatio + * double *CPUCorrectorLoadRatio + * double *CPUProfilerLoadRatio + * double *CPUServitudesLoadRatio + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerMotionKernelTimeLoadGet (int SocketIndex, double * CPUTotalLoadRatio, double * CPUCorrectorLoadRatio, double * CPUProfilerLoadRatio, double * CPUServitudesLoadRatio) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerMotionKernelTimeLoadGet (double *,double *,double *,double *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CPUTotalLoadRatio); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CPUCorrectorLoadRatio); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CPUProfilerLoadRatio); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CPUServitudesLoadRatio); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * ControllerStatusGet : Read controller current status + * + * - Parameters : + * int SocketIndex + * int *ControllerStatus + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerStatusGet (int SocketIndex, int * ControllerStatus) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerStatusGet (int *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%d", ControllerStatus); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * ControllerStatusStringGet : Return the controller status string corresponding to the controller status code + * + * - Parameters : + * int SocketIndex + * int ControllerStatusCode + * char *ControllerStatusString + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerStatusStringGet (int SocketIndex, int ControllerStatusCode, char * ControllerStatusString) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerStatusStringGet (%d,char *)", ControllerStatusCode); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (ControllerStatusString, pt); + ptNext = strchr (ControllerStatusString, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * ElapsedTimeGet : Return elapsed time from controller power on * @@ -91,7 +227,7 @@ int __stdcall ElapsedTimeGet (int SocketIndex, double * ElapsedTime) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -135,7 +271,7 @@ int __stdcall ErrorStringGet (int SocketIndex, int ErrorCode, char * ErrorString /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -180,7 +316,7 @@ int __stdcall FirmwareVersionGet (int SocketIndex, char * Version) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -227,7 +363,7 @@ int __stdcall TCLScriptExecute (int SocketIndex, char * TCLFileName, char * Task /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -262,7 +398,7 @@ int __stdcall TCLScriptExecuteAndWait (int SocketIndex, char * TCLFileName, char /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -285,6 +421,41 @@ int __stdcall TCLScriptExecuteAndWait (int SocketIndex, char * TCLFileName, char } +/*********************************************************************** + * TCLScriptExecuteWithPriority : Execute a TCL script with defined priority + * + * - Parameters : + * int SocketIndex + * char *TCLFileName + * char *TaskName + * char *TaskPriorityLevel + * char *ParametersList + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall TCLScriptExecuteWithPriority (int SocketIndex, char * TCLFileName, char * TaskName, char * TaskPriorityLevel, char * ParametersList) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "TCLScriptExecuteWithPriority (%s,%s,%s,%s)", TCLFileName, TaskName, TaskPriorityLevel, ParametersList); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * TCLScriptKill : Kill TCL Task * @@ -307,7 +478,7 @@ int __stdcall TCLScriptKill (int SocketIndex, char * TaskName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -340,7 +511,7 @@ int __stdcall TimerGet (int SocketIndex, char * TimerName, int * FrequencyTicks) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -384,7 +555,7 @@ int __stdcall TimerSet (int SocketIndex, char * TimerName, int FrequencyTicks) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -415,7 +586,7 @@ int __stdcall Reboot (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -448,7 +619,7 @@ int __stdcall Login (int SocketIndex, char * Name, char * Password) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -479,7 +650,84 @@ int __stdcall CloseAllOtherSockets (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * HardwareDateAndTimeGet : Return hardware date and time + * + * - Parameters : + * int SocketIndex + * char *DateAndTime + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall HardwareDateAndTimeGet (int SocketIndex, char * DateAndTime) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "HardwareDateAndTimeGet (char *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (DateAndTime, pt); + ptNext = strchr (DateAndTime, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * HardwareDateAndTimeSet : Set hardware date and time + * + * - Parameters : + * int SocketIndex + * char *DateAndTime + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall HardwareDateAndTimeSet (int SocketIndex, char * DateAndTime) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "HardwareDateAndTimeSet (%s)", DateAndTime); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -517,7 +765,7 @@ int __stdcall EventAdd (int SocketIndex, char * PositionerName, char * EventName /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -550,7 +798,7 @@ int __stdcall EventGet (int SocketIndex, char * PositionerName, char * EventsAnd /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -597,7 +845,7 @@ int __stdcall EventRemove (int SocketIndex, char * PositionerName, char * EventN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -631,7 +879,7 @@ int __stdcall EventWait (int SocketIndex, char * PositionerName, char * EventNam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -671,65 +919,65 @@ int __stdcall EventExtendedConfigurationTriggerSet (int SocketIndex, int NbEleme char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ExtendedEventNameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray1)[SIZE_NAME]; stringArray1 = new char [NbElements][SIZE_NAME]; - memset(stringArray1,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, EventParameter1List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray1[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray1[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray2)[SIZE_NAME]; stringArray2 = new char [NbElements][SIZE_NAME]; - memset(stringArray2,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, EventParameter2List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray2[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray2[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray3)[SIZE_NAME]; stringArray3 = new char [NbElements][SIZE_NAME]; - memset(stringArray3,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, EventParameter3List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray3[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray3[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray4)[SIZE_NAME]; stringArray4 = new char [NbElements][SIZE_NAME]; - memset(stringArray4,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, EventParameter4List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray4[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray4[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -759,7 +1007,7 @@ int __stdcall EventExtendedConfigurationTriggerSet (int SocketIndex, int NbEleme /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -791,7 +1039,7 @@ int __stdcall EventExtendedConfigurationTriggerGet (int SocketIndex, char * Even /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -844,65 +1092,65 @@ int __stdcall EventExtendedConfigurationActionSet (int SocketIndex, int NbElemen char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ExtendedActionNameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray1)[SIZE_NAME]; stringArray1 = new char [NbElements][SIZE_NAME]; - memset(stringArray1,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ActionParameter1List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray1[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray1[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray2)[SIZE_NAME]; stringArray2 = new char [NbElements][SIZE_NAME]; - memset(stringArray2,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ActionParameter2List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray2[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray2[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray3)[SIZE_NAME]; stringArray3 = new char [NbElements][SIZE_NAME]; - memset(stringArray3,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ActionParameter3List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray3[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray3[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; } char (*stringArray4)[SIZE_NAME]; stringArray4 = new char [NbElements][SIZE_NAME]; - memset(stringArray4,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, ActionParameter4List, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray4[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray4[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -932,7 +1180,7 @@ int __stdcall EventExtendedConfigurationActionSet (int SocketIndex, int NbElemen /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -964,7 +1212,7 @@ int __stdcall EventExtendedConfigurationActionGet (int SocketIndex, char * Actio /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1009,7 +1257,7 @@ int __stdcall EventExtendedStart (int SocketIndex, int * ID) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1052,7 +1300,7 @@ int __stdcall EventExtendedAllGet (int SocketIndex, char * EventActionConfigurat /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1099,7 +1347,7 @@ int __stdcall EventExtendedGet (int SocketIndex, int ID, char * EventTriggerConf /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1149,7 +1397,7 @@ int __stdcall EventExtendedRemove (int SocketIndex, int ID) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1180,7 +1428,7 @@ int __stdcall EventExtendedWait (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1212,7 +1460,7 @@ int __stdcall GatheringConfigurationGet (int SocketIndex, char * Type) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1261,13 +1509,13 @@ int __stdcall GatheringConfigurationSet (int SocketIndex, int NbElements, char * char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, TypeList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -1293,7 +1541,7 @@ int __stdcall GatheringConfigurationSet (int SocketIndex, int NbElements, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1326,7 +1574,7 @@ int __stdcall GatheringCurrentNumberGet (int SocketIndex, int * CurrentNumber, i /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1371,7 +1619,7 @@ int __stdcall GatheringStopAndSave (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1402,7 +1650,7 @@ int __stdcall GatheringDataAcquire (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1435,7 +1683,7 @@ int __stdcall GatheringDataGet (int SocketIndex, int IndexPoint, char * DataBuff /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1458,6 +1706,53 @@ int __stdcall GatheringDataGet (int SocketIndex, int IndexPoint, char * DataBuff } +/*********************************************************************** + * GatheringDataMultipleLinesGet : Get multiple data lines from gathering buffer + * + * - Parameters : + * int SocketIndex + * int IndexPoint + * int NumberOfLines + * char *DataBufferLine + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GatheringDataMultipleLinesGet (int SocketIndex, int IndexPoint, int NumberOfLines, char * DataBufferLine) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_HUGE); + + /* Convert to string */ + sprintf (ExecuteMethod, "GatheringDataMultipleLinesGet (%d,%d,char *)", IndexPoint, NumberOfLines); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (DataBufferLine, pt); + ptNext = strchr (DataBufferLine, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GatheringReset : Empty the gathered data in memory to start new gathering from scratch * @@ -1479,7 +1774,102 @@ int __stdcall GatheringReset (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * GatheringRun : Start a new gathering + * + * - Parameters : + * int SocketIndex + * int DataNumber + * int Divisor + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GatheringRun (int SocketIndex, int DataNumber, int Divisor) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GatheringRun (%d,%d)", DataNumber, Divisor); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * GatheringRunAppend : Re-start the stopped gathering to add new data + * + * - Parameters : + * int SocketIndex + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GatheringRunAppend (int SocketIndex) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GatheringRunAppend ()"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * GatheringStop : Stop the data gathering (without saving to file) + * + * - Parameters : + * int SocketIndex + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GatheringStop (int SocketIndex) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GatheringStop ()"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1515,13 +1905,13 @@ int __stdcall GatheringExternalConfigurationSet (int SocketIndex, int NbElements char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, TypeList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -1547,7 +1937,7 @@ int __stdcall GatheringExternalConfigurationSet (int SocketIndex, int NbElements /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1579,7 +1969,7 @@ int __stdcall GatheringExternalConfigurationGet (int SocketIndex, char * Type) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1625,7 +2015,7 @@ int __stdcall GatheringExternalCurrentNumberGet (int SocketIndex, int * CurrentN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1649,6 +2039,52 @@ int __stdcall GatheringExternalCurrentNumberGet (int SocketIndex, int * CurrentN } +/*********************************************************************** + * GatheringExternalDataGet : Get a data line from external gathering buffer + * + * - Parameters : + * int SocketIndex + * int IndexPoint + * char *DataBufferLine + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GatheringExternalDataGet (int SocketIndex, int IndexPoint, char * DataBufferLine) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GatheringExternalDataGet (%d,char *)", IndexPoint); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (DataBufferLine, pt); + ptNext = strchr (DataBufferLine, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GatheringExternalStopAndSave : Stop acquisition and save data * @@ -1670,7 +2106,7 @@ int __stdcall GatheringExternalStopAndSave (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1703,7 +2139,7 @@ int __stdcall GlobalArrayGet (int SocketIndex, int Number, char * ValueString) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1749,7 +2185,84 @@ int __stdcall GlobalArraySet (int SocketIndex, int Number, char * ValueString) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * DoubleGlobalArrayGet : Get double global array value + * + * - Parameters : + * int SocketIndex + * int Number + * double *DoubleValue + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall DoubleGlobalArrayGet (int SocketIndex, int Number, double * DoubleValue) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "DoubleGlobalArrayGet (%d,double *)", Number); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", DoubleValue); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * DoubleGlobalArraySet : Set double global array value + * + * - Parameters : + * int SocketIndex + * int Number + * double DoubleValue + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall DoubleGlobalArraySet (int SocketIndex, int Number, double DoubleValue) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "DoubleGlobalArraySet (%d,%.13g)", Number, DoubleValue); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1786,13 +2299,13 @@ int __stdcall GPIOAnalogGet (int SocketIndex, int NbElements, char * GPIONameLis char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -1818,7 +2331,7 @@ int __stdcall GPIOAnalogGet (int SocketIndex, int NbElements, char * GPIONameLis /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -1870,13 +2383,13 @@ int __stdcall GPIOAnalogSet (int SocketIndex, int NbElements, char * GPIONameLis char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -1902,7 +2415,7 @@ int __stdcall GPIOAnalogSet (int SocketIndex, int NbElements, char * GPIONameLis /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -1939,13 +2452,13 @@ int __stdcall GPIOAnalogGainGet (int SocketIndex, int NbElements, char * GPIONam char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -1971,7 +2484,7 @@ int __stdcall GPIOAnalogGainGet (int SocketIndex, int NbElements, char * GPIONam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2023,13 +2536,13 @@ int __stdcall GPIOAnalogGainSet (int SocketIndex, int NbElements, char * GPIONam char (*stringArray0)[SIZE_NAME]; stringArray0 = new char [NbElements][SIZE_NAME]; - memset(stringArray0,'\0', SIZE_NAME*NbElements); indice = 0; strncpyWithEOS(list, GPIONameList, SIZE_NOMINAL, SIZE_NOMINAL); list_r = NULL; token = strtok_r (list, seps, &list_r); while ((NULL != token) && (indice < NbElements)) { + memset(stringArray0[indice],'\0', SIZE_NAME); strncpyWithEOS(stringArray0[indice], token, SIZE_NAME, SIZE_NAME); token = strtok_r (NULL, seps, &list_r); indice++; @@ -2055,7 +2568,7 @@ int __stdcall GPIOAnalogGainSet (int SocketIndex, int NbElements, char * GPIONam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2088,7 +2601,7 @@ int __stdcall GPIODigitalGet (int SocketIndex, char * GPIOName, unsigned short * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2133,7 +2646,7 @@ int __stdcall GPIODigitalSet (int SocketIndex, char * GPIOName, unsigned short M /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2143,6 +2656,66 @@ int __stdcall GPIODigitalSet (int SocketIndex, char * GPIOName, unsigned short M } +/*********************************************************************** + * GroupAccelerationSetpointGet : Return setpoint accelerations + * + * - Parameters : + * int SocketIndex + * char *GroupName + * int nbElement + * double *SetpointAcceleration + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GroupAccelerationSetpointGet (int SocketIndex, char * GroupName, int NbElements, double SetpointAcceleration[]) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + char temp[SIZE_NOMINAL]; + + /* Convert to string */ + sprintf (ExecuteMethod, "GroupAccelerationSetpointGet (%s,", GroupName); + for (int i = 0; i < NbElements; i++) + { + sprintf (temp, "double *"); + strncat (ExecuteMethod, temp, SIZE_SMALL); + if ((i + 1) < NbElements) + { + strncat (ExecuteMethod, ",", SIZE_SMALL); + } + } + strcat (ExecuteMethod, ")"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + + for (int i = 0; i < NbElements; i++) + { + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", &SetpointAcceleration[i]); + } + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GroupAnalogTrackingModeEnable : Enable Analog Tracking mode on selected group * @@ -2166,7 +2739,7 @@ int __stdcall GroupAnalogTrackingModeEnable (int SocketIndex, char * GroupName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2198,7 +2771,7 @@ int __stdcall GroupAnalogTrackingModeDisable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2243,7 +2816,7 @@ int __stdcall GroupCorrectorOutputGet (int SocketIndex, char * GroupName, int Nb /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2268,6 +2841,66 @@ int __stdcall GroupCorrectorOutputGet (int SocketIndex, char * GroupName, int Nb } +/*********************************************************************** + * GroupCurrentFollowingErrorGet : Return current following errors + * + * - Parameters : + * int SocketIndex + * char *GroupName + * int nbElement + * double *CurrentFollowingError + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GroupCurrentFollowingErrorGet (int SocketIndex, char * GroupName, int NbElements, double CurrentFollowingError[]) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + char temp[SIZE_NOMINAL]; + + /* Convert to string */ + sprintf (ExecuteMethod, "GroupCurrentFollowingErrorGet (%s,", GroupName); + for (int i = 0; i < NbElements; i++) + { + sprintf (temp, "double *"); + strncat (ExecuteMethod, temp, SIZE_SMALL); + if ((i + 1) < NbElements) + { + strncat (ExecuteMethod, ",", SIZE_SMALL); + } + } + strcat (ExecuteMethod, ")"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + + for (int i = 0; i < NbElements; i++) + { + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", &CurrentFollowingError[i]); + } + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GroupHomeSearch : Start home search sequence * @@ -2290,7 +2923,7 @@ int __stdcall GroupHomeSearch (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2334,7 +2967,7 @@ int __stdcall GroupHomeSearchAndRelativeMove (int SocketIndex, char * GroupName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2366,7 +2999,7 @@ int __stdcall GroupInitialize (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2398,7 +3031,7 @@ int __stdcall GroupInitializeWithEncoderCalibration (int SocketIndex, char * Gro /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2443,7 +3076,7 @@ int __stdcall GroupJogParametersSet (int SocketIndex, char * GroupName, int NbEl /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2489,7 +3122,7 @@ int __stdcall GroupJogParametersGet (int SocketIndex, char * GroupName, int NbEl /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2553,7 +3186,7 @@ int __stdcall GroupJogCurrentGet (int SocketIndex, char * GroupName, int NbEleme /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2603,7 +3236,7 @@ int __stdcall GroupJogModeEnable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2635,7 +3268,7 @@ int __stdcall GroupJogModeDisable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2667,7 +3300,7 @@ int __stdcall GroupKill (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2699,7 +3332,7 @@ int __stdcall GroupMoveAbort (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2743,7 +3376,7 @@ int __stdcall GroupMoveAbsolute (int SocketIndex, char * GroupName, int NbElemen /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2787,7 +3420,7 @@ int __stdcall GroupMoveRelative (int SocketIndex, char * GroupName, int NbElemen /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2819,7 +3452,7 @@ int __stdcall GroupMotionDisable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2851,7 +3484,7 @@ int __stdcall GroupMotionEnable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -2861,6 +3494,56 @@ int __stdcall GroupMotionEnable (int SocketIndex, char * GroupName) } +/*********************************************************************** + * GroupPositionCorrectedProfilerGet : Return corrected profiler positions + * + * - Parameters : + * int SocketIndex + * char *GroupName + * double PositionX + * double PositionY + * double *CorrectedProfilerPositionX + * double *CorrectedProfilerPositionY + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GroupPositionCorrectedProfilerGet (int SocketIndex, char * GroupName, double PositionX, double PositionY, double * CorrectedProfilerPositionX, double * CorrectedProfilerPositionY) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GroupPositionCorrectedProfilerGet (%s,%.13g,%.13g,double *,double *)", GroupName, PositionX, PositionY); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CorrectedProfilerPositionX); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CorrectedProfilerPositionY); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GroupPositionCurrentGet : Return current positions * @@ -2896,7 +3579,7 @@ int __stdcall GroupPositionCurrentGet (int SocketIndex, char * GroupName, int Nb /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -2921,6 +3604,56 @@ int __stdcall GroupPositionCurrentGet (int SocketIndex, char * GroupName, int Nb } +/*********************************************************************** + * GroupPositionPCORawEncoderGet : Return PCO raw encoder positions + * + * - Parameters : + * int SocketIndex + * char *GroupName + * double PositionX + * double PositionY + * double *PCORawPositionX + * double *PCORawPositionY + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall GroupPositionPCORawEncoderGet (int SocketIndex, char * GroupName, double PositionX, double PositionY, double * PCORawPositionX, double * PCORawPositionY) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "GroupPositionPCORawEncoderGet (%s,%.13g,%.13g,double *,double *)", GroupName, PositionX, PositionY); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", PCORawPositionX); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", PCORawPositionY); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * GroupPositionSetpointGet : Return setpoint positions * @@ -2956,7 +3689,7 @@ int __stdcall GroupPositionSetpointGet (int SocketIndex, char * GroupName, int N /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3016,7 +3749,7 @@ int __stdcall GroupPositionTargetGet (int SocketIndex, char * GroupName, int NbE /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3066,7 +3799,7 @@ int __stdcall GroupReferencingActionExecute (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3098,7 +3831,7 @@ int __stdcall GroupReferencingStart (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3130,7 +3863,7 @@ int __stdcall GroupReferencingStop (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3163,7 +3896,7 @@ int __stdcall GroupStatusGet (int SocketIndex, char * GroupName, int * Status) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3207,7 +3940,7 @@ int __stdcall GroupStatusStringGet (int SocketIndex, int GroupStatusCode, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3265,7 +3998,7 @@ int __stdcall GroupVelocityCurrentGet (int SocketIndex, char * GroupName, int Nb /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3311,7 +4044,7 @@ int __stdcall KillAll (int SocketIndex) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3348,7 +4081,7 @@ int __stdcall PositionerAnalogTrackingPositionParametersGet (int SocketIndex, ch /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3410,7 +4143,7 @@ int __stdcall PositionerAnalogTrackingPositionParametersSet (int SocketIndex, ch /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3449,7 +4182,7 @@ int __stdcall PositionerAnalogTrackingVelocityParametersGet (int SocketIndex, ch /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3519,7 +4252,7 @@ int __stdcall PositionerAnalogTrackingVelocityParametersSet (int SocketIndex, ch /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3553,7 +4286,7 @@ int __stdcall PositionerBacklashGet (int SocketIndex, char * PositionerName, dou /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3602,7 +4335,7 @@ int __stdcall PositionerBacklashSet (int SocketIndex, char * PositionerName, dou /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3634,7 +4367,7 @@ int __stdcall PositionerBacklashEnable (int SocketIndex, char * PositionerName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3666,7 +4399,7 @@ int __stdcall PositionerBacklashDisable (int SocketIndex, char * PositionerName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3704,7 +4437,7 @@ int __stdcall PositionerCorrectorNotchFiltersSet (int SocketIndex, char * Positi /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3742,7 +4475,7 @@ int __stdcall PositionerCorrectorNotchFiltersGet (int SocketIndex, char * Positi /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3812,7 +4545,7 @@ int __stdcall PositionerCorrectorPIDFFAccelerationSet (int SocketIndex, char * P /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3846,9 +4579,9 @@ int __stdcall PositionerCorrectorPIDFFAccelerationSet (int SocketIndex, char * P int __stdcall PositionerCorrectorPIDFFAccelerationGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainAcceleration) { int ret = -1; - char ExecuteMethod[SIZE_EXECUTE_METHOD]; - int temp; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerCorrectorPIDFFAccelerationGet (%s,bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)", PositionerName); @@ -3857,7 +4590,7 @@ int __stdcall PositionerCorrectorPIDFFAccelerationGet (int SocketIndex, char * P /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -3869,8 +4602,8 @@ int __stdcall PositionerCorrectorPIDFFAccelerationGet (int SocketIndex, char * P ptNext = NULL; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *ClosedLoopStatus = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *ClosedLoopStatus = (bool) boolScanTmp; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", KP); @@ -3946,7 +4679,7 @@ int __stdcall PositionerCorrectorPIDFFVelocitySet (int SocketIndex, char * Posit /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -3980,9 +4713,9 @@ int __stdcall PositionerCorrectorPIDFFVelocitySet (int SocketIndex, char * Posit int __stdcall PositionerCorrectorPIDFFVelocityGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainVelocity) { int ret = -1; - int temp; char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerCorrectorPIDFFVelocityGet (%s,bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)", PositionerName); @@ -3991,7 +4724,7 @@ int __stdcall PositionerCorrectorPIDFFVelocityGet (int SocketIndex, char * Posit /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4003,8 +4736,8 @@ int __stdcall PositionerCorrectorPIDFFVelocityGet (int SocketIndex, char * Posit ptNext = NULL; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *ClosedLoopStatus = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *ClosedLoopStatus = (bool) boolScanTmp; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", KP); @@ -4082,7 +4815,7 @@ int __stdcall PositionerCorrectorPIDDualFFVoltageSet (int SocketIndex, char * Po /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -4118,9 +4851,9 @@ int __stdcall PositionerCorrectorPIDDualFFVoltageSet (int SocketIndex, char * Po int __stdcall PositionerCorrectorPIDDualFFVoltageGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * KD, double * KS, double * IntegrationTime, double * DerivativeFilterCutOffFrequency, double * GKP, double * GKI, double * GKD, double * KForm, double * FeedForwardGainVelocity, double * FeedForwardGainAcceleration, double * Friction) { int ret = -1; - int temp; char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerCorrectorPIDDualFFVoltageGet (%s,bool *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *,double *)", PositionerName); @@ -4129,7 +4862,7 @@ int __stdcall PositionerCorrectorPIDDualFFVoltageGet (int SocketIndex, char * Po /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4141,8 +4874,8 @@ int __stdcall PositionerCorrectorPIDDualFFVoltageGet (int SocketIndex, char * Po ptNext = NULL; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *ClosedLoopStatus = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *ClosedLoopStatus = (bool) boolScanTmp; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", KP); @@ -4216,7 +4949,7 @@ int __stdcall PositionerCorrectorPIPositionSet (int SocketIndex, char * Position /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -4242,9 +4975,9 @@ int __stdcall PositionerCorrectorPIPositionSet (int SocketIndex, char * Position int __stdcall PositionerCorrectorPIPositionGet (int SocketIndex, char * PositionerName, bool * ClosedLoopStatus, double * KP, double * KI, double * IntegrationTime) { int ret = -1; - int temp; char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerCorrectorPIPositionGet (%s,bool *,double *,double *,double *)", PositionerName); @@ -4253,7 +4986,7 @@ int __stdcall PositionerCorrectorPIPositionGet (int SocketIndex, char * Position /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4265,8 +4998,8 @@ int __stdcall PositionerCorrectorPIPositionGet (int SocketIndex, char * Position ptNext = NULL; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *ClosedLoopStatus = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *ClosedLoopStatus = (bool) boolScanTmp; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", KP); @@ -4307,7 +5040,7 @@ int __stdcall PositionerCorrectorTypeGet (int SocketIndex, char * PositionerName /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4331,41 +5064,7 @@ int __stdcall PositionerCorrectorTypeGet (int SocketIndex, char * PositionerName /*********************************************************************** - * PositionerCurrentVelocityAccelerationFiltersSet : Set current velocity and acceleration cut off frequencies - * - * - Parameters : - * int SocketIndex - * char *PositionerName - * double CurrentVelocityCutOffFrequency - * double CurrentAccelerationCutOffFrequency - * - Return : - * int errorCode - ***********************************************************************/ -int __stdcall PositionerCurrentVelocityAccelerationFiltersSet (int SocketIndex, char * PositionerName, double CurrentVelocityCutOffFrequency, double CurrentAccelerationCutOffFrequency) -{ - int ret = -1; - char ExecuteMethod[SIZE_EXECUTE_METHOD]; - char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); - - /* Convert to string */ - sprintf (ExecuteMethod, "PositionerCurrentVelocityAccelerationFiltersSet (%s,%.13g,%.13g)", PositionerName, CurrentVelocityCutOffFrequency, CurrentAccelerationCutOffFrequency); - - /* Send this string and wait return function from controller */ - /* return function : ==0 -> OK ; < 0 -> NOK */ - SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); - if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); - - /* Get the returned values in the out parameters */ - if (NULL != ReturnedValue) - free (ReturnedValue); - - return (ret); -} - - -/*********************************************************************** - * PositionerCurrentVelocityAccelerationFiltersGet : Get current velocity and acceleration cut off frequencies + * PositionerCurrentVelocityAccelerationFiltersGet : Get current velocity and acceleration cutoff frequencies * * - Parameters : * int SocketIndex @@ -4388,7 +5087,7 @@ int __stdcall PositionerCurrentVelocityAccelerationFiltersGet (int SocketIndex, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4412,6 +5111,185 @@ int __stdcall PositionerCurrentVelocityAccelerationFiltersGet (int SocketIndex, } +/*********************************************************************** + * PositionerCurrentVelocityAccelerationFiltersSet : Set current velocity and acceleration cutoff frequencies + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double CurrentVelocityCutOffFrequency + * double CurrentAccelerationCutOffFrequency + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerCurrentVelocityAccelerationFiltersSet (int SocketIndex, char * PositionerName, double CurrentVelocityCutOffFrequency, double CurrentAccelerationCutOffFrequency) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerCurrentVelocityAccelerationFiltersSet (%s,%.13g,%.13g)", PositionerName, CurrentVelocityCutOffFrequency, CurrentAccelerationCutOffFrequency); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDriverFiltersGet : Get driver filters parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double *KI + * double *NotchFrequency + * double *NotchBandwidth + * double *NotchGain + * double *LowpassFrequency + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDriverFiltersGet (int SocketIndex, char * PositionerName, double * KI, double * NotchFrequency, double * NotchBandwidth, double * NotchGain, double * LowpassFrequency) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDriverFiltersGet (%s,double *,double *,double *,double *,double *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", KI); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", NotchFrequency); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", NotchBandwidth); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", NotchGain); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", LowpassFrequency); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDriverFiltersSet : Set driver filters parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double KI + * double NotchFrequency + * double NotchBandwidth + * double NotchGain + * double LowpassFrequency + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDriverFiltersSet (int SocketIndex, char * PositionerName, double KI, double NotchFrequency, double NotchBandwidth, double NotchGain, double LowpassFrequency) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDriverFiltersSet (%s,%.13g,%.13g,%.13g,%.13g,%.13g)", PositionerName, KI, NotchFrequency, NotchBandwidth, NotchGain, LowpassFrequency); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDriverPositionOffsetsGet : Get driver stage and gage position offset + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double *StagePositionOffset + * double *GagePositionOffset + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDriverPositionOffsetsGet (int SocketIndex, char * PositionerName, double * StagePositionOffset, double * GagePositionOffset) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDriverPositionOffsetsGet (%s,double *,double *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", StagePositionOffset); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", GagePositionOffset); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * PositionerDriverStatusGet : Read positioner driver status * @@ -4435,7 +5313,7 @@ int __stdcall PositionerDriverStatusGet (int SocketIndex, char * PositionerName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4479,7 +5357,7 @@ int __stdcall PositionerDriverStatusStringGet (int SocketIndex, int PositionerDr /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4508,14 +5386,14 @@ int __stdcall PositionerDriverStatusStringGet (int SocketIndex, int PositionerDr * - Parameters : * int SocketIndex * char *PositionerName - * double *MaxSinusAmplitude + * double *CalibrationSinusAmplitude * double *CurrentSinusAmplitude - * double *MaxCosinusAmplitude + * double *CalibrationCosinusAmplitude * double *CurrentCosinusAmplitude * - Return : * int errorCode ***********************************************************************/ -int __stdcall PositionerEncoderAmplitudeValuesGet (int SocketIndex, char * PositionerName, double * MaxSinusAmplitude, double * CurrentSinusAmplitude, double * MaxCosinusAmplitude, double * CurrentCosinusAmplitude) +int __stdcall PositionerEncoderAmplitudeValuesGet (int SocketIndex, char * PositionerName, double * CalibrationSinusAmplitude, double * CurrentSinusAmplitude, double * CalibrationCosinusAmplitude, double * CurrentCosinusAmplitude) { int ret = -1; char ExecuteMethod[SIZE_EXECUTE_METHOD]; @@ -4528,7 +5406,7 @@ int __stdcall PositionerEncoderAmplitudeValuesGet (int SocketIndex, char * Posit /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4540,13 +5418,13 @@ int __stdcall PositionerEncoderAmplitudeValuesGet (int SocketIndex, char * Posit ptNext = NULL; if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%lf", MaxSinusAmplitude); + if (pt != NULL) sscanf (pt, "%lf", CalibrationSinusAmplitude); if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", CurrentSinusAmplitude); if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%lf", MaxCosinusAmplitude); + if (pt != NULL) sscanf (pt, "%lf", CalibrationCosinusAmplitude); if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; if (pt != NULL) sscanf (pt, "%lf", CurrentCosinusAmplitude); @@ -4584,7 +5462,7 @@ int __stdcall PositionerEncoderCalibrationParametersGet (int SocketIndex, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4637,7 +5515,7 @@ int __stdcall PositionerErrorGet (int SocketIndex, char * PositionerName, int * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4681,7 +5559,7 @@ int __stdcall PositionerErrorRead (int SocketIndex, char * PositionerName, int * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4725,7 +5603,7 @@ int __stdcall PositionerErrorStringGet (int SocketIndex, int PositionerErrorCode /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4748,6 +5626,142 @@ int __stdcall PositionerErrorStringGet (int SocketIndex, int PositionerErrorCode } +/*********************************************************************** + * PositionerExcitationSignalGet : Read disturbing signal parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * int *Mode + * double *Frequency + * double *Amplitude + * double *Time + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerExcitationSignalGet (int SocketIndex, char * PositionerName, int * Mode, double * Frequency, double * Amplitude, double * Time) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerExcitationSignalGet (%s,int *,double *,double *,double *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%d", Mode); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", Frequency); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", Amplitude); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", Time); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerExcitationSignalSet : Update disturbing signal parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * int Mode + * double Frequency + * double Amplitude + * double Time + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerExcitationSignalSet (int SocketIndex, char * PositionerName, int Mode, double Frequency, double Amplitude, double Time) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerExcitationSignalSet (%s,%d,%.13g,%.13g,%.13g)", PositionerName, Mode, Frequency, Amplitude, Time); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerExternalLatchPositionGet : Read external latch position + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double *Position + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerExternalLatchPositionGet (int SocketIndex, char * PositionerName, double * Position) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerExternalLatchPositionGet (%s,double *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", Position); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * PositionerHardwareStatusGet : Read positioner hardware status * @@ -4771,7 +5785,7 @@ int __stdcall PositionerHardwareStatusGet (int SocketIndex, char * PositionerNam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4815,7 +5829,7 @@ int __stdcall PositionerHardwareStatusStringGet (int SocketIndex, int Positioner /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4861,7 +5875,7 @@ int __stdcall PositionerHardInterpolatorFactorGet (int SocketIndex, char * Posit /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4905,7 +5919,7 @@ int __stdcall PositionerHardInterpolatorFactorSet (int SocketIndex, char * Posit /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -4939,7 +5953,7 @@ int __stdcall PositionerMaximumVelocityAndAccelerationGet (int SocketIndex, char /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -4990,7 +6004,7 @@ int __stdcall PositionerMotionDoneGet (int SocketIndex, char * PositionerName, d /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5050,7 +6064,127 @@ int __stdcall PositionerMotionDoneSet (int SocketIndex, char * PositionerName, d /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerPositionCompareAquadBAlwaysEnable : Enable AquadB signal in always mode + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerPositionCompareAquadBAlwaysEnable (int SocketIndex, char * PositionerName) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerPositionCompareAquadBAlwaysEnable (%s)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerPositionCompareAquadBWindowedGet : Read position compare AquadB windowed parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double *MinimumPosition + * double *MaximumPosition + * bool *EnableState + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerPositionCompareAquadBWindowedGet (int SocketIndex, char * PositionerName, double * MinimumPosition, double * MaximumPosition, bool * EnableState) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerPositionCompareAquadBWindowedGet (%s,double *,double *,bool *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MinimumPosition); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MaximumPosition); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *EnableState = (bool) boolScanTmp; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerPositionCompareAquadBWindowedSet : Set position compare AquadB windowed parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double MinimumPosition + * double MaximumPosition + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerPositionCompareAquadBWindowedSet (int SocketIndex, char * PositionerName, double MinimumPosition, double MaximumPosition) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerPositionCompareAquadBWindowedSet (%s,%.13g,%.13g)", PositionerName, MinimumPosition, MaximumPosition); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5076,9 +6210,9 @@ int __stdcall PositionerMotionDoneSet (int SocketIndex, char * PositionerName, d int __stdcall PositionerPositionCompareGet (int SocketIndex, char * PositionerName, double * MinimumPosition, double * MaximumPosition, double * PositionStep, bool * EnableState) { int ret = -1; - int temp; char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerPositionCompareGet (%s,double *,double *,double *,bool *)", PositionerName); @@ -5087,7 +6221,7 @@ int __stdcall PositionerPositionCompareGet (int SocketIndex, char * PositionerNa /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5108,8 +6242,8 @@ int __stdcall PositionerPositionCompareGet (int SocketIndex, char * PositionerNa if (pt != NULL) sscanf (pt, "%lf", PositionStep); if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *EnableState = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *EnableState = (bool) boolScanTmp; } if (NULL != ReturnedValue) free (ReturnedValue); @@ -5143,7 +6277,7 @@ int __stdcall PositionerPositionCompareSet (int SocketIndex, char * PositionerNa /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5175,7 +6309,7 @@ int __stdcall PositionerPositionCompareEnable (int SocketIndex, char * Positione /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5207,7 +6341,7 @@ int __stdcall PositionerPositionCompareDisable (int SocketIndex, char * Position /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5217,6 +6351,133 @@ int __stdcall PositionerPositionCompareDisable (int SocketIndex, char * Position } +/*********************************************************************** + * PositionerPositionComparePulseParametersGet : Get position compare PCO pulse parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double *PCOPulseWidth + * double *EncoderSettlingTime + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerPositionComparePulseParametersGet (int SocketIndex, char * PositionerName, double * PCOPulseWidth, double * EncoderSettlingTime) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerPositionComparePulseParametersGet (%s,double *,double *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", PCOPulseWidth); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", EncoderSettlingTime); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerPositionComparePulseParametersSet : Set position compare PCO pulse parameters + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double PCOPulseWidth + * double EncoderSettlingTime + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerPositionComparePulseParametersSet (int SocketIndex, char * PositionerName, double PCOPulseWidth, double EncoderSettlingTime) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerPositionComparePulseParametersSet (%s,%.13g,%.13g)", PositionerName, PCOPulseWidth, EncoderSettlingTime); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerRawEncoderPositionGet : Get the raw encoder position + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * double UserEncoderPosition + * double *RawEncoderPosition + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerRawEncoderPositionGet (int SocketIndex, char * PositionerName, double UserEncoderPosition, double * RawEncoderPosition) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerRawEncoderPositionGet (%s,%.13g,double *)", PositionerName, UserEncoderPosition); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", RawEncoderPosition); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * PositionersEncoderIndexDifferenceGet : Return the difference between index of primary axis and secondary axis (only after homesearch) * @@ -5240,7 +6501,7 @@ int __stdcall PositionersEncoderIndexDifferenceGet (int SocketIndex, char * Posi /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5285,7 +6546,7 @@ int __stdcall PositionerSGammaExactVelocityAjustedDisplacementGet (int SocketInd /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5332,7 +6593,7 @@ int __stdcall PositionerSGammaParametersGet (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5388,7 +6649,7 @@ int __stdcall PositionerSGammaParametersSet (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5422,7 +6683,7 @@ int __stdcall PositionerSGammaPreviousMotionTimesGet (int SocketIndex, char * Po /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5470,7 +6731,7 @@ int __stdcall PositionerStageParameterGet (int SocketIndex, char * PositionerNam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5517,7 +6778,7 @@ int __stdcall PositionerStageParameterSet (int SocketIndex, char * PositionerNam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5543,9 +6804,9 @@ int __stdcall PositionerStageParameterSet (int SocketIndex, char * PositionerNam int __stdcall PositionerTimeFlasherGet (int SocketIndex, char * PositionerName, double * MinimumPosition, double * MaximumPosition, double * PositionStep, bool * EnableState) { int ret = -1; - int temp; char ExecuteMethod[SIZE_EXECUTE_METHOD]; char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + int boolScanTmp; /* Convert to string */ sprintf (ExecuteMethod, "PositionerTimeFlasherGet (%s,double *,double *,double *,bool *)", PositionerName); @@ -5554,7 +6815,7 @@ int __stdcall PositionerTimeFlasherGet (int SocketIndex, char * PositionerName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5575,8 +6836,8 @@ int __stdcall PositionerTimeFlasherGet (int SocketIndex, char * PositionerName, if (pt != NULL) sscanf (pt, "%lf", PositionStep); if (pt != NULL) pt = strchr (pt, ','); if (pt != NULL) pt++; - if (pt != NULL) sscanf (pt, "%d", &temp); - *EnableState = bool(temp); + if (pt != NULL) sscanf (pt, "%d", &boolScanTmp); + *EnableState = (bool) boolScanTmp; } if (NULL != ReturnedValue) free (ReturnedValue); @@ -5610,7 +6871,7 @@ int __stdcall PositionerTimeFlasherSet (int SocketIndex, char * PositionerName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5642,7 +6903,7 @@ int __stdcall PositionerTimeFlasherEnable (int SocketIndex, char * PositionerNam /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5674,7 +6935,7 @@ int __stdcall PositionerTimeFlasherDisable (int SocketIndex, char * PositionerNa /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5708,7 +6969,7 @@ int __stdcall PositionerUserTravelLimitsGet (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5756,7 +7017,181 @@ int __stdcall PositionerUserTravelLimitsSet (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDACOffsetGet : Get DAC offsets + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * short *DACOffset1 + * short *DACOffset2 + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDACOffsetGet (int SocketIndex, char * PositionerName, short * DACOffset1, short * DACOffset2) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDACOffsetGet (%s,short *,short *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", DACOffset1); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", DACOffset2); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDACOffsetSet : Set DAC offsets + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * short DACOffset1 + * short DACOffset2 + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDACOffsetSet (int SocketIndex, char * PositionerName, short DACOffset1, short DACOffset2) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDACOffsetSet (%s,%d,%d)", PositionerName, DACOffset1, DACOffset2); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDACOffsetDualGet : Get dual DAC offsets + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * short *PrimaryDACOffset1 + * short *PrimaryDACOffset2 + * short *SecondaryDACOffset1 + * short *SecondaryDACOffset2 + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDACOffsetDualGet (int SocketIndex, char * PositionerName, short * PrimaryDACOffset1, short * PrimaryDACOffset2, short * SecondaryDACOffset1, short * SecondaryDACOffset2) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDACOffsetDualGet (%s,short *,short *,short *,short *)", PositionerName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", PrimaryDACOffset1); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", PrimaryDACOffset2); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", SecondaryDACOffset1); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%hd", SecondaryDACOffset2); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * PositionerDACOffsetDualSet : Set dual DAC offsets + * + * - Parameters : + * int SocketIndex + * char *PositionerName + * short PrimaryDACOffset1 + * short PrimaryDACOffset2 + * short SecondaryDACOffset1 + * short SecondaryDACOffset2 + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall PositionerDACOffsetDualSet (int SocketIndex, char * PositionerName, short PrimaryDACOffset1, short PrimaryDACOffset2, short SecondaryDACOffset1, short SecondaryDACOffset2) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "PositionerDACOffsetDualSet (%s,%d,%d,%d,%d)", PositionerName, PrimaryDACOffset1, PrimaryDACOffset2, SecondaryDACOffset1, SecondaryDACOffset2); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5792,7 +7227,7 @@ int __stdcall PositionerCorrectorAutoTuning (int SocketIndex, char * PositionerN /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5842,7 +7277,7 @@ int __stdcall PositionerAccelerationAutoScaling (int SocketIndex, char * Positio /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5886,7 +7321,7 @@ int __stdcall MultipleAxesPVTVerification (int SocketIndex, char * GroupName, ch /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -5923,7 +7358,7 @@ int __stdcall MultipleAxesPVTVerificationResultGet (int SocketIndex, char * Posi /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -5982,7 +7417,7 @@ int __stdcall MultipleAxesPVTExecution (int SocketIndex, char * GroupName, char /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6016,7 +7451,7 @@ int __stdcall MultipleAxesPVTParametersGet (int SocketIndex, char * GroupName, c /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6067,7 +7502,7 @@ int __stdcall MultipleAxesPVTPulseOutputSet (int SocketIndex, char * GroupName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6102,7 +7537,7 @@ int __stdcall MultipleAxesPVTPulseOutputGet (int SocketIndex, char * GroupName, /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6151,7 +7586,7 @@ int __stdcall SingleAxisSlaveModeEnable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6183,7 +7618,7 @@ int __stdcall SingleAxisSlaveModeDisable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6217,7 +7652,7 @@ int __stdcall SingleAxisSlaveParametersSet (int SocketIndex, char * GroupName, c /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6251,7 +7686,7 @@ int __stdcall SingleAxisSlaveParametersGet (int SocketIndex, char * GroupName, c /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6299,7 +7734,7 @@ int __stdcall SpindleSlaveModeEnable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6331,7 +7766,7 @@ int __stdcall SpindleSlaveModeDisable (int SocketIndex, char * GroupName) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6365,7 +7800,7 @@ int __stdcall SpindleSlaveParametersSet (int SocketIndex, char * GroupName, char /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6399,7 +7834,7 @@ int __stdcall SpindleSlaveParametersGet (int SocketIndex, char * GroupName, char /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6449,7 +7884,7 @@ int __stdcall GroupSpinParametersSet (int SocketIndex, char * GroupName, double /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6483,7 +7918,7 @@ int __stdcall GroupSpinParametersGet (int SocketIndex, char * GroupName, double /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6531,7 +7966,7 @@ int __stdcall GroupSpinCurrentGet (int SocketIndex, char * GroupName, double * V /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6578,7 +8013,7 @@ int __stdcall GroupSpinModeStop (int SocketIndex, char * GroupName, double Accel /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6611,7 +8046,7 @@ int __stdcall XYLineArcVerification (int SocketIndex, char * GroupName, char * T /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6648,7 +8083,7 @@ int __stdcall XYLineArcVerificationResultGet (int SocketIndex, char * Positioner /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6709,7 +8144,7 @@ int __stdcall XYLineArcExecution (int SocketIndex, char * GroupName, char * Traj /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6745,7 +8180,7 @@ int __stdcall XYLineArcParametersGet (int SocketIndex, char * GroupName, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6802,7 +8237,7 @@ int __stdcall XYLineArcPulseOutputSet (int SocketIndex, char * GroupName, double /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6837,7 +8272,7 @@ int __stdcall XYLineArcPulseOutputGet (int SocketIndex, char * GroupName, double /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6864,6 +8299,61 @@ int __stdcall XYLineArcPulseOutputGet (int SocketIndex, char * GroupName, double } +/*********************************************************************** + * XYZGroupPositionCorrectedProfilerGet : Return corrected profiler positions + * + * - Parameters : + * int SocketIndex + * char *GroupName + * double PositionX + * double PositionY + * double PositionZ + * double *CorrectedProfilerPositionX + * double *CorrectedProfilerPositionY + * double *CorrectedProfilerPositionZ + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall XYZGroupPositionCorrectedProfilerGet (int SocketIndex, char * GroupName, double PositionX, double PositionY, double PositionZ, double * CorrectedProfilerPositionX, double * CorrectedProfilerPositionY, double * CorrectedProfilerPositionZ) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "XYZGroupPositionCorrectedProfilerGet (%s,%.13g,%.13g,%.13g,double *,double *,double *)", GroupName, PositionX, PositionY, PositionZ); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CorrectedProfilerPositionX); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CorrectedProfilerPositionY); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", CorrectedProfilerPositionZ); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * XYZSplineVerification : XYZ trajectory verifivation * @@ -6887,7 +8377,7 @@ int __stdcall XYZSplineVerification (int SocketIndex, char * GroupName, char * T /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -6924,7 +8414,7 @@ int __stdcall XYZSplineVerificationResultGet (int SocketIndex, char * Positioner /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -6984,7 +8474,7 @@ int __stdcall XYZSplineExecution (int SocketIndex, char * GroupName, char * Traj /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -7020,7 +8510,7 @@ int __stdcall XYZSplineParametersGet (int SocketIndex, char * GroupName, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7053,7 +8543,72 @@ int __stdcall XYZSplineParametersGet (int SocketIndex, char * GroupName, char * /*********************************************************************** - * EEPROMCIESet : XYZ trajectory get parameters + * OptionalModuleExecute : Execute an optional module + * + * - Parameters : + * int SocketIndex + * char *ModuleFileName + * char *TaskName + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall OptionalModuleExecute (int SocketIndex, char * ModuleFileName, char * TaskName) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "OptionalModuleExecute (%s,%s)", ModuleFileName, TaskName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * OptionalModuleKill : Kill an optional module + * + * - Parameters : + * int SocketIndex + * char *TaskName + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall OptionalModuleKill (int SocketIndex, char * TaskName) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "OptionalModuleKill (%s)", TaskName); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * EEPROMCIESet : Set CIE EEPROM reference string * * - Parameters : * int SocketIndex @@ -7075,7 +8630,7 @@ int __stdcall EEPROMCIESet (int SocketIndex, int CardNumber, char * ReferenceStr /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -7086,7 +8641,7 @@ int __stdcall EEPROMCIESet (int SocketIndex, int CardNumber, char * ReferenceStr /*********************************************************************** - * EEPROMDACOffsetCIESet : XYZ trajectory get parameters + * EEPROMDACOffsetCIESet : Set CIE DAC offsets * * - Parameters : * int SocketIndex @@ -7109,7 +8664,7 @@ int __stdcall EEPROMDACOffsetCIESet (int SocketIndex, int PlugNumber, double DAC /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -7120,7 +8675,7 @@ int __stdcall EEPROMDACOffsetCIESet (int SocketIndex, int PlugNumber, double DAC /*********************************************************************** - * EEPROMDriverSet : XYZ trajectory get parameters + * EEPROMDriverSet : Set Driver EEPROM reference string * * - Parameters : * int SocketIndex @@ -7142,7 +8697,7 @@ int __stdcall EEPROMDriverSet (int SocketIndex, int PlugNumber, char * Reference /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -7153,7 +8708,7 @@ int __stdcall EEPROMDriverSet (int SocketIndex, int PlugNumber, char * Reference /*********************************************************************** - * EEPROMINTSet : XYZ trajectory get parameters + * EEPROMINTSet : Set INT EEPROM reference string * * - Parameters : * int SocketIndex @@ -7175,7 +8730,7 @@ int __stdcall EEPROMINTSet (int SocketIndex, int CardNumber, char * ReferenceStr /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (NULL != ReturnedValue) @@ -7186,7 +8741,7 @@ int __stdcall EEPROMINTSet (int SocketIndex, int CardNumber, char * ReferenceStr /*********************************************************************** - * CPUCoreAndBoardSupplyVoltagesGet : XYZ trajectory get parameters + * CPUCoreAndBoardSupplyVoltagesGet : Get power informations * * - Parameters : * int SocketIndex @@ -7214,7 +8769,7 @@ int __stdcall CPUCoreAndBoardSupplyVoltagesGet (int SocketIndex, double * Voltag /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7257,7 +8812,7 @@ int __stdcall CPUCoreAndBoardSupplyVoltagesGet (int SocketIndex, double * Voltag /*********************************************************************** - * CPUTemperatureAndFanSpeedGet : XYZ trajectory get parameters + * CPUTemperatureAndFanSpeedGet : Get CPU temperature and fan speed * * - Parameters : * int SocketIndex @@ -7279,7 +8834,7 @@ int __stdcall CPUTemperatureAndFanSpeedGet (int SocketIndex, double * CPUTempera /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7325,7 +8880,7 @@ int __stdcall ActionListGet (int SocketIndex, char * ActionList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7370,7 +8925,7 @@ int __stdcall ActionExtendedListGet (int SocketIndex, char * ActionList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7415,7 +8970,7 @@ int __stdcall APIExtendedListGet (int SocketIndex, char * Method) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7460,7 +9015,7 @@ int __stdcall APIListGet (int SocketIndex, char * Method) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7483,6 +9038,51 @@ int __stdcall APIListGet (int SocketIndex, char * Method) } +/*********************************************************************** + * ControllerStatusListGet : Controller status list + * + * - Parameters : + * int SocketIndex + * char *ControllerStatusList + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerStatusListGet (int SocketIndex, char * ControllerStatusList) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerStatusListGet (char *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (ControllerStatusList, pt); + ptNext = strchr (ControllerStatusList, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * ErrorListGet : Error list * @@ -7505,7 +9105,7 @@ int __stdcall ErrorListGet (int SocketIndex, char * ErrorsList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7550,7 +9150,7 @@ int __stdcall EventListGet (int SocketIndex, char * EventList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7595,7 +9195,7 @@ int __stdcall GatheringListGet (int SocketIndex, char * list) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7640,7 +9240,7 @@ int __stdcall GatheringExtendedListGet (int SocketIndex, char * list) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7685,7 +9285,7 @@ int __stdcall GatheringExternalListGet (int SocketIndex, char * list) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7730,7 +9330,7 @@ int __stdcall GroupStatusListGet (int SocketIndex, char * GroupStatusList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7775,7 +9375,7 @@ int __stdcall HardwareInternalListGet (int SocketIndex, char * InternalHardwareL /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7822,7 +9422,7 @@ int __stdcall HardwareDriverAndStageGet (int SocketIndex, int PlugNumber, char * /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_NOMINAL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7872,7 +9472,7 @@ int __stdcall ObjectsListGet (int SocketIndex, char * ObjectsList) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_HUGE); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7917,7 +9517,7 @@ int __stdcall PositionerErrorListGet (int SocketIndex, char * PositionerErrorLis /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -7962,7 +9562,7 @@ int __stdcall PositionerHardwareStatusListGet (int SocketIndex, char * Positione /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -8007,7 +9607,7 @@ int __stdcall PositionerDriverStatusListGet (int SocketIndex, char * PositionerD /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -8052,7 +9652,7 @@ int __stdcall ReferencingActionListGet (int SocketIndex, char * list) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -8097,7 +9697,7 @@ int __stdcall ReferencingSensorListGet (int SocketIndex, char * list) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_BIG); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -8121,7 +9721,7 @@ int __stdcall ReferencingSensorListGet (int SocketIndex, char * list) /*********************************************************************** - * GatheringUserDatasGet : Return UserDatas values + * GatheringUserDatasGet : Return user data values * * - Parameters : * int SocketIndex @@ -8149,7 +9749,7 @@ int __stdcall GatheringUserDatasGet (int SocketIndex, double * UserData1, double /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0) @@ -8191,6 +9791,145 @@ int __stdcall GatheringUserDatasGet (int SocketIndex, double * UserData1, double } +/*********************************************************************** + * ControllerMotionKernelPeriodMinMaxGet : Get controller motion kernel min/max periods + * + * - Parameters : + * int SocketIndex + * double *MinimumCorrectorPeriod + * double *MaximumCorrectorPeriod + * double *MinimumProfilerPeriod + * double *MaximumProfilerPeriod + * double *MinimumServitudesPeriod + * double *MaximumServitudesPeriod + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerMotionKernelPeriodMinMaxGet (int SocketIndex, double * MinimumCorrectorPeriod, double * MaximumCorrectorPeriod, double * MinimumProfilerPeriod, double * MaximumProfilerPeriod, double * MinimumServitudesPeriod, double * MaximumServitudesPeriod) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerMotionKernelPeriodMinMaxGet (double *,double *,double *,double *,double *,double *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MinimumCorrectorPeriod); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MaximumCorrectorPeriod); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MinimumProfilerPeriod); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MaximumProfilerPeriod); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MinimumServitudesPeriod); + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) sscanf (pt, "%lf", MaximumServitudesPeriod); + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * ControllerMotionKernelPeriodMinMaxReset : Reset controller motion kernel min/max periods + * + * - Parameters : + * int SocketIndex + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall ControllerMotionKernelPeriodMinMaxReset (int SocketIndex) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "ControllerMotionKernelPeriodMinMaxReset ()"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + +/*********************************************************************** + * SocketsStatusGet : Get sockets current status + * + * - Parameters : + * int SocketIndex + * char *SocketsStatus + * - Return : + * int errorCode + ***********************************************************************/ +int __stdcall SocketsStatusGet (int SocketIndex, char * SocketsStatus) +{ + int ret = -1; + char ExecuteMethod[SIZE_EXECUTE_METHOD]; + char *ReturnedValue = (char *) malloc (sizeof(char) * SIZE_SMALL); + + /* Convert to string */ + sprintf (ExecuteMethod, "SocketsStatusGet (char *)"); + + /* Send this string and wait return function from controller */ + /* return function : ==0 -> OK ; < 0 -> NOK */ + SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); + if (strlen (ReturnedValue) > 0) + sscanf (ReturnedValue, "%i", &ret); + + /* Get the returned values in the out parameters */ + if (ret == 0) + { + char * pt; + char * ptNext; + + pt = ReturnedValue; + ptNext = NULL; + if (pt != NULL) pt = strchr (pt, ','); + if (pt != NULL) pt++; + if (pt != NULL) strcpy (SocketsStatus, pt); + ptNext = strchr (SocketsStatus, ','); + if (ptNext != NULL) *ptNext = '\0'; + } + if (NULL != ReturnedValue) + free (ReturnedValue); + + return (ret); +} + + /*********************************************************************** * TestTCP : Test TCP/IP transfert * @@ -8214,7 +9953,7 @@ int __stdcall TestTCP (int SocketIndex, char * InputString, char * ReturnString) /* return function : ==0 -> OK ; < 0 -> NOK */ SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue, SIZE_SMALL); if (strlen (ReturnedValue) > 0) - sscanf (ReturnedValue, "%d", &ret); + sscanf (ReturnedValue, "%i", &ret); /* Get the returned values in the out parameters */ if (ret == 0)