Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4LabVIEW)  1.26.2
Application, symbols
Collaboration diagram for Application, symbols:

Functions

MLPIRESULT mlpiLogicGetNumberOfApplications (const MLPIHANDLE connection, ULONG *number)
 
MLPIRESULT mlpiLogicGetNameOfApplication (const MLPIHANDLE connection, const ULONG index, WCHAR16 *application, const ULONG numElements)
 
MLPIRESULT mlpiLogicLoadBootApplication (const MLPIHANDLE connection, const WCHAR16 *file, const WCHAR16 *path, WCHAR16 *application, const ULONG numElements)
 
MLPIRESULT mlpiLogicStopApplication (const MLPIHANDLE connection, const WCHAR16 *application=0)
 
MLPIRESULT mlpiLogicStartApplication (const MLPIHANDLE connection, const WCHAR16 *application=0)
 
MLPIRESULT mlpiLogicRunSingleCycleApplication (const MLPIHANDLE connection, const WCHAR16 *application=0)
 
MLPIRESULT mlpiLogicResetApplication (const MLPIHANDLE connection, const MlpiApplicationResetMode resetMode, const WCHAR16 *application=0)
 
MLPIRESULT mlpiLogicGetStateOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, MlpiApplicationState *state)
 
MLPIRESULT mlpiLogicGetOperationStateOfApplicationUlong (const MLPIHANDLE connection, const WCHAR16 *application, ULONG *state)
 
MLPIRESULT mlpiLogicGetOperationStateOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, MlpiApplicationOpState *state)
 
MLPIRESULT mlpiLogicGetTaskInfoOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, MlpiApplicationTaskInfo *taskInfo, const ULONG numElements, ULONG *numElementsRet=0)
 
MLPIRESULT mlpiLogicGetInfoOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, MlpiApplicationInfo *info)
 
MLPIRESULT mlpiLogicSaveRetainOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, const WCHAR16 *path=0)
 
MLPIRESULT mlpiLogicRestoreRetainOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, const WCHAR16 *path)
 
MLPIRESULT mlpiLogicWaitForEventOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, const MlpiApplicationEvent event, const ULONG timeout)
 
MLPIRESULT mlpiLogicGetStopAxesConfiguration (const MLPIHANDLE connection, WCHAR16 *configuration, const ULONG numElements, ULONG *numElementsRet)
 
MLPIRESULT mlpiLogicGetSymbolsOfApplication (const MLPIHANDLE connection, const WCHAR16 *application, PROCESSHANDLE *node, WCHAR16 *symbols, const ULONG numElements)
 
MLPIRESULT mlpiLogicGetTypeOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, MlpiLogicType *type, MlpiLogicType *subtype=0)
 
MLPIRESULT mlpiLogicGetSizeOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, ULONG *dataSize)
 
MLPIRESULT mlpiLogicGetNumElementsOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, ULONG *numElements)
 
MLPIRESULT mlpiLogicGetDimensionOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, ULONG *dimension)
 
MLPIRESULT mlpiLogicGetArrayRangeOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, const ULONG index, MlpiLogicArrayRange *range)
 
MLPIRESULT mlpiLogicGetAccessRightsOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, MlpiLogicSymbolAccessRights *accessrights)
 
MLPIRESULT mlpiLogicGetAddressOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, ULONG *address)
 
MLPIRESULT mlpiLogicGetInformationOfSymbol (const MLPIHANDLE connection, const WCHAR16 *symbol, MlpiLogicSymbolInformation *info)
 
MLPIRESULT mlpiLogicGetInformationOfUserType (const MLPIHANDLE connection, const WCHAR16 *symbol, MlpiLogicUserTypeInformation *info, const ULONG numElements, ULONG *numElementsRet=0)
 
MLPIRESULT mlpiLogicSetCapabilityOfOperation (const MLPIHANDLE connection, const MlpiLogicCapabilityOperation operation, const MlpiLogicCapabilityOperationValue value)
 
