use of org.opensmartgridplatform.adapter.protocol.dlms.domain.commands.misc.GetActualPowerQualityCommandExecutor.PowerQualityObjectMetadata in project open-smart-grid-platform by OSGP.
the class GetActualPowerQualityCommandExecutorTest method generateMockedResult.
private List<GetResult> generateMockedResult(final List<GetActualPowerQualityCommandExecutor.PowerQualityObjectMetadata> metadatas, final AccessResultCode resultCode, final DataObject dateTimeDataObject) {
final List<GetResult> results = new ArrayList<>();
int idx = 1;
for (final PowerQualityObjectMetadata metadata : metadatas) {
if (metadata.getClassId() == CLASS_ID_CLOCK) {
results.add(new GetResultImpl(dateTimeDataObject, resultCode));
} else {
results.add(new GetResultImpl(DataObject.newInteger64Data(idx++), resultCode));
if (metadata.getClassId() == CLASS_ID_REGISTER) {
final List<DataObject> scalerUnit = new ArrayList<>();
scalerUnit.add(DataObject.newInteger64Data(1));
scalerUnit.add(DataObject.newInteger64Data(DlmsUnitTypeDto.VOLT.getIndex()));
results.add(new GetResultImpl(DataObject.newArrayData(scalerUnit), resultCode));
}
}
}
return results;
}
Aggregations