Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Java)  1.26.2
Container.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 import java.util.HashMap;
60 import java.util.Map;
61 import java.util.Vector;
62 
67 
72 public class Container extends MlpiComponent {
73  /*
74  * Constants
75  */
76  public final String CONTAINER_TAG_SEPARATOR = ";";
77  public final String CONTAINER_ARG_SEPARATOR = ",";
78 
79  public final String CONTAINER_TAG_LOGICLIB_MEMORY_AREA = "LOGICLIB_MEMORY_AREA";
80  public final String CONTAINER_TAG_LOGICLIB_SYMBOL = "LOGICLIB_SYMBOL";
81  public final String CONTAINER_TAG_IOLIB_FIELBUS_IO = "IOLIB_FIELBUS_IO"; //<! Deprecated.
82  public final String CONTAINER_TAG_IOLIB_FIELDBUS_IO = "IOLIB_FIELBUS_IO"; //<! Spelling of "Fieldbus" was wrong till MLPI version 1.5.0.0. Due to compatibility reasons, we can not change the adapted string value.
83  public final String CONTAINER_TAG_ALIGNMENT_DUMMY = "ALIGNMENT_DUMMY";
84 
85  public final String CONTAINER_ARG_IOLIB_IO_AREA_INPUT = "INPUT";
86  public final String CONTAINER_ARG_IOLIB_IO_AREA_OUTPUT = "OUTPUT";
87 
88  public final String CONTAINER_ARG_LOGICLIB_MEMORY_AREA_INPUT = "INPUT";
89  public final String CONTAINER_ARG_LOGICLIB_MEMORY_AREA_OUTPUT = "OUTPUT";
90  public final String CONTAINER_ARG_LOGICLIB_MEMORY_AREA_MARKER = "MARKER";
91 
92 
93  /*
94  * Enums
95  */
96  public enum ContainerAccess
97  {
98  CONTAINER_ACCESS_READ (0),
99  CONTAINER_ACCESS_WRITE (1);
100 
101  private int _code;
102  int getCode() { return _code; }
103  ContainerAccess(int code) { this._code = code; }
104  static ContainerAccess valueOf(int code) {
105  for (ContainerAccess value : values()) {
106  if (code == value.getCode()) return value;
107  }
108  return null;
109  }
110  }
111 
112 
126  public static class ContainerInformation
127  {
128  String name;
129  DateAndTime dateTime = new DateAndTime();
130  int numItems;
131  int numElementsTagList;
132  int dataSize;
133  ContainerAccess accessFlag;
134  };
135 
146  public static class ContainerItemInformation
147  {
148  MlpiGlobal.Type type;
149  int offset;
150  int dataSize;
151 
152  public MlpiGlobal.Type getType() {return type;}
153  public int getOffset() {return offset;}
154  public int getDataSize() {return dataSize;}
155  };
156 
167  public static class ContainerHandle
168  {
169  public ContainerHandle() {
170  connectionID = -1;
171  containerID = -1;
172  }
173  int connectionID;
174  int containerID;
175  };
176 
177 
178  /*
179  * Fields
180  */
181  Map<String, ContainerStructure> _readContainers = new HashMap<String, ContainerStructure>();
182  Map<String, ContainerStructure> _writeContainers = new HashMap<String, ContainerStructure>();
183 
184 
185  /*
186  * Methods
187  */
188  Container(MlpiHandle connection) {
189  super(connection);
190  }
191 
192 
193  public synchronized ContainerStructure read(String name) {
194  ContainerStructure container = _readContainers.get(name);
195 
196  if (container == null) {
197  container = new ContainerStructure(this, name, ContainerAccess.CONTAINER_ACCESS_READ);
198  _readContainers.put(name, container);
199  }
200  return container;
201  }
202 
203  public synchronized ContainerStructure write(String name) {
204  ContainerStructure container = _writeContainers.get(name);
205 
206  if (container == null) {
207  container = new ContainerStructure(this, name, ContainerAccess.CONTAINER_ACCESS_WRITE);
208  _writeContainers.put(name, container);
209  }
210  return container;
211  }
212 
236  public native int create(String tagList, ContainerAccess accessFlag, ContainerHandle containerHandle);
237 
251  public native byte[] update(ContainerHandle containerHandle, byte[] buffer);
252 
265  public native void destroy(ContainerHandle containerHandle);
266 
279  public native void setName(ContainerHandle containerHandle, String name);
280 
291  public native String getName(ContainerHandle containerHandle);
292 
304  public native ContainerInformation getInformation(ContainerHandle containerHandle);
305 
317  public native String[] getTagList(ContainerHandle containerHandle);
318 
332  public native ContainerItemInformation[] getItemInformation(ContainerHandle containerHandle);
333 }
native ContainerInformation getInformation(ContainerHandle containerHandle)
Empty class definition which defines global structures/classes.
Definition: MlpiGlobal.java:65
This class defines the axis through the definition of control and axis number.
Definition: Motion.java:417
native byte[] update(ContainerHandle containerHandle, byte[] buffer)
native String[] getTagList(ContainerHandle containerHandle)
native int create(String tagList, ContainerAccess accessFlag, ContainerHandle containerHandle)
This enumeration defines the basic types of variables used by the MLPI.
native void setName(ContainerHandle containerHandle, String name)
This class defines the information of a container item.
Definition: Container.java:146
native ContainerItemInformation[] getItemInformation(ContainerHandle containerHandle)
This class defines the handle to a container.
Definition: Container.java:167
This class defines information about the date and time.
This enumeration defines the method of how a flex profile interprets the start point.
Definition: Motion.java:223
Class definition of the MotionLib.
Definition: Motion.java:66
This class defines the information content of a container.
Definition: Container.java:126
native void destroy(ContainerHandle containerHandle)
native String getName(ContainerHandle containerHandle)