MLPIRESULT mlpiLogicGetCapabilityOfOperation (const MLPIHANDLE connection, const MlpiLogicCapabilityOperation operation, MlpiLogicCapabilityOperationValue *value)
 

Detailed Description

The following functions manage the application lifecycle of the logic applications on the target device.

Attention
The addresses of the variables of the symbolic access might change on every download, reset origin or online change of the PLC application, so you have to stop each variable access before you load or change the PLC application!

With these functions you can start, stop, reset and even load new logic applications onto the target. The following functions are not necessary if you prefer to download your applications from within IndraWorks.

Function Documentation

MLPIRESULT mlpiLogicGetNumberOfApplications ( const MLPIHANDLE  connection,
ULONG number 
)

This function will return the number of applications.

Parameters
[in]connectionHandle for multiple connections.
[out]numberPointer to variable where the number of applications will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the number of applications.
2 ULONG number = 0;
3 MLPIRESULT result = mlpiLogicGetNumberOfApplications(connection, &number);
MLPIRESULT mlpiLogicGetNameOfApplication ( const MLPIHANDLE  connection,
const ULONG  index,
WCHAR16 application,
const ULONG  numElements 
)

This function will return the name of an application selected by index 0 until (number-1).

Parameters
[in]connectionHandle for multiple connections.
[in]indexIndex of application.
[out]applicationPointer to variable where the name of application will be stored.
[in]numElementsNumber of WCHAR16 elements in 'application' available to read.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the name of an application.
2 WCHAR16 application[256] = L"";
3 ULONG index = 0;
4 MLPIRESULT result = mlpiLogicGetNameOfApplication(connection, index, application, _countof(application));
MLPIRESULT mlpiLogicLoadBootApplication ( const MLPIHANDLE  connection,
const WCHAR16 file,
const WCHAR16 path,
WCHAR16 application,
const ULONG  numElements 
)

This function will load an application from the device file system. The application files can be created from within IndraWorks by creating a boot project when not logged in to the device. This file *.app together with a corresponding *.crc checksum file can be copied to the flash card of the device (e.g. using FTP transfer). Use this function to load it and to replace the current application.

