Search in sources :

Example 11 with ObisCodeValues

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

the class GetSpecificAttributeValueRequestBuilder method withDefaults.

public GetSpecificAttributeValueRequestBuilder withDefaults() {
    this.classId = DEFAULT_CLASS_ID;
    this.obisCode = new ObisCodeValues();
    this.obisCode.setA(DEFAULT_OBIS_CODE_A);
    this.obisCode.setB(DEFAULT_OBIS_CODE_B);
    this.obisCode.setC(DEFAULT_OBIS_CODE_C);
    this.obisCode.setD(DEFAULT_OBIS_CODE_D);
    this.obisCode.setE(DEFAULT_OBIS_CODE_E);
    this.obisCode.setF(DEFAULT_OBIS_CODE_F);
    this.attribute = DEFAULT_ATTRIBUTE;
    return this;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

Example 12 with ObisCodeValues

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

the class ObisCodeConverter method convertTo.

@Override
public ObisCodeValues convertTo(final CosemObisCode source, final Type<ObisCodeValues> destinationType, final MappingContext context) {
    if (source == null) {
        return null;
    }
    final ObisCodeValues convertedObisCode = new ObisCodeValues();
    convertedObisCode.setA((short) source.getA());
    convertedObisCode.setB((short) source.getB());
    convertedObisCode.setC((short) source.getC());
    convertedObisCode.setD((short) source.getD());
    convertedObisCode.setE((short) source.getE());
    convertedObisCode.setF((short) source.getF());
    return convertedObisCode;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

Example 13 with ObisCodeValues

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

the class ObisCodeValuesTest method testObisCodeValues2.

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

Example 14 with ObisCodeValues

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

the class CaptureObjectsFactory method logicalNameFromParemeterMap.

private static ObisCodeValues logicalNameFromParemeterMap(final Map<String, String> requestParameters, final int i) {
    final String logicalName = SettingsHelper.getStringValue(requestParameters, PlatformSmartmeteringKeys.CAPTURE_OBJECT_LOGICAL_NAME, i);
    final String[] obisBytes = logicalName.split("\\.");
    final ObisCodeValues obisCodeValues = new ObisCodeValues();
    obisCodeValues.setA(Short.parseShort(obisBytes[0]));
    obisCodeValues.setB(Short.parseShort(obisBytes[1]));
    obisCodeValues.setC(Short.parseShort(obisBytes[2]));
    obisCodeValues.setD(Short.parseShort(obisBytes[3]));
    obisCodeValues.setE(Short.parseShort(obisBytes[4]));
    obisCodeValues.setF(Short.parseShort(obisBytes[5]));
    return obisCodeValues;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

Example 15 with ObisCodeValues

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

the class CaptureObjectDefinitionsFactory method logicalNameFromParemeterMap.

private static ObisCodeValues logicalNameFromParemeterMap(final Map<String, String> requestParameters, final int i) {
    final String logicalName = SettingsHelper.getStringValue(requestParameters, LOGICAL_NAME, i);
    final String[] obisBytes = logicalName.split("\\.");
    final ObisCodeValues obisCodeValues = new ObisCodeValues();
    obisCodeValues.setA(Short.parseShort(obisBytes[0]));
    obisCodeValues.setB(Short.parseShort(obisBytes[1]));
    obisCodeValues.setC(Short.parseShort(obisBytes[2]));
    obisCodeValues.setD(Short.parseShort(obisBytes[3]));
    obisCodeValues.setE(Short.parseShort(obisBytes[4]));
    obisCodeValues.setF(Short.parseShort(obisBytes[5]));
    return obisCodeValues;
}
Also used : ObisCodeValues(org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.ObisCodeValues)

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