Skip to content
Snippets Groups Projects
Commit 63de993d authored by gwen-soleil's avatar gwen-soleil
Browse files

fix bug for READ_WITH_WRITE attributes

parent e3f8d80f
No related branches found
No related tags found
No related merge requests found
......@@ -74,15 +74,14 @@ public class AttributeScalarEvent extends AAttributeEvent<boolean[]> {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
public Object getReadValue() {
Object read_value = null;
switch (getWritable()) {
case AttrWriteType._READ:
case AttrWriteType._WRITE:
case AttrWriteType._READ_WITH_WRITE:
read_value = getValue();
break;
case AttrWriteType._READ_WITH_WRITE:
case AttrWriteType._READ_WRITE:
if (getValue() != null) {
read_value = Array.get(getValue(), 0);
......
......@@ -229,6 +229,12 @@ public class HdbArchiver {
return tangoCollectorService.getKoAttributes().size();
}
@Attribute(name = "Paused")
@AttributeProperties(unit = "attrs")
public int getPausedNumber() {
return tangoCollectorService.getPausedAttributes().size();
}
@Command(name = "GetKoAttributes")
public String[] getKoAttributes() {
List<Map.Entry<String, String>> tmpList = new ArrayList<>(tangoCollectorService.getKoAttributes().entrySet());
......@@ -268,6 +274,11 @@ public class HdbArchiver {
return tangoCollectorService.getOkAttributes().toArray(new String[0]);
}
@Command(name = "GetPausedAttributes")
public String[] getPausedAttributes() {
return tangoCollectorService.getPausedAttributes().toArray(new String[0]);
}
@Attribute
@AttributeProperties(unit = "attrs")
public int getScalarCharge() {
......@@ -378,6 +389,20 @@ public class HdbArchiver {
}
}
@Command(name = "PauseContext", inTypeDesc = "the archiving context id")
@StateMachine(deniedStates = {DeviceState.FAULT, DeviceState.INIT})
public void pauseContext(final int contextId) throws ArchivingException {
logger.info("Pausing context for context {}", contextId);
tangoCollectorService.pauseContext(contextId);
}
@Command(name = "ResumeContext", inTypeDesc = "the archiving context id")
@StateMachine(deniedStates = {DeviceState.FAULT, DeviceState.INIT})
public void resumeContext(final int contextId) throws ArchivingException {
logger.info("Resuming context for context {}", contextId);
tangoCollectorService.resumeContext(contextId);
}
/**
* Execute command "RetryForAttribute" on device. Tries to start archiving
* for a given attribute, specified by its complete name.
......@@ -559,12 +584,14 @@ public class HdbArchiver {
tmpStatus += "Last starting of attributes time was "
+ tangoCollectorService.getStartingTime() + " ms\n";
tmpStatus += "Attributes' collect status: \n - " +
tangoCollectorService.getOkAttributes().size() + " OK\n - " + tangoCollectorService.getKoAttributes().size() + " KO\n";
tangoCollectorService.getOkAttributes().size() + " OK\n - "
+ tangoCollectorService.getKoAttributes().size() + " KO\n - "
+ tangoCollectorService.getPausedAttributes().size() + " paused\n";
tmpStatus += " - " + tangoCollectorService.getCollectorErrorNr() + " collect error(s)\n";
tmpStatus += " - " + tangoCollectorService.getInsertionsErrors().size() + " insertion error(s)\n";
if (!tangoCollectorService.getKoAttributes().isEmpty()) {
state = DeviceState.DISABLE;
} else if (/*tangoCollectorService.getCollectorErrorNr() > 0 ||*/ !tangoCollectorService.getInsertionsErrors().isEmpty()) {
} else if (!tangoCollectorService.getInsertionsErrors().isEmpty()) {
state = DeviceState.ALARM;
} else {
state = DeviceState.ON;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment