Search in sources :

Example 1 with ObisCodeValues

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.

the class ObisCodeValuesFactory method fromParameterMap.

public static ObisCodeValues fromParameterMap(final Map<String, String> parameters) {
    final ObisCodeValues obisCode = new ObisCodeValues();
    obisCode.setA(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_A)));
    obisCode.setB(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_B)));
    obisCode.setC(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_C)));
    obisCode.setD(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_D)));
    obisCode.setE(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_E)));
    obisCode.setF(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_F)));
    return obisCode;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

Example 2 with ObisCodeValues

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.

the class SetPushSetupAlarmRequestBuilder method convertObisCode.

private ObisCodeValues convertObisCode(final String obisCode) {
    final String[] obisCodeSplit = obisCode.split("\\.");
    final ObisCodeValues obisCodeValues = new ObisCodeValues();
    obisCodeValues.setA(Short.parseShort(obisCodeSplit[0]));
    obisCodeValues.setB(Short.parseShort(obisCodeSplit[1]));
    obisCodeValues.setC(Short.parseShort(obisCodeSplit[2]));
    obisCodeValues.setD(Short.parseShort(obisCodeSplit[3]));
    obisCodeValues.setE(Short.parseShort(obisCodeSplit[4]));
    obisCodeValues.setF(Short.parseShort(obisCodeSplit[5]));
    return obisCodeValues;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues) ReadSettingsHelper.getString(org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)

Example 3 with ObisCodeValues

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.

the class ObisCodeValuesFactory method fromParameterMap.

public static ObisCodeValues fromParameterMap(final Map<String, String> parameterMap) {
    final ObisCodeValues result = new ObisCodeValues();
    result.setA(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_A, (short) 0));
    result.setB(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_B, (short) 0));
    result.setC(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_C, (short) 0));
    result.setD(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_D, (short) 0));
    result.setE(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_E, (short) 0));
    result.setF(getShort(parameterMap, PlatformSmartmeteringKeys.OBIS_CODE_F, (short) 0));
    return result;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

Example 4 with ObisCodeValues

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.

the class GetSpecificAttributeValueRequestBuilder method fromParameterMap.

public GetSpecificAttributeValueRequestBuilder fromParameterMap(final Map<String, String> parameters) {
    this.classId = new BigInteger(parameters.get(PlatformSmartmeteringKeys.CLASS_ID));
    this.obisCode = new ObisCodeValues();
    this.obisCode.setA(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_A)));
    this.obisCode.setB(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_B)));
    this.obisCode.setC(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_C)));
    this.obisCode.setD(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_D)));
    this.obisCode.setE(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_E)));
    this.obisCode.setF(Short.parseShort(parameters.get(PlatformSmartmeteringKeys.OBIS_CODE_F)));
    this.attribute = new BigInteger(parameters.get(PlatformSmartmeteringKeys.ATTRIBUTE));
    return this;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues) BigInteger(java.math.BigInteger)

Example 5 with ObisCodeValues

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues in project open-smart-grid-platform by OSGP.

the class ObisCodeValuesTest method testObisCodeValues.

@Test
public void testObisCodeValues() {
    final AdhocMapper mapper = new AdhocMapper();
    final ObisCodeValues obisCodeValues = new ObisCodeValues();
    obisCodeValues.setA((short) 1);
    obisCodeValues.setB((short) 2);
    obisCodeValues.setC((short) 3);
    obisCodeValues.setD((short) 234);
    obisCodeValues.setE((short) 5);
    obisCodeValues.setF((short) 255);
    final org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ObisCodeValues obisCodeValues2 = mapper.map(obisCodeValues, org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ObisCodeValues.class);
    assertThat(obisCodeValues2.getA()).isEqualTo((byte) 1);
    assertThat(obisCodeValues2.getB()).isEqualTo((byte) 2);
    assertThat(obisCodeValues2.getC()).isEqualTo((byte) 3);
    assertThat(obisCodeValues2.getD()).isEqualTo((byte) -22);
    assertThat(obisCodeValues2.getE()).isEqualTo((byte) 5);
    assertThat(obisCodeValues2.getF()).isEqualTo((byte) -1);
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues) Test(org.junit.jupiter.api.Test)

Aggregations

ObisCodeValues (org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)15 Test (org.junit.jupiter.api.Test)2 PushObject (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.PushObject)2 BigInteger (java.math.BigInteger)1 GetSpecificAttributeValueRequest (org.opensmartgridplatform.adapter.ws.schema.smartmetering.adhoc.GetSpecificAttributeValueRequest)1 ReadSettingsHelper.getString (org.opensmartgridplatform.cucumber.core.ReadSettingsHelper.getString)1