Attention
The addresses of the variables of the symbolic access might change on every download, reset origin or online change of the PLC application, so you have to stop each variable access before you load or change the PLC application!
Note
This method will not unload a previous loaded application. This method may therefore fail if there are already too many applications loaded on the target and there is no additional application supported. To make room for a new application, you can unload a single application or all applications by calling mlpiLogicResetApplication with argument MLPI_RESET_ORIGIN.
After loading the application, it is in the state MLPI_STATE_STOP. You have to start the application by using the function mlpiLogicStartApplication.
Note
After loading the application, some fieldbusses (e.g. Profibus DP) need a while for initialization so you can't get a valid access for this time. As a suggestion, you pause the access to the fieldbus I/Os of your application by following code sequence.
1 MlpiIoFieldbusMasterInfo infoMaster;
2 memset(&infoMaster, 0, sizeof(infoMaster));
3 WCHAR16 master[] = L"Profibus_DP_Master";
4 
5 for (ULONG maxTimeOutSec=0; maxTimeOutSec<30; maxTimeOutSec++)
6 {
7  // get fieldbus information incl. diagnosis flags
8  MLPIRESULT result = mlpiIoReadFieldbusMasterInfo(connection, master, &infoMaster);
9  if ( MLPI_SUCCEEDED(result) )
10  {
11  if (MLPI_IO_FIELDBUS_DIAGNOSIS_ERROR(infoMaster.diagnosis.flags)
12  sleep(1);
13  else
14  break;
15  }
16  else
17  printf("\ncall of MLPI function failed with 0x%08x!", (unsigned) result);
18 }
Parameters
[in]connectionHandle for multiple connections.
[in]fileFilename of the new application file without file extension, e.g. "Application".
[in]pathPath to the file of the new application. The default root paths can be determined by using the function mlpiSystemGetSpecialPath.
[out]applicationPointer to variable where the name of the new application will be stored. The name of the application is stored inside the application project file (.app) and will be returned here. Use the application name as a handle for other function calls which need the application name to identify which application you want to access on the control.
[in]numElementsNumber of WCHAR16 elements in 'application' available to read.
Returns
Return value indicating success (>=0) or error (<0). Will return 0xF0360011 (E_LIMIT_MAX) if there are already too many applications loaded on the target. Remove an application by calling mlpiLogicResetApplication with MLPI_RESET_ORIGIN and try again.
Example:
1 // Load the boot application 'Application' from the subfolder 'FolderOfBootApplications' of the user partition.
2 WCHAR16 file[] = L"Application";
3 WCHAR16 path[256] = L"";
4 WCHAR16 subfolder[] = L"FolderOfBootApplications";
5 WCHAR16 application[256] = L"";
6 if ( MLPI_SUCCEEDED(mlpiSystemGetSpecialPath(connection, MLPI_PATH_USER, path, _countof(path))) )
7 {
8  wcscat16(path, subfolder);
9  MLPIRESULT result = mlpiLogicLoadBootApplication(connection, file, path, application, _countof(application));
10  if ( MLPI_SUCCEEDED(result) )
11  {
12  printf("\nsuccessfully loaded new bootproject!");
13  }
14 }
MLPIRESULT mlpiLogicStopApplication ( const MLPIHANDLE  connection,
const WCHAR16 application = 0 
)

This function will stop an application. All motion that is assigned to the application will stop!

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application. Use 0 to stop all applications.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Stop all applications.
2 MLPIRESULT result = mlpiLogicStopApplication(connection);
MLPIRESULT mlpiLogicStartApplication ( const MLPIHANDLE  connection,
const WCHAR16 application = 0 
)

This function will start an application.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application. Use 0 to start all applications.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Start all applications.
2 MLPIRESULT result = mlpiLogicStartApplication(connection);
MLPIRESULT mlpiLogicRunSingleCycleApplication ( const MLPIHANDLE  connection,
const WCHAR16 application = 0 
)

This function will run an application for one single cycle.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application. Use 0 to run all applications for one single cycle.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Run all applications for one single cycle.
2 MLPIRESULT result = mlpiLogicRunSingleCycleApplication(connection);
MLPIRESULT mlpiLogicResetApplication ( const MLPIHANDLE  connection,
const MlpiApplicationResetMode  resetMode,
const WCHAR16 application = 0 
)

This function will reset an application. All motion that is assigned to the application will stop!

Parameters
[in]connectionHandle for multiple connections.
[in]resetModeReset mode
[in]applicationName of application. Use 0 to reset all applications.
Returns
Return value indicating success (>=0) or error (<0).
Attention
The addresses of the variables of the symbolic access might change on every download, reset origin or online change of the PLC application, so you have to stop each variable access before you load or change the PLC application!
Note
MLPI_RESET_WARM: All global data except retain data is reset to default.
MLPI_RESET_COLD: All global data and (!) retain data is reset to default.
MLPI_RESET_ORIGIN: Delete the application, delete all application files (boot project, etc.), reset all global and retain data.
Example:
1 // Reset all applications.
2 MlpiApplicationResetMode resetMode = MLPI_RESET_COLD;
3 MLPIRESULT result = mlpiLogicResetApplication(connection, resetMode);
MLPIRESULT mlpiLogicGetStateOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
MlpiApplicationState state 
)

This function will return the state of an application.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]statePointer to variable where the state will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the state of an application.
2 WCHAR16 application = L"Application";
3 MlpiApplicationState state = MLPI_STATE_NONE;
4 MLPIRESULT result = mlpiLogicGetStateOfApplication(connection, application, &state);
MLPIRESULT mlpiLogicGetOperationStateOfApplicationUlong ( const MLPIHANDLE  connection,
const WCHAR16 application,
ULONG state 
)

This function will return the extended operation state of an application by using an unsigned 4 byte variable. Evaluate the state by using respective definitions (e.g. MLPI_APPLICATION_OP_STATE_PROGRAM_LOADED).

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]statePointer to variable where the extended operation state will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the extended operation state of an application by using an unsigned length.
2 // Evaluate state by using respective definitions.
3 WCHAR16 application = L"Application";
4 ULONG state = 0;
5 MLPIRESULT result = mlpiLogicGetOperationStateOfApplicationUlong(connection, application, &state);
6 if ((state & MLPI_APPLICATION_OP_STATE_EXCEPTION) == MLPI_APPLICATION_OP_STATE_EXCEPTION)
7  printf("Exception occurred!");
MLPIRESULT mlpiLogicGetOperationStateOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
MlpiApplicationOpState state 
)

This function will return the extended operation state of an application by using struct MlpiApplicationOpState.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]statePointer to variable where the extended operation state will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the extended operation state of an application by using struct MlpiApplicationOpState .
2 WCHAR16 application = L"Application";
3 MlpiApplicationOpState state;
4 memset(&state, 0, sizeof(state));
5 MLPIRESULT result = mlpiLogicGetOperationStateOfApplication(connection, application, &state);
6 if (state.exception == TRUE)
7  printf("Exception occurred!");
MLPIRESULT mlpiLogicGetTaskInfoOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
MlpiApplicationTaskInfo taskInfo,
const ULONG  numElements,
ULONG numElementsRet = 0 
)

This function will return information about all running IEC tasks of an application.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]taskInfoPointer to an array of structure where the information will be stored.
[in]numElementsNumber of MlpiApplicationTaskInfo elements available in 'taskInfo' to read.
[out]numElementsRetNumber of elements used.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the task information of all running IEC tasks of an application.
2 WCHAR16 application[] = L"Application";
3 MlpiApplicationTaskInfo taskInfo[32];
4 ULONG numElementsRet = 0;
5 memset(taskInfo, 0, sizeof(taskInfo));
6 MLPIRESULT result = mlpiLogicGetTaskInfoOfApplication(connection, application, taskInfo, _countof(taskInfo), &numElementsRet);
MLPIRESULT mlpiLogicGetInfoOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
MlpiApplicationInfo info 
)

This function will return information about the given application.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]infoPointer to struct where the information will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read information about the application.
2 WCHAR16 application[] = L"Application";
3 MlpiApplicationInfo info;
4 memset(&info, 0, sizeof(info));
5 MLPIRESULT result = mlpiLogicGetInfoOfApplication(connection, application, info);
MLPIRESULT mlpiLogicSaveRetainOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
const WCHAR16 path = 0 
)

This function will save the retain data of an application to default storage or to a user-defined file.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[in]pathPath and name of retain data file. Use 0 to select default storage to load it on next reboot.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Store the retain data of the application 'Application' to the file 'retain.dat' in the subfolder 'Data'
2 // of the user partition.
3 WCHAR16 application[] = L"Application";
4 WCHAR16 path[256] = L"";
5 WCHAR16 subpath[] = L"Data/retain.dat";
6 if ( MLPI_SUCCEEDED(mlpiSystemGetSpecialPath(MLPI_PATH_USER, path, _countof(path))) )
7 {
8  wcscat(path, subpath);
9  MLPIRESULT result = mlpiLogicSaveRetainOfApplication(connection, application, path);
10 }
MLPIRESULT mlpiLogicRestoreRetainOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
const WCHAR16 path 
)

This function will restore the retain data of an application from a user-defined file.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[in]pathPath and name of retain data file.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Restore the retain data of the application 'Application' from the file 'retain.dat' in the subfolder 'Data'
2 // of the user partition.
3 WCHAR16 application[] = L"Application";
4 WCHAR16 path[256] = L"";
5 WCHAR16 subpath[] = L"Data/retain.dat";
6 if ( MLPI_SUCCEEDED(mlpiSystemGetSpecialPath(MLPI_PATH_USER, path, _countof(path))) )
7 {
8  wcscat(path, subpath);
9  MLPIRESULT result = mlpiLogicRestoreRetainOfApplication(connection, application, path);
10 }
MLPIRESULT mlpiLogicWaitForEventOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
const MlpiApplicationEvent  event,
const ULONG  timeout 
)

