Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
System.java
Go to the documentation of this file.
1 // -----------------------------------------------------------------------
2 // MLPI - <System.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 
59 
60 
65 public class System extends MlpiComponent {
66  /*
67  * Constants
68  */
69  final public String VERSION_FIRMWARE = "VERSION_FIRMWARE";
70  final public String VERSION_HARDWARE = "VERSION_HARDWARE";
71  final public String VERSION_LOGIC = "VERSION_LOGIC";
72  final public String VERSION_BSP = "VERSION_BSP";
73  final public String VERSION_MLPI_SERVER_CORE = "VERSION_MLPI_SERVER_CORE";
74 
75  /*
76  * Enums
77  */
88  public enum Language
89  {
90  LANGUAGE_GERMAN (0),
91  LANGUAGE_ENGLISH (1),
92  LANGUAGE_USER_DEFINED (99);
93 
94  private int _code;
95  int getCode() { return _code; }
96  Language(int code) { this._code = code; }
97  static Language valueOf(int code) {
98  for (Language value : values()) {
99  if (code == value.getCode()) return value;
100  }
101  return null;
102  }
103  }
104 
121  public enum SystemMode
122  {
123  SYSTEMMODE_P0 (0x00),
124  SYSTEMMODE_P1 (0x01),
125  SYSTEMMODE_P2 (0x02),
126  SYSTEMMODE_P3 (0x03),
127  SYSTEMMODE_BB (0x04),
128  SYSTEMMODE_SWITCHING (0xFF);
129 
130  private int _code;
131  int getCode() { return _code; }
132  SystemMode(int code) { this._code = code; }
133  static SystemMode valueOf(int code) {
134  for (SystemMode value : values()) {
135  if (code == value.getCode()) return value;
136  }
137  return null;
138  }
139  }
140 
152  public enum DiagnosisState
153  {
154  DIAGNOSIS_PASSIVE (0x00),
155  DIAGNOSIS_ACTIVE (0x01),
156  DIAGNOSIS_RESET (0x02),
157  DIAGNOSIS_UNKNOWN (0x03);
158 
159  private int _code;
160  int getCode() { return _code; }
161  DiagnosisState(int code) { this._code = code; }
162  static DiagnosisState valueOf(int code) {
163  for (DiagnosisState value : values()) {
164  if (code == value.getCode()) return value;
165  }
166  return null;
167  }
168  }
169 
184  {
185  DESPATCHER_CONTROL (0x00),
186  DESPATCHER_DRIVE (0x01),
187  DESPATCHER_LOGIC (0x02),
188  DESPATCHER_AXIS (0x03),
189  DESPATCHER_KINEMATIC (0x04),
190  DESPATCHER_PCI (0x05);
191 
192  private int _code;
193  int getCode() { return _code; }
194  DiagnosisDespatcher(int code) { this._code = code; }
195  static DiagnosisDespatcher valueOf(int code) {
196  for (DiagnosisDespatcher value : values()) {
197  if (code == value.getCode()) return value;
198  }
199  return null;
200  }
201  }
202 
221  public enum MlpiLedPattern
222  {
223  MLPI_LED_PATTERN_GREEN ( 0),
224  MLPI_LED_PATTERN_GREEN_250 ( 1),
225  MLPI_LED_PATTERN_GREEN_500 ( 2),
226  MLPI_LED_PATTERN_GREEN_1000 ( 3),
227  MLPI_LED_PATTERN_GREEN_ORANGE_250 ( 4),
228  MLPI_LED_PATTERN_GREEN_ORANGE_500 ( 5),
229  MLPI_LED_PATTERN_GREEN_ORANGE_1000 ( 6),
230  MLPI_LED_PATTERN_GREEN_RED_250 ( 7),
231  MLPI_LED_PATTERN_GREEN_RED_500 ( 8),
232  MLPI_LED_PATTERN_GREEN_RED_1000 ( 9),
233  MLPI_LED_PATTERN_INVALID ( -1);
234 
235  private int _code;
236  int getCode() { return _code; }
237  MlpiLedPattern(int code) { this._code = code; }
238  static MlpiLedPattern valueOf(int code) {
239  for (MlpiLedPattern value : values()) {
240  if (code == value.getCode()) return value;
241  }
242  return null;
243  }
244  }
245 
272  public enum SpecialPath
273  {
274  PATH_SYSTEM (0x00),
275  PATH_OEM (0x01),
276  PATH_USER (0x02),
277  PATH_PROJECTDATAPROTECTED (0x03),
278  PATH_PROJECTDATA (0x04),
279  PATH_PROJECTDATA_BUNDLES (0x05),
280  PATH_PROJECTDATA_PLC (0x06),
281  PATH_PROJECTDATA_TMP (0x07),
282  PATH_PROJECTDATA_JVM (0x08),
283  PATH_PROJECTDATA_JVM_BUNDLES (0x09),
284  PATH_PROJECTDATA_JVM_LIC (0x0A),
285  PATH_PROJECTDATA_JVM_USER (0x0B),
286  PATH_PROJECTDATAPROTECTED_BUNDLES (0x0C),
287  PATH_PROJECTDATAPROTECTED_JVM (0x0D),
288  PATH_PROJECTDATAPROTECTED_JVM_BUNDLES (0x0E),
289  PATH_PROJECTDATAPROTECTED_JVM_LIC (0x0F),
290  PATH_PROJECTDATAPROTECTED_JVM_USER (0x10);
291 
292  private int _code;
293  int getCode() { return _code; }
294  SpecialPath(int code) { this._code = code; }
295  static SpecialPath valueOf(int code) {
296  for (SpecialPath value : values()) {
297  if (code == value.getCode()) return value;
298  }
299  return null;
300  }
301  }
302 
315  public enum DiagnosisCategory
316  {
317  DIAGNOSIS_ERROR_FATAL (0xF8),
318  DIAGNOSIS_ERROR_NONFATAL_CONTROL (0xF5),
319  DIAGNOSIS_ERROR_NONFATAL (0xF0),
320  DIAGNOSIS_WARNING (0xE0),
321  DIAGNOSIS_MESSAGE (0xA0);
322 
323  private int _code;
324  int getCode() { return _code; }
325  DiagnosisCategory(int code) { this._code = code; }
326  static DiagnosisCategory valueOf(int code) {
327  for (DiagnosisCategory value : values()) {
328  if (code == value.getCode()) return value;
329  }
330  return null;
331  }
332  }
333 
349  public enum MlpiSystemLimit
350  {
351  MAX_APPLICATIONS ( 0),
352  MAX_CONTROLS ( 1),
353  MAX_AXIS ( 2),
354  MAX_PLS ( 3),
355  MAX_KINEMATICS ( 4),
356  MAX_TOUCHPROBES ( 5),
357  MAX_OSCI_CHANNELS ( 6),
358  INVALID (-1);
359 
360  private int _code;
361  int getCode() { return _code; }
362  MlpiSystemLimit(int code) { this._code = code; }
363  static MlpiSystemLimit valueOf(int code) {
364  for (MlpiSystemLimit value : values()) {
365  if (code == value.getCode()) return value;
366  }
367  return null;
368  }
369  }
370 
371  /*
372  * Structs
373  */
391  public static class DateAndTime
392  {
393  public short year;
394  public short month;
395  public short day;
396  public short hour;
397  public short minute;
398  public short second;
399  public short milliSecond;
400  public short microSecond;
401  public short dayOfWeek;
402  public short dayOfYear;
403 
404  @Override
405  public String toString()
406  {
407  return String.format("%04d-%02d-%02d %02d:%02d:%02d.%03d", year,month,day,hour,minute,second,milliSecond);
408  }
409  };
410 
426  public static class Diagnosis
427  {
428  public long number;
430  public DateAndTime dateTime = new DateAndTime();
431  public int logicalAddress;
432  public int physicalAddress;
434  public long index;
435  public String text;
436 
437  @Override
438  public String toString()
439  {
440  String numberAsString = Long.toHexString(number);
441  return numberAsString.substring(0,4) + "." + numberAsString.substring(4,numberAsString.length()) + "\t" + dateTime.toString() + "\t" + text;
442  }
443  }
444 
456  public static class MemoryInfo
457  {
458  public long totalVolatileBytes;
459  public long totalNonvolatileBytes;
460  public long freeVolatileBytes;
461  public long freeNonvolatileBytes;
462 
463  @Override
464  public String toString()
465  {
466  return "total volatile memory:\t" + convertBytes(totalVolatileBytes) + "\t free volatile memory:\t" + convertBytes(freeVolatileBytes) +
467  "\ttotal non-volatile memory:\t" + convertBytes(totalNonvolatileBytes) + "\t free non-volatile memory:\t" + convertBytes(freeNonvolatileBytes);
468  }
469 
470  private String convertBytes(long bytes)
471  {
472  if(bytes < 1024) return bytes + " Bytes";
473  int exp = (int) (Math.log(bytes) / Math.log(1024));
474  String unit = "KMGTPE".charAt(exp-1) + "i";
475  return String.format("%.1f %sB", bytes / Math.pow(1024, exp), unit);
476  }
477  }
478 
488  public static class SpecialPathInfo
489  {
490  public long totalDiskspace;
491  public long freeDiskspace;
492 
493  @Override
494  public String toString()
495  {
496  return "free diskspace:\t" + convertBytes(freeDiskspace) + "\ttotal diskspace\t" + convertBytes(totalDiskspace);
497  }
498 
499  private String convertBytes(long bytes)
500  {
501  if(bytes < 1024) return bytes + " Bytes";
502  int exp = (int) (Math.log(bytes) / Math.log(1024));
503  String unit = "KMGTPE".charAt(exp-1) + "i";
504  return String.format("%.1f %sB", bytes / Math.pow(1024, exp), unit);
505  }
506  };
507 
508 
509 
510  /*
511  * Methods
512  */
513  System(MlpiHandle connection) {
514  super(connection);
515  }
516 
530  public native String getName();
531 
548  public native void setName(String name);
549 
563  public native long getTargetId();
564 
565 
579  public native float getTemperature();
580 
594  public native float getTemperatureMax();
595 
602  public native void resetTemperature();
603 
620  public native String getIpAddress();
621 
638  public native void setIpAddress(String ipAddress);
639 
651  public native String getSubnetMask();
652 
664  public native void setSubnetMask(String subnetMask);
665 
677  public native String getGateway();
678 
690  public native void setGateway(String gateway);
691 
705  public native SystemMode getCurrentMode();
706 
738  public native void setTargetMode(SystemMode mode);
739 
753  public native float getCpuLoad();
754 
768  public native float getCpuLoadMax();
769 
776  public native void resetCpuLoad();
777 
813  public native Diagnosis getDisplayedDiagnosis();
814 
828  public native long getNewestDiagnosisIndex();
829 
843  public native long getOldestDiagnosisIndex();
844 
891  public native Diagnosis[] getDiagnosisLog(long startIndex, long numToRead);
892 
913  public native String convertDiagnosisNumberToText(int diagnosisNumber);
914 
928  public native long getOperationHours();
929 
936  public native void reboot();
937 
946  public native void cleanup();
947 
962  public native Language getLanguage();
963 
980  public native void setLanguage(Language language);
981 
1000  public native SpecialPathInfo getSpecialPathInfo(SpecialPath pathIdentifier);
1001 
1022  public native MemoryInfo getMemoryInfo();
1023 
1038  public native DateAndTime getDateAndTimeUtc();
1039 
1058  public native void setDateAndTimeUtc(DateAndTime dateTime);
1059 
1076  public native void setDateAndTimeUtcByNtp(long timeout, String server, int port);
1077 
1101  public native String getSpecialPath(SpecialPath pathIdentifier);
1102 
1123  public native String[] getRootPaths();
1124 
1138  public native String getLicenseInformation();
1139 
1171  public native String getVersionInfo(String component);
1172 
1186  public native String getSerialNumber();
1187 
1199  public native String getMacAddress();
1200 
1207  public native void clearError();
1208 
1222  public native String getHardwareDetails();
1223 
1240  public native void setDiagnosis(DiagnosisCategory category, int number, String diagnosisText);
1241 
1257  public native void setBootLed(MlpiLedPattern pattern, int count);
1258 
1271  public native void clearBootLed();
1272 
1288  public native long getLimit(MlpiSystemLimit limit);
1289 }
1290 
native String getGateway()
native void setTargetMode(SystemMode mode)
native void setIpAddress(String ipAddress)
Class definition of the SystemLib.
Definition: System.java:65
String text
Diagnosis text with diagnosis description.
Definition: System.java:435
native String[] getRootPaths()
native long getLimit(MlpiSystemLimit limit)
native void setDateAndTimeUtcByNtp(long timeout, String server, int port)
native Language getLanguage()
short second
Seconds after minute.
Definition: System.java:398
long freeDiskspace
Free disk space of the partition in bytes.
Definition: System.java:491
native void resetTemperature()
native long getOperationHours()
native String getVersionInfo(String component)
This enumeration provides different LED status resp. diagnosis pattern.
Definition: System.java:221
native void setSubnetMask(String subnetMask)
This enumeration must be used when accessing language settings in the device.
Definition: System.java:88
native String getMacAddress()
native void setName(String name)
This enumeration must be used when accessing the diagnostic details in the device.
Definition: System.java:152
short minute
Minutes after hour.
Definition: System.java:397
native long getNewestDiagnosisIndex()
native MemoryInfo getMemoryInfo()
native void setDiagnosis(DiagnosisCategory category, int number, String diagnosisText)
native String convertDiagnosisNumberToText(int diagnosisNumber)
native String getHardwareDetails()
int logicalAddress
Logical address of the device(e.g. axis, touchprobe,...) that dispatched the diagnosis.
Definition: System.java:431
This enumeration provides different limit defines.
Definition: System.java:349
This enumeration contains different diagnosis categories on the device.
Definition: System.java:315
long totalDiskspace
Total size of the partition in bytes.
Definition: System.java:490
native String getIpAddress()
native String getLicenseInformation()
This structure defines the broken date and time information.
Definition: System.java:426
This enumeration must be used when accessing the mode settings in the device.
Definition: System.java:121
native Diagnosis getDisplayedDiagnosis()
native String getSubnetMask()
long number
Identity number described in the help manual and used to identify the diagnosis.
Definition: System.java:428
native SpecialPathInfo getSpecialPathInfo(SpecialPath pathIdentifier)
DiagnosisState state
State of a diagnostic message.
Definition: System.java:429
short milliSecond
Milliseconds after second.
Definition: System.java:399
native void setDateAndTimeUtc(DateAndTime dateTime)
native float getCpuLoadMax()
native String getSpecialPath(SpecialPath pathIdentifier)
long index
Index of the diagnosis inside the diagnosis ring buffer.
Definition: System.java:434
DiagnosisDespatcher despatcher
Identifying source of diagnosis.
Definition: System.java:433
native String getSerialNumber()
This structure defines the special path information.
Definition: System.java:488
native void setBootLed(MlpiLedPattern pattern, int count)
short microSecond
Microseconds after milliseconds.
Definition: System.java:400
native void setGateway(String gateway)
short hour
Hours after midnight.
Definition: System.java:396
native SystemMode getCurrentMode()
int physicalAddress
Physical address of a physical device possibly connected to the logical object, e.g. drive of an axis.
Definition: System.java:432
native float getTemperatureMax()
native float getTemperature()
native DateAndTime getDateAndTimeUtc()
native long getOldestDiagnosisIndex()
This enumeration contains different logical paths on the device.
Definition: System.java:272
This structure defines the broken date and time information.
Definition: System.java:391
native Diagnosis[] getDiagnosisLog(long startIndex, long numToRead)
This enumeration must be used when accessing the diagnostic details in the device.
Definition: System.java:183
native void setLanguage(Language language)