Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
Task.java
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // MLPI - <Task.java>
3 // -----------------------------------------------------------------------
4 // Copyright (c) 2012 Bosch Rexroth. All rights reserved.
5 // Redistribution and use in source and binary forms of this MLPI software
6 // (SW) provided to you, with or without modification, are permitted
7 // without prior approval provided that the following conditions are met:
8 //
9 // 1. Redistributions of source code of SW must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 //
12 // 2. Redistributions in binary form of SW must reproduce the above copyright
13 // notice, this list of conditions and the following disclaimer in the
14 // documentation and/or other materials provided with the distribution.
15 //
16 // 3. User recognizes and acknowledges that it acquires no right,
17 // title or interest in or to any of the names or trademarks used in
18 // connection with the SW ("names") by virtue of this License and waives
19 // any right to or interest in the names. User recognizes and acknowledges
20 // that names of companies or names or products of companies displayed
21 // in the documentation of SW to indicate the interoperability of products
22 // with the SW are the names of their respective owners. The use of such
23 // names in the documentation of SW does not imply any sponsorship,
24 // approval, or endorsement by such companies of this product.
25 //
26 // 4. Modified code versions, i.e. any addition to or deletion from
27 // the substance or structure of the original code of the SW running
28 // the MLPI must be plainly marked as such and must not be misrepresented
29 // as being original SW.
30 //
31 // 5. The SW may only be used in connection with a Bosch Rexroth product.
32 //
33 // THIS INFORMATION IS PROVIDED BY BOSCH REXROTH CORPORATION "AS IS"
34 // AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING
35 // (BUT NOTLIMITED TO) ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
36 // FITNESS FOR ANY PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WHILE THE
37 // INFORMATION PROVIDED IS BELIEVED TO BE ACCURATE, IT MAY INCLUDE
38 // ERRORS OR INACCURACIES.
39 // SUBJECT TO COMPULSORY STATUTORY PROVISIONS OF THE GERMAN LAW AS
40 // THE APPLICABLE LAW FOR THIS LICENSE BOSCH REXROTH CORPORATION WILL
41 // NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND ARISING FROM THE USE OF
42 // THE SOFTWARE DISTRIBUTED HEREUNDER, INCLUDING BUT NOT LIMITED TO
43 // DIRECT, INDIRECT, INCIDENTAL, PUNITIVE, AND CONSEQUENTIAL DAMAGES.
44 // -----------------------------------------------------------------------
45 //
55 //
56 // -----------------------------------------------------------------------
57 package com.boschrexroth.mlpi;
58 
60 
61 
62 
67 public class Task extends MlpiComponent {
68  /*
69  * Constants
70  */
71 
72  /*
73  * Enums
74  */
84  public enum TriggerEvent
85  {
86  TRIG_EVT_MOTION (0),
87  TRIG_EVT_SERCOS (1);
88 
89  private int _code;
90  int getCode() { return _code; }
91  TriggerEvent(int code) { this._code = code; }
92  static TriggerEvent valueOf(int code) {
93  for (TriggerEvent value : values()) {
94  if (code == value.getCode()) return value;
95  }
96  return null;
97  }
98  }
99 
113  public enum TriggerOption
114  {
115  TRIG_OPT_NO_CYCLIC_MOTION (0),
116  TRIG_OPT_NO_CYCLIC_SERCOS (1),
117  TRIG_OPT_IMMEDIATE_EXECUTION (2),
118  TRIG_OPT_NO_ERROR_REACTION (3),
119  TRIG_OPT_NO_WARNING (4),
120  TRIG_OPT_SYNCHRONOUS (5);
121 
122  private int _code;
123  int getCode() { return _code; }
124  TriggerOption(int code) { this._code = code; }
125  static TriggerOption valueOf(int code) {
126  for (TriggerOption value : values()) {
127  if (code == value.getCode()) return value;
128  }
129  return null;
130  }
131  }
132 
142  public enum TaskViewerState
143  {
144  TASK_VIEWER_STATE_STOPPED (0),
145  TASK_VIEWER_STATE_RUNNING (1);
146 
147  private int _code;
148  int getCode() { return _code; }
149  TaskViewerState(int code) { this._code = code; }
150  static TaskViewerState valueOf(int code) {
151  for (TaskViewerState value : values()) {
152  if (code == value.getCode()) return value;
153  }
154  return null;
155  }
156  }
157 
170  public enum TaskProcessState
171  {
172  PROCESS_STATUS_NOT_STARTED (0),
173  PROCESS_STATUS_INITIALIZATION (32),
174  PROCESS_STATUS_INWORK (64),
175  PROCESS_STATUS_FINISHED (128),
176  PROCESS_STATUS_ERROR (256);
177 
178  private int _code;
179  int getCode() { return _code; }
180  TaskProcessState(int code) { this._code = code; }
181  static TaskProcessState valueOf(int code) {
182  for (TaskProcessState value : values()) {
183  if (code == value.getCode()) return value;
184  }
185  return null;
186  }
187  }
188 
189 
190  /*
191  * Structs
192  */
202  public static class TriggerSetup
203  {
205  public boolean active;
206  };
207 
218  public static class Trigger
219  {
221  public boolean active;
222  public int numTriggers;
223  };
224 
225 
226  /*
227  * Methods
228  */
229  Task(MlpiHandle connection) {
230  super(connection);
231  }
232 
263  public native void setTriggerSetup(TriggerSetup[] triggerSetup);
264 
288  public native void getTriggerSetup(TriggerSetup[] tiggerSetup);
289 
321  public native void setTrigger(Trigger[] trigger);
322 
348  public native boolean getTrigger(Trigger[] trigger);
349 
364  public native void startTaskViewer();
365 
378  public native void stopTaskViewer();
379 
394  public native TaskViewerState getTaskViewerState();
395 
413  public native long executeFile(String path, String envArguments, String arguments);
414 
430  public native TaskProcessState executeGetStatus(long handle);
431 
445  public native long[] executeGetActive();
446 
460  public native void executeKill(long handle);
461 
476  public native String executeGetName(long handle);
477 
478 }
native void getTriggerSetup(TriggerSetup[] tiggerSetup)
This enumeration defines the different trigger options in the device.
Definition: Task.java:113
Class definition of the SystemLib.
Definition: System.java:65
native void stopTaskViewer()
boolean active
Event active or inactive.
Definition: Task.java:221
Class definition of the TaskLib.
Definition: Task.java:67
This enumeration must be used when accessing language settings in the device.
Definition: System.java:88
This enumeration defines the different trigger events in the device.
Definition: Task.java:84
TriggerOption triggerOption
Options available for task trigger.
Definition: Task.java:204
This structure defines the information needed to get or set the trigger setup.
Definition: Task.java:202
This structure defines the information to trigger events.
Definition: Task.java:218
native TaskViewerState getTaskViewerState()
native String executeGetName(long handle)
This enumeration defines the state of a process.
Definition: Task.java:170
native void setTrigger(Trigger[] trigger)
This enumeration defines the different task viewer states.
Definition: Task.java:142
TriggerEvent triggerEvent
Event which should be triggered.
Definition: Task.java:220
native long executeFile(String path, String envArguments, String arguments)
boolean active
Option active or inactive.
Definition: Task.java:205
native boolean getTrigger(Trigger[] trigger)
native void setTriggerSetup(TriggerSetup[] triggerSetup)
native TaskProcessState executeGetStatus(long handle)
native void executeKill(long handle)
int numTriggers
Number of triggers for an event.
Definition: Task.java:222
native long[] executeGetActive()
native void startTaskViewer()