Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpiCore)  1.26.2
mlpiTaskLib.h
Go to the documentation of this file.
1 #ifndef __MLPITASKLIB_H__
2 #define __MLPITASKLIB_H__
3 
4 // -----------------------------------------------------------------------
5 // MLPI - <mlpiTaskLib.h>
6 // -----------------------------------------------------------------------
7 // Copyright (c) 2013 Bosch Rexroth. All rights reserved.
8 // Redistribution and use in source and binary forms of this MLPI software
9 // (SW) provided to you, with or without modification, are permitted
10 // without prior approval provided that the following conditions are met:
11 //
12 // 1. Redistributions of source code of SW must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 //
15 // 2. Redistributions in binary form of SW must reproduce the above copyright
16 // notice, this list of conditions and the following disclaimer in the
17 // documentation and/or other materials provided with the distribution.
18 //
19 // 3. User recognizes and acknowledges that it acquires no right,
20 // title or interest in or to any of the names or trademarks used in
21 // connection with the SW ("names") by virtue of this License and waives
22 // any right to or interest in the names. User recognizes and acknowledges
23 // that names of companies or names or products of companies displayed
24 // in the documentation of SW to indicate the interoperability of products
25 // with the SW are the names of their respective owners. The use of such
26 // names in the documentation of SW does not imply any sponsorship,
27 // approval, or endorsement by such companies of this product.
28 //
29 // 4. Modified code versions, i.e. any addition to or deletion from
30 // the substance or structure of the original code of the SW running
31 // the MLPI must be plainly marked as such and must not be misrepresented
32 // as being original SW.
33 //
34 // 5. The SW may only be used in connection with a Bosch Rexroth product.
35 //
36 // THIS INFORMATION IS PROVIDED BY BOSCH REXROTH CORPORATION "AS IS"
37 // AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING
38 // (BUT NOTLIMITED TO) ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
39 // FITNESS FOR ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WHILE THE
40 // INFORMATION PROVIDED IS BELIEVED TO BE ACCURATE, IT MAY INCLUDE
41 // ERRORS OR INACCURACIES.
42 // SUBJECT TO COMPULSORY STATUTORY PROVISIONS OF THE GERMAN LAW AS
43 // THE APPLICABLE LAW FOR THIS LICENSE BOSCH REXROTH CORPORATION WILL
44 // NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM THE USE OF
45 // THE SOFTWARE DISTRIBUTED HEREUNDER, INCLUDING BUT NOT LIMITED TO
46 // DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, AND CONSEQUENTIAL DAMAGES.
47 // -----------------------------------------------------------------------
48 //
58 //
59 // -----------------------------------------------------------------------
60 
61 
62 
143 
149 
166 
172 
290 
295 
296 
297 
298 
299 // -----------------------------------------------------------------------
300 // GLOBAL INCLUDES
301 // -----------------------------------------------------------------------
302 #include "mlpiGlobal.h"
303 
304 // -----------------------------------------------------------------------
305 // GLOBAL CONSTANTS
306 // -----------------------------------------------------------------------
307 static const ULONG MLPI_PRIORITY_HIGH_MAX = 1;
308 static const ULONG MLPI_PRIORITY_HIGH_MIN = 20;
309 static const ULONG MLPI_PRIORITY_BACKGROUND = 254;
310 
311 // -----------------------------------------------------------------------
312 // GLOBAL TYPEDEFS
313 // -----------------------------------------------------------------------
314 
316 typedef enum MlpiTaskEvent
317 {
324 
326 typedef enum MlpiSystemTask
327 {
330 
333 {
337 
340 {
348 
351 {
355 
356 // message packing follows 8-byte natural alignment
357 #if !defined(TARGET_OS_VXWORKS)
358 #pragma pack(push,8)
359 #endif
360 
369 typedef struct MlpiTaskTriggerSetup
370 {
371  MlpiTaskTriggerOption triggerOption;
372  BOOL8 active;
374 
384 typedef struct MlpiTaskTrigger
385 {
386  MlpiTaskTriggerEvent triggerEvent;
387  BOOL8 active;
388  USHORT numTriggers;
390 
392 
393 #if !defined(TARGET_OS_VXWORKS)
394 #pragma pack(pop)
395 #endif
396 
397 // -----------------------------------------------------------------------
398 // GLOBAL EXPORTS
399 // -----------------------------------------------------------------------
400 #ifdef MLPI_API
401  #undef MLPI_API
402 #endif
403 
404 #if defined(TARGET_OS_WINNT)
405  #if defined(MLPI_EXPORTS)
406  #define MLPI_API __declspec(dllexport)
407  #elif defined(MLPI_IMPORTS)
408  #define MLPI_API __declspec(dllimport)
409  #else
410  #define MLPI_API
411  #endif
412 #else
413  #if defined(MLPI_EXPORTS)
414  #define MLPI_API __attribute__ ((visibility("default")))
415  #elif defined(MLPI_IMPORTS)
416  #define MLPI_API
417  #else
418  #define MLPI_API
419  #endif
420 #endif
421 
422 
423 #ifdef __cplusplus
424 extern "C" {
425 #endif
426 
440 MLPI_API MLPIRESULT mlpiTaskWaitForEvent(const MLPIHANDLE connection, const MlpiTaskEvent taskEvent, const ULONG timeout);
441 
442 
460 MLPI_API MLPIRESULT mlpiTaskSetSystemPriority(const MLPIHANDLE connection, const MlpiSystemTask task, const ULONG priority);
461 
462 
482 MLPI_API MLPIRESULT mlpiTaskGetSystemPriority(const MLPIHANDLE connection, const MlpiSystemTask task, ULONG *priority);
483 
484 
494 MLPI_API MLPIRESULT mlpiTaskSetCurrentPriority(const MLPIHANDLE connection, const ULONG priority);
495 
496 
514 MLPI_API MLPIRESULT mlpiTaskGetCurrentPriority(const MLPIHANDLE connection, ULONG *priority);
515 
516 
548 MLPI_API MLPIRESULT mlpiTaskSetTriggerSetup(const MLPIHANDLE connection, const MlpiTaskTriggerSetup* triggerSetup, const ULONG numElements);
549 
550 
576 MLPI_API MLPIRESULT mlpiTaskGetTriggerSetup(const MLPIHANDLE connection, MlpiTaskTriggerSetup* triggerSetup, const ULONG numElements, ULONG* numElementsRet);
577 
578 
609 MLPI_API MLPIRESULT mlpiTaskSetTrigger(const MLPIHANDLE connection, const MlpiTaskTrigger* taskTrigger, const ULONG numElements);
610 
611 
648 MLPI_API MLPIRESULT mlpiTaskGetTrigger(const MLPIHANDLE connection, MlpiTaskTrigger* taskTrigger, const ULONG numElements, BOOL8* cmdActive, ULONG* numElementsRet);
649 
650 
680 MLPI_API MLPIRESULT mlpiTaskViewerStart(const MLPIHANDLE connection);
681 
682 
690 MLPI_API MLPIRESULT mlpiTaskViewerStop(const MLPIHANDLE connection);
691 
692 
713 MLPI_API MLPIRESULT mlpiTaskViewerAddItem(const MLPIHANDLE connection, const UCHAR *data, const ULONG numElements);
714 
715 
767 MLPI_API MLPIRESULT mlpiTaskViewerTaskStart(const MLPIHANDLE connection);
768 
769 
780 MLPI_API MLPIRESULT mlpiTaskViewerTaskStop(const MLPIHANDLE connection);
781 
796 MLPI_API MLPIRESULT mlpiTaskViewerGetState(const MLPIHANDLE connection, MlpiTaskViewerState* state);
797 
819 MLPI_API MLPIRESULT mlpiTaskExecuteFile(const MLPIHANDLE connection, const WCHAR16* path, const WCHAR16* envArguments, const WCHAR16* arguments, MLPITASKHANDLE* handle);
820 
848 MLPI_API MLPIRESULT mlpiTaskExecuteGetStatus(const MLPIHANDLE connection, const MLPITASKHANDLE handle, MlpiProcessState* state);
849 
874 MLPI_API MLPIRESULT mlpiTaskExecuteGetActive(const MLPIHANDLE connection, MLPITASKHANDLE* handles, const ULONG numElements, ULONG* numElementsRet);
875 
901 MLPI_API MLPIRESULT mlpiTaskExecuteKill(const MLPIHANDLE connection, const MLPITASKHANDLE handle);
902 
931 MLPI_API MLPIRESULT mlpiTaskExecuteGetName(const MLPIHANDLE connection, const MLPITASKHANDLE handle, WCHAR16* name, const ULONG numElements);
932 
933 #ifdef __cplusplus
934 }
935 #endif
936 
937 
938 
939 #endif // endof: #ifndef __MLPITASKLIB_H__
MlpiTaskEvent
There are different system task events in the system.
Definition: mlpiTaskLib.h:316
static const ULONG MLPI_PRIORITY_BACKGROUND
Default priority for user task. Use for tasks which are doing GUI, HMI, service, etc...
Definition: mlpiTaskLib.h:309
MLPIRESULT mlpiTaskViewerStart(const MLPIHANDLE connection)
This function starts a task viewer session, all task information is stored in a ring buffer as long a...
unsigned char UCHAR
1 byte unsigned integer
Definition: mlpiGlobal.h:160
This event raises before any plc task will writes its outputs (helpful for I/O simulation, e.g. read from outputs of task images).
Definition: mlpiTaskLib.h:322
MLPIRESULT mlpiTaskViewerTaskStop(const MLPIHANDLE connection)
This function sets a STOP event into a task viewer session.
MlpiTaskTriggerEvent
There are different trigger events.
Definition: mlpiTaskLib.h:332
MLPIRESULT mlpiTaskViewerAddItem(const MLPIHANDLE connection, const UCHAR *data, const ULONG numElements)
This function adds a user event into the task viewer session. Use this function to mark special event...
signed char BOOL8
1 byte boolean
Definition: mlpiGlobal.h:158
unsigned short USHORT
2 byte unsigned integer
Definition: mlpiGlobal.h:162
MlpiProcessState
This enumeration defines the state of a process.
Definition: mlpiGlobal.h:254
This option says if an warning should be set as long as an event is decoupled from cyclic execution...
Definition: mlpiTaskLib.h:345
MLPIRESULT mlpiTaskViewerStop(const MLPIHANDLE connection)
This function stops a task viewer session.
MLPIRESULT mlpiTaskExecuteGetStatus(const MLPIHANDLE connection, const MLPITASKHANDLE handle, MlpiProcessState *state)
This function gets the status of an executed file.
struct MlpiTaskTrigger MlpiTaskTrigger
This structure defines the information to trigger events.
MlpiSystemTask
There are different system tasks.
Definition: mlpiTaskLib.h:326
MLPIRESULT mlpiTaskSetCurrentPriority(const MLPIHANDLE connection, const ULONG priority)
This function sets the priority of the calling task. Use this to set the priority of your own user C/...
This option says if the sercos is decoupled from cyclic execution.
Definition: mlpiTaskLib.h:342
MLPIRESULT mlpiTaskSetTriggerSetup(const MLPIHANDLE connection, const MlpiTaskTriggerSetup *triggerSetup, const ULONG numElements)
This function sets the configuration of the external trigger. Use this function to deactivate cyclic ...
This event raises every new sercos cycle after the actual values arrive.
Definition: mlpiTaskLib.h:318
This option says if the motion is decoupled from cyclic execution.
Definition: mlpiTaskLib.h:341
MlpiTaskViewerState
There are different task viewer states.
Definition: mlpiTaskLib.h:350
wchar_t WCHAR16
UTF16 string.
Definition: mlpiGlobal.h:193
unsigned int ULONG
4 byte unsigned integer
Definition: mlpiGlobal.h:165
unsigned long long MLPITASKHANDLE
MLPI-API handle value used for tasks.
Definition: mlpiGlobal.h:209
MLPIRESULT mlpiTaskViewerGetState(const MLPIHANDLE connection, MlpiTaskViewerState *state)
This function gets the current state if the task viewer.
MLPIRESULT mlpiTaskGetCurrentPriority(const MLPIHANDLE connection, ULONG *priority)
Read back the priority of the calling task.
MLPIRESULT mlpiTaskGetSystemPriority(const MLPIHANDLE connection, const MlpiSystemTask task, ULONG *priority)
This function reads back the priority of a task inside the system. For example, you can get the prior...
This state says that the task viewer is currently stopped.
Definition: mlpiTaskLib.h:352
MLPIRESULT mlpiTaskSetSystemPriority(const MLPIHANDLE connection, const MlpiSystemTask task, const ULONG priority)
This function sets the priority of tasks inside the system. For example, you can set the priority of ...
static const ULONG MLPI_PRIORITY_HIGH_MAX
The highest available level for cyclic system/user tasks. Use with mlpiTaskSetCurrentPriority and NOT...
Definition: mlpiTaskLib.h:307
struct MlpiTaskTriggerSetup MlpiTaskTriggerSetup
This structure defines the information needed to get or set the trigger setup.
This event raises every time a watchdog expires.
Definition: mlpiTaskLib.h:320
MLPIRESULT mlpiTaskExecuteFile(const MLPIHANDLE connection, const WCHAR16 *path, const WCHAR16 *envArguments, const WCHAR16 *arguments, MLPITASKHANDLE *handle)
This function executes a file.
This option says if the call of the function &#39;mlpiTaskSetTrigger&#39; should be synchronous.
Definition: mlpiTaskLib.h:346
This option says if the execution of the external trigger should be executed immediately. The events are triggered immediately one after the other, not within their cycletimes.
Definition: mlpiTaskLib.h:343
MLPIRESULT mlpiTaskExecuteGetActive(const MLPIHANDLE connection, MLPITASKHANDLE *handles, const ULONG numElements, ULONG *numElementsRet)
This function gets handles for all executed files.
This event executes all sercos cyclic tasks (e.g. sercos cyclic PLC-Tasks, tasks delaying on event &#39;M...
Definition: mlpiTaskLib.h:335
This is the task which is doing all the motion calculation. For example all PLCOpen motion...
Definition: mlpiTaskLib.h:328
MlpiTaskTriggerOption
There are different trigger options.
Definition: mlpiTaskLib.h:339
This event raises after any plc task will reads its inputs (helpful for I/O simulation, e.g. write to inputs of task images).
Definition: mlpiTaskLib.h:321
MLPIRESULT mlpiTaskSetTrigger(const MLPIHANDLE connection, const MlpiTaskTrigger *taskTrigger, const ULONG numElements)
This function executes the external trigger. To trigger an event it has to be decoupled from the cycl...
This option says if decoupling of events should stay active in case of an error.
Definition: mlpiTaskLib.h:344
This state says that the task viewer is currently running.
Definition: mlpiTaskLib.h:353
This event executes all motion cyclic tasks (e.g. MotionKernel for Interpolation, motion cyclic PLC-T...
Definition: mlpiTaskLib.h:334
static const ULONG MLPI_PRIORITY_HIGH_MIN
The lowest available level for cyclic system/user tasks. Use with mlpiTaskSetCurrentPriority and NOT ...
Definition: mlpiTaskLib.h:308
MLPIRESULT mlpiTaskGetTriggerSetup(const MLPIHANDLE connection, MlpiTaskTriggerSetup *triggerSetup, const ULONG numElements, ULONG *numElementsRet)
This function gets the configuration of the external trigger.
MLPIRESULT mlpiTaskExecuteGetName(const MLPIHANDLE connection, const MLPITASKHANDLE handle, WCHAR16 *name, const ULONG numElements)
This function gets the name of an executed file.
This event raises every new motion cycle after the actual values of all axes have been updated...
Definition: mlpiTaskLib.h:319
MLPIRESULT mlpiTaskWaitForEvent(const MLPIHANDLE connection, const MlpiTaskEvent taskEvent, const ULONG timeout)
This function pends the calling task until the given event occurs. You can use it to synchronize a ta...
unsigned long MLPIHANDLE
common MLPI-API handle value
Definition: mlpiGlobal.h:206
MLPIRESULT mlpiTaskViewerTaskStart(const MLPIHANDLE connection)
This function sets a START event into a task viewer session.
int MLPIRESULT
common MLPI-API return value
Definition: mlpiGlobal.h:198
MLPIRESULT mlpiTaskExecuteKill(const MLPIHANDLE connection, const MLPITASKHANDLE handle)
This function stops execution of file.
MLPIRESULT mlpiTaskGetTrigger(const MLPIHANDLE connection, MlpiTaskTrigger *taskTrigger, const ULONG numElements, BOOL8 *cmdActive, ULONG *numElementsRet)
This function gets the configuration of the events of external trigger functionality.