This function pends the calling task until the given event occurs.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application (unused).
[in]eventEvent to wait for.
[in]timeoutThe timeout after which the function should return an error if the event did not raise. Use MLPI_INFINITE to wait forever.
Returns
Return value indicating success (>=0) or error (<0).
Note
: The events occurs regardless the given application name, they don't care about the application name.
Example:
1 // Wait until event of 'Online change'.
2 WCHAR16 application[] = L"Application";
3 MLPIRESULT result = mlpiLogicWaitForEventOfApplication(connection, application, MLPI_APPLICATIONEVENT_ONLINE_CHANGE_INIT, MLPI_INFINITE);
MLPIRESULT mlpiLogicGetStopAxesConfiguration ( const MLPIHANDLE  connection,
WCHAR16 configuration,
const ULONG  numElements,
ULONG numElementsRet 
)

This function will return the active "StopAxes" and "StopAxesCommon" configuration of all applications.

Parameters
[in]connectionHandle for multiple connections.
[out]configurationPointer to variable where the configuration of applications will be stored.
[in]numElementsNumber of WCHAR16 elements in 'configuration' available to read.
[out]numElementsRetNumber of elements used.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the active "StopAxes" and "StopAxesCommon" configuration of all applications.
2 WCHAR16 configuration[256] = L"";
3 ULONG index = 0;
4 MLPIRESULT result = mlpiLogicGetStopAxesConfiguration(connection, configuration, _countof(configuration));
MLPIRESULT mlpiLogicGetSymbolsOfApplication ( const MLPIHANDLE  connection,
const WCHAR16 application,
PROCESSHANDLE node,
WCHAR16 symbols,
const ULONG  numElements 
)

This function will read all symbols of an application. The symbols themselves are separated from each other by a semicolon. The argument 'node' will be used as a token for further requests, if the buffer size is insufficient for all symbols.

Parameters
[in]connectionHandle for multiple connections.
[in]applicationName of application.
[out]nodeToken to control the requests. Use on first request the value 0 to sign it as first, use on all following requests the return value you get from last call until you get ((PROCESSHANDLE) -1). This value signals the last response.
[out]symbolsPointer to variable where the symbols will be stored.
[in]numElementsNumber of WCHAR16 elements in 'symbols' available to read.
Returns
Return value indicating success (>=0) or error (<0).
Note
The symbols need to be exported to the symbol configuration of the indralogic project. You may want to use the attribute {attribute 'symbol' := 'readwrite'} above your variable declaration to add it explicit to the symbol configuration.
Example:
1 // Read all symbols of an application.
2 WCHAR16 application[] = L"Application";
3 PROCESSHANDLE node = NULL;
4 WCHAR16 symbols[4096] = L"";
5 MLPIRESULT result = mlpiLogicGetSymbolsOfApplication(connection, application, &node, symbols, _countof(symbols));
MLPIRESULT mlpiLogicGetTypeOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
MlpiLogicType type,
MlpiLogicType subtype = 0 
)

This function reads the type and sybtype of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]typePointer to variable where the type will be stored.
[out]subtypePointer to variable where in case of array the sybtype will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the type of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 MlpiLogicType type = MLPI_LOGIC_TYPE_NONE;
3 MlpiLogicType subtype = MLPI_LOGIC_TYPE_NONE;
4 MLPIRESULT result = mlpiLogicGetTypeOfSymbol(connection, L"Application.PlcProg.x1", &type, &subtype);
MLPIRESULT mlpiLogicGetSizeOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
ULONG dataSize 
)

This function reads the size in bytes of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]dataSizePointer to variable where the size in bytes will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the size in bytes of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 ULONG dataSize = 0;
3 MLPIRESULT result = mlpiLogicGetSizeOfSymbol(connection, L"Application.PlcProg.x1", &dataSize);
MLPIRESULT mlpiLogicGetNumElementsOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
ULONG numElements 
)

