Files
motorBase/motorApp/NewportSrc/xps_c8_driver.cpp
T
2006-04-07 00:02:00 +00:00

4047 lines
128 KiB
C++
Executable File

////////////////////////////////////////////////////////////////////
// Created source file api.cpp for API description
//
#ifdef __rtems__
#include <rtems.h>
#endif
#include <string.h> /* Added by JHK */
/* Bug Fix
23rd May JHK
GatheringExternalConfigurationSet- change array size to allow for the long list of
ExternalLatchPosition axes
9th June JHK
GroupMoveAbsolute and Home use Send() insted of SendAndReceive() because the read
socket function hangs once the IOC has been rebooted once.
30th June JHK
GroupMoveAbort use Send() insted of SendAndReceive() because the abort hangs until
the motors stop.
5th July JHK
MultipleAxesPVTExecution use Send() insted of SendAndReceive() */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "socket.h"
#include "xps_c8_driver.h" /* Renamed by JHK */
#define SIZE_BUFFER 256
#define SIZE_NAME 100
#ifdef __cplusplus
extern "C"
{
#endif
#define DLL_VERSION "Library version for XPS-C8 Firmware V1.0.1"
/***********************************************************************/
int __stdcall TCP_ConnectToServer(char *Ip_Address, int Ip_Port, double TimeOut)
{
/* printf("xps_c8_driver.cpp ConnectToServer:/n");*/
return (ConnectToServer(Ip_Address, Ip_Port, TimeOut));
}
/***********************************************************************/
void __stdcall TCP_SetTimeout(int SocketIndex, double Timeout)
{
SetTCPTimeout(SocketIndex, Timeout);
}
/***********************************************************************/
void __stdcall TCP_CloseSocket(int SocketIndex)
{
CloseSocket(SocketIndex);
}
/***********************************************************************/
char * __stdcall TCP_GetError(int SocketIndex)
{
return (GetError(SocketIndex));
}
/***********************************************************************/
char * __stdcall GetLibraryVersion(void)
{
return (DLL_VERSION);
}
/***********************************************************************/
int __stdcall ElapsedTimeGet (int SocketIndex, double * ElapsedTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "ElapsedTimeGet (double *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", ElapsedTime);
}
return (ret);
}
/***********************************************************************/
int __stdcall ErrorStringGet (int SocketIndex, int ErrorCode, char * ErrorString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "ErrorStringGet (%d,char *)", ErrorCode);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ErrorString, pt);
ptNext = strchr (ErrorString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall FirmwareVersionGet (int SocketIndex, char * Version)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "FirmwareVersionGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (Version, pt);
ptNext = strchr (Version, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall TCLScriptExecute (int SocketIndex, char * TCLFileName, char * TaskName, char * ParametersList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "TCLScriptExecute (%s,%s,%s)", TCLFileName, TaskName, ParametersList);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall TCLScriptKill (int SocketIndex, char * TaskName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "TCLScriptKill (%s)", TaskName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall TimerGet (int SocketIndex, char * TimerName, int * FrequencyTicks)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "TimerGet (%s,int *)", TimerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", FrequencyTicks);
}
return (ret);
}
/***********************************************************************/
int __stdcall TimerSet (int SocketIndex, char * TimerName, int FrequencyTicks)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "TimerSet (%s,%d)", TimerName, FrequencyTicks);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall Reboot (int SocketIndex)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "Reboot ()");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EventAdd (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter, char * ActionName, char * ActionParameter1, char * ActionParameter2, char * ActionParameter3)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EventAdd (%s,%s,%s,%s,%s,%s,%s)", PositionerName, EventName, EventParameter, ActionName, ActionParameter1, ActionParameter2, ActionParameter3);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EventGet (int SocketIndex, char * PositionerName, char * EventsAndActionsList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EventGet (%s,char *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (EventsAndActionsList, pt);
ptNext = strchr (EventsAndActionsList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall EventRemove (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EventRemove (%s,%s,%s)", PositionerName, EventName, EventParameter);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EventWait (int SocketIndex, char * PositionerName, char * EventName, char * EventParameter)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EventWait (%s,%s,%s)", PositionerName, EventName, EventParameter);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GatheringConfigurationGet (int SocketIndex, char * Type)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringConfigurationGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (Type, pt);
ptNext = strchr (Type, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringConfigurationSet (int SocketIndex, int NbElements, char * TypeList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
indice = 0;
strcpy (list, TypeList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GatheringConfigurationSet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s", stringArray0[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GatheringCurrentNumberGet (int SocketIndex, int * CurrentNumber, int * MaximumSamplesNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringCurrentNumberGet (int *,int *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", CurrentNumber);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", MaximumSamplesNumber);
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringStopAndSave (int SocketIndex)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringStopAndSave ()");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExternalConfigurationSet (int SocketIndex, int NbElements, char * TypeList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_BUFFER];
stringArray0 = new char [NbElements][SIZE_BUFFER];
indice = 0;
strcpy (list, TypeList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExternalConfigurationSet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s", stringArray0[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExternalConfigurationGet (int SocketIndex, char * Type)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExternalConfigurationGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (Type, pt);
ptNext = strchr (Type, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExternalCurrentNumberGet (int SocketIndex, int * CurrentNumber, int * MaximumSamplesNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExternalCurrentNumberGet (int *,int *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", CurrentNumber);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", MaximumSamplesNumber);
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExternalStopAndSave (int SocketIndex)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExternalStopAndSave ()");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GlobalArrayGet (int SocketIndex, int Number, char * ValueString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GlobalArrayGet (%d,char *)", Number);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ValueString, pt);
ptNext = strchr (ValueString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GlobalArraySet (int SocketIndex, int Number, char * ValueString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GlobalArraySet (%d,%s)", Number, ValueString);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GPIOAnalogGet (int SocketIndex, int NbElements, char * GPIONameList, double AnalogValue[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
indice = 0;
strcpy (list, GPIONameList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GPIOAnalogGet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s,double *", stringArray0[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &AnalogValue[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GPIOAnalogSet (int SocketIndex, int NbElements, char * GPIONameList, double AnalogOutputValue[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
indice = 0;
strcpy (list, GPIONameList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GPIOAnalogSet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s,%f", stringArray0[i], AnalogOutputValue[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GPIOAnalogGainGet (int SocketIndex, int NbElements, char * GPIONameList, int AnalogInputGainValue[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
indice = 0;
strcpy (list, GPIONameList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GPIOAnalogGainGet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s,int *", stringArray0[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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, "%d", &AnalogInputGainValue[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GPIOAnalogGainSet (int SocketIndex, int NbElements, char * GPIONameList, int AnalogInputGainValue[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Split list */
char *token;
char seps[] = " \t;";
int indice;
char list [SIZE_BUFFER];
char (*stringArray0)[SIZE_NAME];
stringArray0 = new char [NbElements][SIZE_NAME];
indice = 0;
strcpy (list, GPIONameList);
token = strtok( list, seps );
while (( token != NULL ) && ( indice < NbElements ))
{
memset(stringArray0[indice],'\0', SIZE_NAME);
strcpy(stringArray0[indice], token);
token = strtok( NULL, seps );
indice++;
}
/* Convert to string */
sprintf (ExecuteMethod, "GPIOAnalogGainSet (");
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%s,%d", stringArray0[i], AnalogInputGainValue[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GPIODigitalGet (int SocketIndex, char * GPIOName, unsigned short * DigitalValue)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GPIODigitalGet (%s,unsigned short *)", GPIOName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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, "%hu", DigitalValue);
}
return (ret);
}
/***********************************************************************/
int __stdcall GPIODigitalSet (int SocketIndex, char * GPIOName, unsigned short Mask, unsigned short DigitalOutputValue)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GPIODigitalSet (%s,%u,%u)", GPIOName, Mask, DigitalOutputValue);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupAnalogTrackingModeEnable (int SocketIndex, char * GroupName, char * Type)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupAnalogTrackingModeEnable (%s,%s)", GroupName, Type);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupAnalogTrackingModeDisable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupAnalogTrackingModeDisable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupHomeSearch (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupHomeSearch (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
/*SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);*/
SendOnly (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
ret = 0; /* Added by JHK */
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupHomeSearchAndRelativeMove (int SocketIndex, char * GroupName, int NbElements, double TargetDisplacement[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupHomeSearchAndRelativeMove (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%f", TargetDisplacement[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupInitialize (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupInitialize (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupJogParametersSet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupJogParametersSet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%f,%f", Velocity[i], Acceleration[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupJogParametersGet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupJogParametersGet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "double *,double *");
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &Velocity[i]);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", &Acceleration[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupJogCurrentGet (int SocketIndex, char * GroupName, int NbElements, double Velocity[], double Acceleration[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupJogCurrentGet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "double *,double *");
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &Velocity[i]);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", &Acceleration[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupJogModeEnable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupJogModeEnable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupJogModeDisable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupJogModeDisable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupKill (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupKill (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupMoveAbort (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupMoveAbort (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
/*SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);*/
SendOnly (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
ret = 0; /* Added by JHK */
return (ret);
}
/***********************************************************************/
int __stdcall GroupMoveAbsolute (int SocketIndex, char * GroupName, int NbElements, double TargetPosition[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupMoveAbsolute (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%f", TargetPosition[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
/* printf("xps_c8_driver.cpp: GroupMoveAbs Calling SendAndRecieve\n");*/
/*SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);*/
SendOnly (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
ret = 0; /* Added by JHK */
return (ret);
}
/***********************************************************************/
int __stdcall GroupMoveRelative (int SocketIndex, char * GroupName, int NbElements, double TargetDisplacement[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupMoveRelative (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "%f", TargetDisplacement[i]);
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
printf("xps_c8_driver.cpp: GroupMoveRel Calling SendAndRecieve\n");
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupMotionDisable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupMotionDisable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupMotionEnable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupMotionEnable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall GroupPositionCurrentGet (int SocketIndex, char * GroupName, int NbElements, double CurrentEncoderPosition[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupPositionCurrentGet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "double *");
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &CurrentEncoderPosition[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupPositionSetpointGet (int SocketIndex, char * GroupName, int NbElements, double SetPointPosition[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupPositionSetpointGet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "double *");
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &SetPointPosition[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupPositionTargetGet (int SocketIndex, char * GroupName, int NbElements, double TargetPosition[])
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
char temp[SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupPositionTargetGet (%s,", GroupName);
for (int i = 0; i < NbElements; i++)
{
sprintf (temp, "double *");
strcat (ExecuteMethod, temp);
if ((i + 1) < NbElements)
{
strcat (ExecuteMethod, ",");
}
}
strcat (ExecuteMethod, ")");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", &TargetPosition[i]);
}
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupStatusGet (int SocketIndex, char * GroupName, int * Status)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupStatusGet (%s,int *)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", Status);
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupStatusStringGet (int SocketIndex, int GroupStatusCode, char * GroupStatusString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupStatusStringGet (%d,char *)", GroupStatusCode);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (GroupStatusString, pt);
ptNext = strchr (GroupStatusString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall KillAll (int SocketIndex)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "KillAll ()");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerAnalogTrackingPositionParametersGet (int SocketIndex, char * PositionerName, char * GPIOName, double * Offset, double * Scale, double * Velocity, double * Acceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerAnalogTrackingPositionParametersGet (%s,char *,double *,double *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (GPIOName, pt);
ptNext = strchr (GPIOName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Offset);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Scale);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Velocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Acceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerAnalogTrackingPositionParametersSet (int SocketIndex, char * PositionerName, char * GPIOName, double Offset, double Scale, double Velocity, double Acceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerAnalogTrackingPositionParametersSet (%s,%s,%f,%f,%f,%f)", PositionerName, GPIOName, Offset, Scale, Velocity, Acceleration);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerAnalogTrackingVelocityParametersGet (int SocketIndex, char * PositionerName, char * GPIOName, double * Offset, double * Scale, double * DeadBandThreshold, int * Order, double * Velocity, double * Acceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerAnalogTrackingVelocityParametersGet (%s,char *,double *,double *,double *,int *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (GPIOName, pt);
ptNext = strchr (GPIOName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Offset);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Scale);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", DeadBandThreshold);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", Order);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Velocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Acceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerAnalogTrackingVelocityParametersSet (int SocketIndex, char * PositionerName, char * GPIOName, double Offset, double Scale, double DeadBandThreshold, int Order, double Velocity, double Acceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerAnalogTrackingVelocityParametersSet (%s,%s,%f,%f,%f,%d,%f,%f)", PositionerName, GPIOName, Offset, Scale, DeadBandThreshold, Order, Velocity, Acceleration);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerBacklashGet (int SocketIndex, char * PositionerName, double * BacklashValue, char * BacklaskStatus)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerBacklashGet (%s,double *,char *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", BacklashValue);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) strcpy (BacklaskStatus, pt);
ptNext = strchr (BacklaskStatus, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerBacklashSet (int SocketIndex, char * PositionerName, double BacklashValue)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerBacklashSet (%s,%f)", PositionerName, BacklashValue);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerBacklashEnable (int SocketIndex, char * PositionerName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerBacklashEnable (%s)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerBacklashDisable (int SocketIndex, char * PositionerName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerBacklashDisable (%s)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorNotchFiltersSet (int SocketIndex, char * PositionerName, double NotchFrequency1, double NotchBandwith1, double NotchGain1, double NotchFrequency2, double NotchBandwith2, double NotchGain2)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorNotchFiltersSet (%s,%f,%f,%f,%f,%f,%f)", PositionerName, NotchFrequency1, NotchBandwith1, NotchGain1, NotchFrequency2, NotchBandwith2, NotchGain2);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorNotchFiltersGet (int SocketIndex, char * PositionerName, double * NotchFrequency1, double * NotchBandwith1, double * NotchGain1, double * NotchFrequency2, double * NotchBandwith2, double * NotchGain2)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorNotchFiltersGet (%s,double *,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);
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", NotchFrequency1);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", NotchBandwith1);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", NotchGain1);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", NotchFrequency2);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", NotchBandwith2);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", NotchGain2);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDFFAccelerationSet (int SocketIndex, char * PositionerName, int 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_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDFFAccelerationSet (%s,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f)", PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime, DerivativeFilterCutOffFrequency, GKP, GKI, GKD, KForm, FeedForwardGainAcceleration);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDFFAccelerationGet (int SocketIndex, char * PositionerName, int * 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_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDFFAccelerationGet (%s,int *,double *,double *,double *,double *,double *,double *,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);
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", ClosedLoopStatus);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KP);
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", KD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KS);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", IntegrationTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", DerivativeFilterCutOffFrequency);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKP);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKI);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KForm);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", FeedForwardGainAcceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDFFVelocitySet (int SocketIndex, char * PositionerName, int 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;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDFFVelocitySet (%s,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f)", PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime, DerivativeFilterCutOffFrequency, GKP, GKI, GKD, KForm, FeedForwardGainVelocity);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDFFVelocityGet (int SocketIndex, char * PositionerName, int * 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;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDFFVelocityGet (%s,int *,double *,double *,double *,double *,double *,double *,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);
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", ClosedLoopStatus);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KP);
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", KD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KS);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", IntegrationTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", DerivativeFilterCutOffFrequency);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKP);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKI);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KForm);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", FeedForwardGainVelocity);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDDualFFVoltageSet (int SocketIndex, char * PositionerName, int 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;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDDualFFVoltageSet (%s,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f)", PositionerName, ClosedLoopStatus, KP, KI, KD, KS, IntegrationTime, DerivativeFilterCutOffFrequency, GKP, GKI, GKD, KForm, FeedForwardGainVelocity, FeedForwardGainAcceleration, Friction);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIDDualFFVoltageGet (int SocketIndex, char * PositionerName, int * 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;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIDDualFFVoltageGet (%s,int *,double *,double *,double *,double *,double *,double *,double *,double *,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);
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", ClosedLoopStatus);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KP);
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", KD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KS);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", IntegrationTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", DerivativeFilterCutOffFrequency);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKP);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKI);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", GKD);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KForm);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", FeedForwardGainVelocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", FeedForwardGainAcceleration);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Friction);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIPositionSet (int SocketIndex, char * PositionerName, int ClosedLoopStatus, double KP, double KI, double IntegrationTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIPositionSet (%s,%d,%f,%f,%f)", PositionerName, ClosedLoopStatus, KP, KI, IntegrationTime);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorPIPositionGet (int SocketIndex, char * PositionerName, int * ClosedLoopStatus, double * KP, double * KI, double * IntegrationTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorPIPositionGet (%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);
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", ClosedLoopStatus);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", KP);
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", IntegrationTime);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerCorrectorTypeGet (int SocketIndex, char * PositionerName, char * CorrectorType)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerCorrectorTypeGet (%s,char *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (CorrectorType, pt);
ptNext = strchr (CorrectorType, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerErrorGet (int SocketIndex, char * PositionerName, int * ErrorCode)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerErrorGet (%s,int *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", ErrorCode);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerErrorStringGet (int SocketIndex, int PositionerErrorCode, char * PositionerErrorString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerErrorStringGet (%d,char *)", PositionerErrorCode);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (PositionerErrorString, pt);
ptNext = strchr (PositionerErrorString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerHardwareStatusGet (int SocketIndex, char * PositionerName, int * HardwareStatus)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerHardwareStatusGet (%s,int *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", HardwareStatus);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerHardwareStatusStringGet (int SocketIndex, int PositionerHardwareStatus, char * PositonerHardwareStatusString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerHardwareStatusStringGet (%d,char *)", PositionerHardwareStatus);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (PositonerHardwareStatusString, pt);
ptNext = strchr (PositonerHardwareStatusString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerHardInterpolatorFactorGet (int SocketIndex, char * PositionerName, int * InterpolationFactor)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerHardInterpolatorFactorGet (%s,int *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", InterpolationFactor);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerHardInterpolatorFactorSet (int SocketIndex, char * PositionerName, int InterpolationFactor)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerHardInterpolatorFactorSet (%s,%d)", PositionerName, InterpolationFactor);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerMotionDoneGet (int SocketIndex, char * PositionerName, double * PositionWindow, double * VelocityWindow, double * CheckingTime, double * MeanPeriod, double * TimeOut)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerMotionDoneGet (%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);
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", PositionWindow);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", VelocityWindow);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", CheckingTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MeanPeriod);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", TimeOut);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerMotionDoneSet (int SocketIndex, char * PositionerName, double PositionWindow, double VelocityWindow, double CheckingTime, double MeanPeriod, double TimeOut)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerMotionDoneSet (%s,%f,%f,%f,%f,%f)", PositionerName, PositionWindow, VelocityWindow, CheckingTime, MeanPeriod, TimeOut);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerPositionCompareGet (int SocketIndex, char * PositionerName, double * MinimumPosition, double * MaximumPosition, double * PositionStep, int * EnableState)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerPositionCompareGet (%s,double *,double *,double *,int *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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, "%lf", PositionStep);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", EnableState);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerPositionCompareSet (int SocketIndex, char * PositionerName, double MinimumPosition, double MaximumPosition, double PositionStep)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerPositionCompareSet (%s,%f,%f,%f)", PositionerName, MinimumPosition, MaximumPosition, PositionStep);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerPositionCompareEnable (int SocketIndex, char * PositionerName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerPositionCompareEnable (%s)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerPositionCompareDisable (int SocketIndex, char * PositionerName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerPositionCompareDisable (%s)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerPreviousMotionTimesGet (int SocketIndex, char * PositionerName, double * SettingTime, double * SettlingTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerPreviousMotionTimesGet (%s,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", SettingTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", SettlingTime);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerSGammaParametersGet (int SocketIndex, char * PositionerName, double * Velocity, double * Acceleration, double * MinimumTjerkTime, double * MaximumTjerkTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerSGammaParametersGet (%s,double *,double *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", Velocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Acceleration);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MinimumTjerkTime);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MaximumTjerkTime);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerSGammaParametersSet (int SocketIndex, char * PositionerName, double Velocity, double Acceleration, double MinimumTjerkTime, double MaximumTjerkTime)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerSGammaParametersSet (%s,%f,%f,%f,%f)", PositionerName, Velocity, Acceleration, MinimumTjerkTime, MaximumTjerkTime);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall PositionerSGammaExactVelocityAjustedDisplacementGet (int SocketIndex, char * PositionerName, double DesiredDisplacement, double * AdjustedDisplacement)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerSGammaExactVelocityAjustedDisplacementGet (%s,%f,double *)", PositionerName, DesiredDisplacement);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", AdjustedDisplacement);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerUserTravelLimitsGet (int SocketIndex, char * PositionerName, double * UserMinimumTarget, double * UserMaximumTarget)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerUserTravelLimitsGet (%s,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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", UserMinimumTarget);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserMaximumTarget);
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerUserTravelLimitsSet (int SocketIndex, char * PositionerName, double UserMinimumTarget, double UserMaximumTarget)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerUserTravelLimitsSet (%s,%f,%f)", PositionerName, UserMinimumTarget, UserMaximumTarget);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall MultipleAxesPVTVerification (int SocketIndex, char * GroupName, char * FileName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "MultipleAxesPVTVerification (%s,%s)", GroupName, FileName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall MultipleAxesPVTVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "MultipleAxesPVTVerificationResultGet (%s,char *,double *,double *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
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, "%lf", MaximumVelocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MaximumAcceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall MultipleAxesPVTExecution (int SocketIndex, char * GroupName, char * FileName, int ExecutionNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "MultipleAxesPVTExecution (%s,%s,%d)", GroupName, FileName, ExecutionNumber);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
/*SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue); */
SendOnly (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall MultipleAxesPVTParametersGet (int SocketIndex, char * GroupName, char * FileName, int * CurrentElementNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "MultipleAxesPVTParametersGet (%s,char *,int *)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", CurrentElementNumber);
}
return (ret);
}
/***********************************************************************/
int __stdcall SingleAxisSlaveModeEnable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "SingleAxisSlaveModeEnable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall SingleAxisSlaveModeDisable (int SocketIndex, char * GroupName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "SingleAxisSlaveModeDisable (%s)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall SingleAxisSlaveParametersSet (int SocketIndex, char * GroupName, char * PositionerName, double Ratio)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "SingleAxisSlaveParametersSet (%s,%s,%f)", GroupName, PositionerName, Ratio);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall SingleAxisSlaveParametersGet (int SocketIndex, char * GroupName, char * PositionerName, double * Ratio)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "SingleAxisSlaveParametersGet (%s,char *,double *)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (PositionerName, pt);
ptNext = strchr (PositionerName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Ratio);
}
return (ret);
}
/***********************************************************************/
int __stdcall XYLineArcVerification (int SocketIndex, char * GroupName, char * FileName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYLineArcVerification (%s,%s)", GroupName, FileName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall XYLineArcVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYLineArcVerificationResultGet (%s,char *,double *,double *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
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, "%lf", MaximumVelocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MaximumAcceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall XYLineArcExecution (int SocketIndex, char * GroupName, char * FileName, double Velocity, double Acceleration, int ExecutionNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYLineArcExecution (%s,%s,%f,%f,%d)", GroupName, FileName, Velocity, Acceleration, ExecutionNumber);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall XYLineArcParametersGet (int SocketIndex, char * GroupName, char * FileName, double * Velocity, double * Acceleration, int * CurrentElementNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYLineArcParametersGet (%s,char *,double *,double *,int *)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Velocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Acceleration);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", CurrentElementNumber);
}
return (ret);
}
/***********************************************************************/
int __stdcall XYZSplineVerification (int SocketIndex, char * GroupName, char * FileName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYZSplineVerification (%s,%s)", GroupName, FileName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall XYZSplineVerificationResultGet (int SocketIndex, char * PositionerName, char * FileName, double * MinimumPosition, double * MaximumPosition, double * MaximumVelocity, double * MaximumAcceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYZSplineVerificationResultGet (%s,char *,double *,double *,double *,double *)", PositionerName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
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, "%lf", MaximumVelocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", MaximumAcceleration);
}
return (ret);
}
/***********************************************************************/
int __stdcall XYZSplineExecution (int SocketIndex, char * GroupName, char * FileName, double Velocity, double Acceleration)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYZSplineExecution (%s,%s,%f,%f)", GroupName, FileName, Velocity, Acceleration);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall XYZSplineParametersGet (int SocketIndex, char * GroupName, char * FileName, double * Velocity, double * Acceleration, int * CurrentElementNumber)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "XYZSplineParametersGet (%s,char *,double *,double *,int *)", GroupName);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (FileName, pt);
ptNext = strchr (FileName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Velocity);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", Acceleration);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%d", CurrentElementNumber);
}
return (ret);
}
/***********************************************************************/
int __stdcall EEPROMCIESet (int SocketIndex, int CardNumber, char * ReferenceString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EEPROMCIESet (%d,%s)", CardNumber, ReferenceString);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EEPROMDACOffsetCIESet (int SocketIndex, int PlugNumber, double DAC1Offset, double DAC2Offset)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EEPROMDACOffsetCIESet (%d,%f,%f)", PlugNumber, DAC1Offset, DAC2Offset);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EEPROMDriverSet (int SocketIndex, int PlugNumber, char * ReferenceString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EEPROMDriverSet (%d,%s)", PlugNumber, ReferenceString);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall EEPROMINTSet (int SocketIndex, int CardNumber, char * ReferenceString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EEPROMINTSet (%d,%s)", CardNumber, ReferenceString);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
if (strlen (ReturnedValue) > 0)
sscanf (ReturnedValue, "%i", &ret);
/* Get the returned values in the out parameters */
return (ret);
}
/***********************************************************************/
int __stdcall ActionListGet (int SocketIndex, char * ActionList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "ActionListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ActionList, pt);
ptNext = strchr (ActionList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall APIExtendedListGet (int SocketIndex, char * Method)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "APIExtendedListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (Method, pt);
ptNext = strchr (Method, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall APIListGet (int SocketIndex, char * Method)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "APIListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (Method, pt);
ptNext = strchr (Method, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall ErrorListGet (int SocketIndex, char * ErrorsList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "ErrorListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ErrorsList, pt);
ptNext = strchr (ErrorsList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall EventListGet (int SocketIndex, char * EventList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "EventListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (EventList, pt);
ptNext = strchr (EventList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringListGet (int SocketIndex, char * list)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (list, pt);
ptNext = strchr (list, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExtendedListGet (int SocketIndex, char * list)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExtendedListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (list, pt);
ptNext = strchr (list, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringExternalListGet (int SocketIndex, char * list)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringExternalListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (list, pt);
ptNext = strchr (list, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GroupStatusListGet (int SocketIndex, char * GroupStatusList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GroupStatusListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (GroupStatusList, pt);
ptNext = strchr (GroupStatusList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall HardwareInternalListGet (int SocketIndex, char * InternalHardwareList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "HardwareInternalListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (InternalHardwareList, pt);
ptNext = strchr (InternalHardwareList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall HardwareDriverAndStageGet (int SocketIndex, int PlugNumber, char * DriverName, char * StageName)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "HardwareDriverAndStageGet (%d,char *,char *)", PlugNumber);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (DriverName, pt);
ptNext = strchr (DriverName, ',');
if (ptNext != NULL) *ptNext = '\0';
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) strcpy (StageName, pt);
ptNext = strchr (StageName, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall ObjectsListGet (int SocketIndex, char * ObjectsList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "ObjectsListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ObjectsList, pt);
ptNext = strchr (ObjectsList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerErrorListGet (int SocketIndex, char * PositionerErrorList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerErrorListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (PositionerErrorList, pt);
ptNext = strchr (PositionerErrorList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall PositionerHardwareStatusListGet (int SocketIndex, char * PositionerHardwareStatusList)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "PositionerHardwareStatusListGet (char *)");
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (PositionerHardwareStatusList, pt);
ptNext = strchr (PositionerHardwareStatusList, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
/***********************************************************************/
int __stdcall GatheringUserDatasGet (int SocketIndex, double * UserData1, double * UserData2, double * UserData3, double * UserData4, double * UserData5, double * UserData6, double * UserData7, double * UserData8)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "GatheringUserDatasGet (double *,double *,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);
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", UserData1);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData2);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData3);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData4);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData5);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData6);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData7);
if (pt != NULL) pt = strchr (pt, ',');
if (pt != NULL) pt++;
if (pt != NULL) sscanf (pt, "%lf", UserData8);
}
return (ret);
}
/***********************************************************************/
int __stdcall TestTCP (int SocketIndex, char * InputString, char * ReturnString)
{
int ret = -1;
char ExecuteMethod [SIZE_BUFFER];
char ReturnedValue [SIZE_BUFFER];
/* Convert to string */
sprintf (ExecuteMethod, "TestTCP (%s,char *)", InputString);
/* Send this string and wait return function from controller */
/* return function : ==0 -> OK ; < 0 -> NOK */
SendAndReceive (SocketIndex, ExecuteMethod, ReturnedValue);
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 (ReturnString, pt);
ptNext = strchr (ReturnString, ',');
if (ptNext != NULL) *ptNext = '\0';
}
return (ret);
}
#ifdef __cplusplus
}
#endif