You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/10/23 12:31:27 UTC
[plc4x] 01/01: PLC4X-146 - Problem when using
examples/hello-integration-edgent with plc-simulator
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch feature/PLC4X-146
in repository https://gitbox.apache.org/repos/asf/plc4x.git
commit 2c39d483067efc46a88d77dec4f5d9b6c656dc8d
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Wed Oct 23 14:31:14 2019 +0200
PLC4X-146 - Problem when using examples/hello-integration-edgent with plc-simulator
- Replaced the explicit mapping in the Edgent connector with the implicit one provided by the getObject method.
---
.../apache/plc4x/edgent/PlcConnectionAdapter.java | 37 +---------------------
1 file changed, 1 insertion(+), 36 deletions(-)
diff --git a/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java b/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
index 822a503..de43ea3 100644
--- a/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
+++ b/plc4j/integrations/apache-edgent/src/main/java/org/apache/plc4x/edgent/PlcConnectionAdapter.java
@@ -166,42 +166,7 @@ public class PlcConnectionAdapter implements AutoCloseable {
connection = getConnection();
PlcReadRequest readRequest = connection.readRequestBuilder().addItem(FIELD_NAME, fieldQuery).build();
PlcReadResponse readResponse = readRequest.execute().get();
- Object value = null;
- switch (clientDatatype) {
- case BOOLEAN:
- value = readResponse.getBoolean(FIELD_NAME);
- break;
- case BYTE:
- value = readResponse.getByte(FIELD_NAME);
- break;
- case SHORT:
- value = readResponse.getShort(FIELD_NAME);
- break;
- case INTEGER:
- value = readResponse.getInteger(FIELD_NAME);
- break;
- case LONG:
- value = readResponse.getLong(FIELD_NAME);
- break;
- case FLOAT:
- value = readResponse.getFloat(FIELD_NAME);
- break;
- case DOUBLE:
- value = readResponse.getDouble(FIELD_NAME);
- break;
- case STRING:
- value = readResponse.getString(FIELD_NAME);
- break;
- case TIME:
- value = readResponse.getTime(FIELD_NAME);
- break;
- case DATE:
- value = readResponse.getDate(FIELD_NAME);
- break;
- case DATE_TIME:
- value = readResponse.getDateTime(FIELD_NAME);
- break;
- }
+ Object value = readResponse.getObject(FIELD_NAME);
if (value != null) {
if (genericDatatype.isAssignableFrom(value.getClass())) {
return (T) value;