This function reads the number of elements of an array or user type of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]numElementsPointer to variable where the number of elements will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the number of elements of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 ULONG numElements = 0;
3 MLPIRESULT result = mlpiLogicGetNumElementsOfSymbol(connection, L"Application.PlcProg.x1", &numElements);
MLPIRESULT mlpiLogicGetDimensionOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
ULONG dimension 
)

This function reads the array dimension of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]dimensionPointer to variable where the dimension will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the dimension of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 ULONG dimension = 0;
3 MLPIRESULT result = mlpiLogicGetDimensionOfSymbol(connection, L"Application.PlcProg.x1", &dimension);
MLPIRESULT mlpiLogicGetArrayRangeOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
const ULONG  index,
MlpiLogicArrayRange range 
)

This function reads the minimum index and maximum index resp. the range of an array dimension of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[in]indexIndex of dimension of array.
[out]rangePointer to variable where the range of array will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the range of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 ULONG index = 0;
3 MlpiLogicArrayRange range;
4 memset(&range, 0, sizeof(range));
5 MLPIRESULT result = mlpiLogicGetArrayRangeOfSymbol(connection, L"Application.PlcProg.x1", index, &range);
MLPIRESULT mlpiLogicGetAccessRightsOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
MlpiLogicSymbolAccessRights accessrights 
)

This function reads the access rights of a symbol variable of PLC application. This and further information can also be read by mlpiLogicGetInformationOfSymbol.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]accessrightsPointer to variable where the access rights of array will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the access rights of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 MlpiLogicSymbolAccessRights accessrights = MLPI_ACCESS_RIGHTS_NONE;
3 MLPIRESULT result = mlpiLogicGetAccessRightsOfSymbol(connection, L"Application.PlcProg.x1", &accessrights);
MLPIRESULT mlpiLogicGetAddressOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
ULONG address 
)

This function reads the physical kernel space address of a symbol variable of a PLC application.

Note
This function can only be used within a real-time application on the target and there only within the kernel space! This function is not available in other toolboxes!
Attention
This address might change on every download, reset origin or online change of PLC application.
Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]addressPointer to variable where the physical address of symbol will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the physical address of the variable 'x1' in the program 'PlcProg' in an application called 'Application'.
2 ULONG address = NULL;
3 MLPIRESULT result = mlpiLogicGetAddressOfSymbol(connection, L"Application.PlcProg.x1", &address);
4 if (MLPI_FAILED(result)){
5  printf("\nCould not read address of symbol, function returned with error 0x%08x", result);
6  return result;
7 }
8 
9 printf("\nThe physical kernel space address of symbol is: 0x%08X", address);
MLPIRESULT mlpiLogicGetInformationOfSymbol ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
MlpiLogicSymbolInformation info 
)

This function reads the types, size, number of elements, array information and access rights of a symbol variable of PLC application. It therefore combines the functionality of mlpiLogicGetTypeOfSymbol, mlpiLogicGetSizeOfSymbol, mlpiLogicGetNumElementsOfSymbol, mlpiLogicGetDimensionOfSymbol, mlpiLogicGetArrayRangeOfSymbol, mlpiLogicGetAccessRightsOfSymbol in a single call.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]infoPointer to struct array where the information will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the information of an application symbol.
2 MlpiLogicSymbolInformation info;
3 memset(&info, 0, sizeof(info));
4 MLPIRESULT result = mlpiLogicGetInformationOfSymbol(connection, L"Application.PlcProg.x1", &info);
MLPIRESULT mlpiLogicGetInformationOfUserType ( const MLPIHANDLE  connection,
const WCHAR16 symbol,
MlpiLogicUserTypeInformation info,
const ULONG  numElements,
ULONG numElementsRet = 0 
)

This function reads names and information of variables (MlpiLogicSymbolInformation) of a symbol variable of PLC application if type of symbol equal MLPI_LOGIC_TYPE_USERDEF.

