-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
3,591 additions
and
2,587 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
io.openems.edge.common/src/io/openems/edge/common/modbusslave/ModbusRecordUint32.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.openems.edge.common.modbusslave; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
import io.openems.common.types.OpenemsType; | ||
import io.openems.edge.common.type.TypeUtils; | ||
|
||
public class ModbusRecordUint32 extends ModbusRecordConstant { | ||
|
||
public final static byte[] UNDEFINED_VALUE = new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }; | ||
|
||
public final static int BYTE_LENGTH = 4; | ||
|
||
protected final Integer value; | ||
|
||
public ModbusRecordUint32(int offset, String name, Integer value) { | ||
super(offset, name, ModbusType.UINT32, toByteArray(value)); | ||
this.value = value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ModbusRecordUInt32 [value=" + value + "/0x" + Integer.toHexString(value) + ", type=" + getType() + "]"; | ||
} | ||
|
||
public static byte[] toByteArray(int value) { | ||
return ByteBuffer.allocate(BYTE_LENGTH).putInt(value).array(); | ||
} | ||
|
||
public static byte[] toByteArray(Object value) { | ||
if (value == null || (value instanceof io.openems.common.types.OptionsEnum | ||
&& ((io.openems.common.types.OptionsEnum) value).isUndefined())) { | ||
return UNDEFINED_VALUE; | ||
} else { | ||
return toByteArray((int) TypeUtils.getAsType(OpenemsType.INTEGER, value)); | ||
} | ||
} | ||
|
||
@Override | ||
public String getValueDescription() { | ||
return this.value != null ? Integer.toString(this.value) : ""; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...penems.edge.common/src/io/openems/edge/common/modbusslave/ModbusRecordUint32Reserved.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.openems.edge.common.modbusslave; | ||
|
||
public class ModbusRecordUint32Reserved extends ModbusRecordUint32 { | ||
|
||
public ModbusRecordUint32Reserved(int offset) { | ||
super(offset, "Reserved", null); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ModbusRecordUint32Reserved [type=" + getType() + "]"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.