use of io.swagger.server.api.verticle.WrappedDeviceTwinDevice in project azure-iot-sdk-java by Azure.
the class RegistryGlue method getModuleTwin.
public void getModuleTwin(String connectionId, String deviceId, String moduleId, Handler<AsyncResult<Object>> handler) {
System.out.printf("getModuleTwin called for %s with deviceId = %s and moduleId = %s%n", connectionId, deviceId, moduleId);
DeviceTwin client = getClient(connectionId);
if (client == null) {
handler.handle(Future.failedFuture(new MainApiException(500, "invalid connection id")));
} else {
WrappedDeviceTwinDevice twin = new WrappedDeviceTwinDevice(deviceId, moduleId);
try {
client.getTwin(twin);
} catch (IOException | IotHubException e) {
handler.handle(Future.failedFuture(e));
}
handler.handle(Future.succeededFuture(twin.toJsonObject()));
}
}
Aggregations