use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class GetConfigurationObjectServiceSmr5 method getConfigurationObject.
@Override
ConfigurationObjectDto getConfigurationObject(final GetResult result) throws ProtocolAdapterException {
final DataObject resultData = result.getResultData();
if (resultData == null || !resultData.isBitString()) {
LOGGER.warn("Configuration object result data is not a BitString: {}", resultData);
throw new ProtocolAdapterException("Expected bit-string data as Configuration object result data, but got: " + (resultData == null ? "null" : resultData.getType()));
}
LOGGER.info("SMR5 Configuration object current BitString: {}", this.dlmsHelper.getDebugInfo(resultData));
final BitString bitString = resultData.getValue();
final byte[] flagByteArray = bitString.getBitString();
final List<ConfigurationFlagDto> configurationFlagDtos = this.toConfigurationFlags(flagByteArray);
final ConfigurationFlagsDto configurationFlagsDto = new ConfigurationFlagsDto(configurationFlagDtos);
return new ConfigurationObjectDto(configurationFlagsDto);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class SetConfigurationObjectServiceDsmr4 method addFlags.
private void addFlags(final ConfigurationObjectDto configurationToSet, final ConfigurationObjectDto configurationOnDevice, final List<DataObject> dataObjects) throws ProtocolAdapterException {
final BitString flags = this.getFlags(configurationToSet, configurationOnDevice);
final DataObject bitString = DataObject.newBitStringData(flags);
dataObjects.add(bitString);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class SetActivityCalendarCommandExecutor method getSeasonProfileExecutor.
private DataObjectAttrExecutor getSeasonProfileExecutor(final List<SeasonProfileDto> seasonProfileList) {
final AttributeAddress seasonProfilePassive = new AttributeAddress(CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_SEASON_PROFILE_PASSIVE);
final DataObject seasonsArray = DataObject.newArrayData(this.configurationMapper.mapAsList(seasonProfileList, DataObject.class));
LOGGER.info("SeasonProfilePassive to set is: {}", this.dlmsHelper.getDebugInfo(seasonsArray));
return new DataObjectAttrExecutor("SEASONS", seasonProfilePassive, seasonsArray, CLASS_ID, OBIS_CODE, ATTRIBUTE_ID_SEASON_PROFILE_PASSIVE);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class SetAlarmNotificationsCommandExecutor method writeUpdatedAlarmNotifications.
private AccessResultCode writeUpdatedAlarmNotifications(final DlmsConnectionManager conn, final long alarmFilterLongValue, final AttributeAddress alarmFilterValue) throws IOException {
final DataObject value = DataObject.newUInteger32Data(alarmFilterLongValue);
final SetParameter setParameter = new SetParameter(alarmFilterValue, value);
conn.getDlmsMessageListener().setDescription("SetAlarmNotifications write updated value " + alarmFilterLongValue + ", set attribute: " + JdlmsObjectToStringUtil.describeAttributes(alarmFilterValue));
return conn.getConnection().set(setParameter);
}
use of org.openmuc.jdlms.datatypes.DataObject in project open-smart-grid-platform by OSGP.
the class GetConfigurationObjectServiceDsmr4 method getConfigurationObject.
@Override
ConfigurationObjectDto getConfigurationObject(final GetResult result) throws ProtocolAdapterException {
final DataObject resultData = result.getResultData();
if (resultData == null || !resultData.isComplex()) {
final String message = String.format("Expected ConfigurationObject ResultData as Complex, but got: %s", resultData);
LOGGER.warn(message);
throw new ProtocolAdapterException(message);
}
return this.getConfigurationObject(resultData);
}
Aggregations