use of org.opensmartgridplatform.oslp.Oslp.GetStatusResponse.Builder in project open-smart-grid-platform by OSGP.
the class MockOslpServer method mockGetLightStatusResponse.
public void mockGetLightStatusResponse(final String deviceUid, final LinkType preferred, final LinkType actual, final LightType lightType, final int eventNotificationMask, final Oslp.Status status, final List<LightValue> lightValues) {
final Builder response = GetStatusResponse.newBuilder().setPreferredLinktype(preferred).setActualLinktype(actual).setLightType(lightType).setEventNotificationMask(eventNotificationMask).setStatus(status);
for (final LightValue lightValue : lightValues) {
response.addValue(lightValue);
}
LOGGER.info(MOCKING_MESSAGE_TYPE, deviceUid, MessageType.GET_LIGHT_STATUS);
this.devicesContext.getDeviceState(deviceUid).addMockedResponse(MessageType.GET_LIGHT_STATUS, Oslp.Message.newBuilder().setGetStatusResponse(response).build());
}
use of org.opensmartgridplatform.oslp.Oslp.GetStatusResponse.Builder in project open-smart-grid-platform by OSGP.
the class MockOslpServer method mockGetStatusResponse.
public void mockGetStatusResponse(final String deviceUid, final LinkType preferred, final LinkType actual, final LightType lightType, final int eventNotificationMask, final Oslp.Status status, final List<LightValue> lightValues, final List<LightValue> tariffValues) {
final Builder response = GetStatusResponse.newBuilder().setPreferredLinktype(preferred).setActualLinktype(actual).setLightType(lightType).setEventNotificationMask(eventNotificationMask).setStatus(status);
for (final LightValue lightValue : lightValues) {
response.addValue(lightValue);
}
for (final LightValue tariffValue : tariffValues) {
response.addValue(tariffValue);
}
LOGGER.info(MOCKING_MESSAGE_TYPE, deviceUid, MessageType.GET_STATUS);
this.devicesContext.getDeviceState(deviceUid).addMockedResponse(MessageType.GET_STATUS, Oslp.Message.newBuilder().setGetStatusResponse(response).build());
}
use of org.opensmartgridplatform.oslp.Oslp.GetStatusResponse.Builder in project open-smart-grid-platform by OSGP.
the class MetricsCounterTest method envelopeBuilder.
public OslpEnvelope.Builder envelopeBuilder(final PrivateKey privateKey) {
final Integer sequenceNumber = 1;
final byte[] sequenceNumberBytes = new byte[2];
sequenceNumberBytes[0] = (byte) (sequenceNumber >>> 8);
sequenceNumberBytes[1] = sequenceNumber.byteValue();
final Builder response = GetStatusResponse.newBuilder().setPreferredLinktype(LinkType.GPRS).setActualLinktype(LinkType.GPRS).setLightType(LightType.DALI).setEventNotificationMask(1).setStatus(Oslp.Status.OK);
return new OslpEnvelope.Builder().withSignature("SHA256withECDSA").withProvider("SunEC").withPrimaryKey(privateKey).withSecurityKey(null).withDeviceId(Base64.decodeBase64("TST-123456789012")).withSequenceNumber(sequenceNumberBytes).withPayloadMessage(Message.newBuilder().setGetStatusResponse(response).build());
}
Aggregations