Search in sources :

Example 6 with MethodParameter

use of org.openmuc.jdlms.MethodParameter in project open-smart-grid-platform by OSGP.

the class ClearMBusStatusOnAllChannelsCommandExecutor method resetAlarm.

private MethodResult resetAlarm(final DlmsConnectionManager conn, final int channel, final ObisCode obisCode) throws IOException {
    final MBusClientMethod method = MBusClientMethod.RESET_ALARM;
    final MethodParameter methodParameter = new MethodParameter(method.getInterfaceClass().id(), obisCode, method.getMethodId(), DataObject.newInteger8Data((byte) 0));
    conn.getDlmsMessageListener().setDescription("ClearMBusStatusOnAllChannels-resetAlarm for channel" + channel + " - calling client setup: " + JdlmsObjectToStringUtil.describeMethod(methodParameter));
    log.info("Calling method RESET_ALARM for channel {} with methodParam: {}.", channel, methodParameter);
    return conn.getConnection().action(methodParameter);
}
Also used : MethodParameter(org.openmuc.jdlms.MethodParameter) MBusClientMethod(org.opensmartgridplatform.dlms.interfaceclass.method.MBusClientMethod)

Example 7 with MethodParameter

use of org.openmuc.jdlms.MethodParameter in project open-smart-grid-platform by OSGP.

the class SetEncryptionKeyExchangeOnGMeterCommandExecutor method setEncryptionKey.

private MethodResult setEncryptionKey(final DlmsConnectionManager conn, final int channel, final byte[] encryptionKey) throws IOException {
    final MethodParameter methodSetEncryptionKey = this.getSetEncryptionKeyMethodParameter(OBIS_HASHMAP.get(channel), encryptionKey);
    conn.getDlmsMessageListener().setDescription("SetEncryptionKeyExchangeOnGMeter for channel " + channel + ", call M-Bus Setup set_encryption_key method: " + JdlmsObjectToStringUtil.describeMethod(methodSetEncryptionKey));
    return conn.getConnection().action(methodSetEncryptionKey);
}
Also used : MethodParameter(org.openmuc.jdlms.MethodParameter)

Example 8 with MethodParameter

use of org.openmuc.jdlms.MethodParameter in project open-smart-grid-platform by OSGP.

the class SetEncryptionKeyExchangeOnGMeterCommandExecutor method getSetEncryptionKeyMethodParameter.

private MethodParameter getSetEncryptionKeyMethodParameter(final ObisCode obisCode, final byte[] encryptionKey) {
    final DataObject methodParameter = DataObject.newOctetStringData(encryptionKey);
    final MBusClientMethod method = MBusClientMethod.SET_ENCRYPTION_KEY;
    return new MethodParameter(method.getInterfaceClass().id(), obisCode, method.getMethodId(), methodParameter);
}
Also used : DataObject(org.openmuc.jdlms.datatypes.DataObject) MethodParameter(org.openmuc.jdlms.MethodParameter) MBusClientMethod(org.opensmartgridplatform.dlms.interfaceclass.method.MBusClientMethod)

Aggregations

MethodParameter (org.openmuc.jdlms.MethodParameter)8 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ProtocolAdapterException)3 MBusClientMethod (org.opensmartgridplatform.dlms.interfaceclass.method.MBusClientMethod)3 IOException (java.io.IOException)2 DataObject (org.openmuc.jdlms.datatypes.DataObject)2 ConnectionException (org.opensmartgridplatform.adapter.protocol.dlms.exceptions.ConnectionException)2 MethodResult (org.openmuc.jdlms.MethodResult)1 MethodResultCode (org.openmuc.jdlms.MethodResultCode)1 DlmsDevice (org.opensmartgridplatform.adapter.protocol.dlms.domain.entities.DlmsDevice)1 EncrypterException (org.opensmartgridplatform.shared.exceptionhandling.EncrypterException)1