Parameters
[in]connectionHandle for multiple connections.
[in]symbolSymbol variable of PLC application.
[out]infoPointer to struct array where the names and information of the variables will be stored.
[in]numElementsNumber of MlpiLogicUserTypeInformation elements available in 'info' to read.
[out]numElementsRetNumber of elements used.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the information of a symbol variable of PLC application.
2 WCHAR16 symbol[] = L"Application.PlcProg.x1";
3 MlpiLogicSymbolInformation symbolInfo;
4 memset(&symbolInfo, 0, sizeof(symbolInfo));
5 MLPIRESULT result = mlpiLogicGetInformationOfSymbol(connection, symbol, &symbolInfo);
6 
7 // Read names and information of variables of a symbol if the type is equal MLPI_LOGIC_TYPE_USERDEF.
8 if(symbolInfo.type==MLPI_LOGIC_TYPE_USERDEF)
9 {
10  ULONG numElementsRet = 0;
11  MlpiLogicUserTypeInformation *info = new MlpiLogicUserTypeInformation[symbolInfo.numElements];
12  memset(info, 0, symbolInfo.numElements * sizeof(MlpiLogicUserTypeInformation));
13 
14  MLPIRESULT result = mlpiLogicGetInformationOfUserType(connection, symbol, info, symbolInfo.numElements, &numElementsRet);
15 
16  for( ULONG i=0; i<numElementsRet; i++ )
17  {
18  printf("\n\n\t+--> Variable No. %d", i);
19  printf("\n\t\t Name: %s", info[i].name);
20  printf("\n\t\t Type: %d", info[i].info.type);
21  printf("\n\t\t Subtype: %d", info[i].info.subType);
22  printf("\n\t\t Size: %d", info[i].info.dataSize);
23  printf("\n\t\t Number of elements: %d", info[i].info.numElements);
24  printf("\n\t\t Dimension: %d", info[i].info.dimension);
25  for( ULONG j=0; j<info[i].info.dimension; j++ )
26  {
27  printf("\n\t\t Minimum array range of dimension %d: %d", j+1, info[i].info.range[0].minimum);
28  printf("\n\t\t Maximum array range of dimension %d: %d", j+1, info[i].info.range[0].maximum);
29  }
30  printf("\n\t\t Access rights: %d", info[i].info.accessRights);
31  }
32  delete info;
33 }
MLPIRESULT mlpiLogicSetCapabilityOfOperation ( const MLPIHANDLE  connection,
const MlpiLogicCapabilityOperation  operation,
const MlpiLogicCapabilityOperationValue  value 
)

This function enables or disables the execution capability of operations MlpiLogicCapabilityOperation. The capability will be set to global for all applications. After reboot, the capability will be set to default.

Parameters
[in]connectionHandle for multiple connections.
[in]operationOperation which can be enabled or disabled.
[in]valueTarget capability of execution of operation.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Disable capability to execute online changes.
2 MLPIRESULT result = mlpiLogicSetCapabilityOfOperation(MLPI_LOGIC_CAP_OPERATION_ONLINE_CHANGE, MLPI_LOGIC_CAP_OPERATION_DISABLE);
MLPIRESULT mlpiLogicGetCapabilityOfOperation ( const MLPIHANDLE  connection,
const MlpiLogicCapabilityOperation  operation,
MlpiLogicCapabilityOperationValue value 
)

This function reads the current execution capability of operations MlpiLogicCapabilityOperation.

Parameters
[in]connectionHandle for multiple connections.
[in]operationOperation which can be enabled or disabled.
[out]valuePointer to variable where the current capability of execution of operation will be stored.
Returns
Return value indicating success (>=0) or error (<0).
Example:
1 // Read the current capability to execute online changes.
2 MlpiLogicCapabilityOperationValue value = MLPI_LOGIC_CAP_OPERATION_ENABLE;
3 MLPIRESULT result = mlpiLogicGetCapabilityOfOperation(MLPI_LOGIC_CAP_OPERATION_ONLINE_CHANGE, &value);