Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ai-republic committed Jan 25, 2024
1 parent 228a46d commit d4fbdb7
Showing 1 changed file with 38 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Configuration read from the confg.properties for each {@link BMS}.
*/
public class BMSConfig {
private final int bmsNo;
private final String portLocator;
private final int pollInterval;
private final long delayAfterNoBytes;
private final BMSDescriptor bmsDescriptor;
private int bmsNo;
private String portLocator;
private int pollInterval;
private long delayAfterNoBytes;
private BMSDescriptor descriptor;

/**
* Constructor.
Expand All @@ -17,14 +17,33 @@ public class BMSConfig {
* @param portLocator the port locator
* @param pollInterval the polling interval in seconds
* @param delayAfterNoBytes the delay after no bytes were received in milliseconds
* @param descriptor the {@link BMSDescriptor} of the {@link BMS} to use
*/
public BMSConfig(final int bmsNo, final String portLocator, final int pollInterval, final long delayAfterNoBytes, final BMSDescriptor bmsDescriptor) {
public BMSConfig(final int bmsNo, final String portLocator, final int pollInterval, final long delayAfterNoBytes, final BMSDescriptor descriptor) {
super();
this.bmsNo = bmsNo;
this.portLocator = portLocator;
this.pollInterval = pollInterval;
this.delayAfterNoBytes = delayAfterNoBytes;
this.bmsDescriptor = bmsDescriptor;
this.descriptor = descriptor;
}


/**
* Updates this configuration.
*
* @param bmsNo the number of the BMS
* @param portLocator the port locator
* @param pollInterval the polling interval in seconds
* @param delayAfterNoBytes the delay after no bytes were received in milliseconds
* @param bmsDescriptor the {@link BMSDescriptor} of the {@link BMS} to use
*/
public void update(final int bmsNo, final String portLocator, final int pollInterval, final long delayAfterNoBytes, final BMSDescriptor bmsDescriptor) {
this.bmsNo = bmsNo;
this.portLocator = portLocator;
this.pollInterval = pollInterval;
this.delayAfterNoBytes = delayAfterNoBytes;
descriptor = bmsDescriptor;
}


Expand All @@ -38,6 +57,16 @@ public int getBmsNo() {
}


/**
* Sets the number of the BMS.
*
* @param bmsNo the bmsNo the number of the BMS
*/
public void setBmsNo(final int bmsNo) {
this.bmsNo = bmsNo;
}


/**
* Gets the port locator like /dev/ttyS0, can0, com3, etc.
*
Expand Down Expand Up @@ -73,7 +102,7 @@ public long getDelayAfterNoBytes() {
*
* @return the {@link BMSDescriptor} of the {@link BMS}
*/
public BMSDescriptor getBMSDescriptor() {
return bmsDescriptor;
public BMSDescriptor getDescriptor() {
return descriptor;
}
}

0 comments on commit d4fbdb7

Please sign in to comment.