|
|
@@ -1,13 +1,11 @@
|
|
|
package io.connector.module.ogc.sensorthings.gateway;
|
|
|
|
|
|
import io.connector.core.AbstractGateway;
|
|
|
-import io.connector.model.afarcloud.Observation;
|
|
|
-import io.connector.model.afarcloud.ResourceMeasurement;
|
|
|
-import io.connector.model.afarcloud.ResponseModel;
|
|
|
-import io.connector.model.afarcloud.SensorTelemetry;
|
|
|
+import io.connector.model.afarcloud.*;
|
|
|
import io.connector.module.ogc.sensorthings.SensorThingsClient;
|
|
|
import io.vertx.core.MultiMap;
|
|
|
import io.vertx.core.http.HttpServerRequest;
|
|
|
+import io.vertx.core.json.JsonObject;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
@@ -51,9 +49,9 @@ public class AFarCloudGateway extends AbstractGateway {
|
|
|
return params.contains(paramName) ? params.get(paramName) : defValue;
|
|
|
}
|
|
|
|
|
|
- private static List<String> getSplittedParam(MultiMap params, String paramName, String splitter) {
|
|
|
+ private static List<String> getSplittedParam(MultiMap params, String paramName) {
|
|
|
String param = getParam(params, paramName);
|
|
|
- return param != null ? asList(param.split(splitter)) : emptyList();
|
|
|
+ return param != null ? asList(param.split(",")) : emptyList();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -66,12 +64,12 @@ public class AFarCloudGateway extends AbstractGateway {
|
|
|
MultiMap params = req.params();
|
|
|
|
|
|
final int limit = parseInt(getRequiredParam(params, "limit"));
|
|
|
- final List<String> entityNames = getSplittedParam(params, "entityNames", ",");
|
|
|
- final List<String> devices = getSplittedParam(params, "devices", ",");
|
|
|
- final List<String> services = getSplittedParam(params, "services", ",");
|
|
|
- final List<String> types = getSplittedParam(params, "types", ",");
|
|
|
- final List<String> providers = getSplittedParam(params, "providers", ",");
|
|
|
- final List<String> measurements = getSplittedParam(params, "measurements", ",");
|
|
|
+ final List<String> entityNames = getSplittedParam(params, "entityNames");
|
|
|
+ final List<String> devices = getSplittedParam(params, "devices");
|
|
|
+ final List<String> services = getSplittedParam(params, "services");
|
|
|
+ final List<String> types = getSplittedParam(params, "types");
|
|
|
+ final List<String> providers = getSplittedParam(params, "providers");
|
|
|
+ final List<String> measurements = getSplittedParam(params, "measurements");
|
|
|
final Integer minAltitude = params.contains("altitude") ? parseInt(params.get("altitude")) : null; // TODO
|
|
|
final String order = getParam(params, "order", "DESC").toUpperCase();
|
|
|
|
|
|
@@ -123,12 +121,12 @@ public class AFarCloudGateway extends AbstractGateway {
|
|
|
MultiMap params = req.params();
|
|
|
|
|
|
final int limit = parseInt(getRequiredParam(params, "limit"));
|
|
|
- final List<String> entityNames = getSplittedParam(params, "entityNames", ",");
|
|
|
- final List<String> devices = getSplittedParam(params, "devices", ",");
|
|
|
- final List<String> services = getSplittedParam(params, "services", ",");
|
|
|
- final List<String> types = getSplittedParam(params, "types", ",");
|
|
|
- final List<String> providers = getSplittedParam(params, "providers", ",");
|
|
|
- final List<String> measurements = getSplittedParam(params, "measurements", ",");
|
|
|
+ final List<String> entityNames = getSplittedParam(params, "entityNames");
|
|
|
+ final List<String> devices = getSplittedParam(params, "devices");
|
|
|
+ final List<String> services = getSplittedParam(params, "services");
|
|
|
+ final List<String> types = getSplittedParam(params, "types");
|
|
|
+ final List<String> providers = getSplittedParam(params, "providers");
|
|
|
+ final List<String> measurements = getSplittedParam(params, "measurements");
|
|
|
final String order = getParam(params, "order", "DESC").toUpperCase();
|
|
|
final Integer minAltitude = params.contains("altitude") ? parseInt(params.get("altitude")) : null; // TODO
|
|
|
final Double centrLong = params.contains("centr_long") ? parseDouble(params.get("centr_long")) : null; // TODO
|
|
|
@@ -195,7 +193,8 @@ public class AFarCloudGateway extends AbstractGateway {
|
|
|
final String startTime = getRequiredParam(params, "start_time");
|
|
|
final String endTime = getParam(params, "end_time");
|
|
|
|
|
|
- ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(encode(null));
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
router().get(create("getObservationsBySensor/historic")).handler(ctx -> {
|
|
|
@@ -207,40 +206,83 @@ public class AFarCloudGateway extends AbstractGateway {
|
|
|
final String startTime = getRequiredParam(params, "start_time");
|
|
|
final String endTime = getParam(params, "end_time");
|
|
|
|
|
|
- ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(encode(null));
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
// Query region telemetry
|
|
|
router().get(create("getRegionTelemetry/latest")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
// Query region telemetry interval
|
|
|
router().get(create("getRegionTelemetry/historic")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
// Query collar telemetry
|
|
|
router().get(create("getCollarTelemetry/latest")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
router().get(create("getObservationsByCollar/latest")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
router().get(create("getObservationsByCollar/historic")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
// Query collar telemetry interval
|
|
|
router().get(create("getCollarTelemetry/historic")).handler(ctx -> {
|
|
|
-
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
|
|
|
// Schema-measurement
|
|
|
router().get(create("getMeasurements")).handler(ctx -> {
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
+ });
|
|
|
+
|
|
|
+ // Registry
|
|
|
+ router().get(create("registry/getSensor/:id")).handler(ctx -> {
|
|
|
+ // domain is different
|
|
|
+
|
|
|
+ String resourceId = ctx.pathParam("id");
|
|
|
+
|
|
|
+ Unit unit = new Unit();
|
|
|
+ unit.setResourceId(resourceId);
|
|
|
+ unit.setResourceType("AFC 8CF95740000008AE");
|
|
|
+ unit.setResourceUrn("urn:afc:AS07:enviro:IMA:air_quality:10002222");
|
|
|
+ unit.setLatitude(50.0382589);
|
|
|
+ unit.setLongitude(14.6112164);
|
|
|
+ unit.setAltitude(280.0);
|
|
|
+ unit.setPreprocessing(false);
|
|
|
+ unit.setPythonScript("");
|
|
|
+
|
|
|
+ Unit.SensorSchema sensorSchema = new Unit.SensorSchema();
|
|
|
+ sensorSchema.setObservedProperty("air_temperature");
|
|
|
+ sensorSchema.setUom("http://qudt.org/vocab/unit/DEG_C");
|
|
|
+ sensorSchema.setAccuracy(0.1);
|
|
|
+ sensorSchema.setPropertyId(456);
|
|
|
+ sensorSchema.setMin_value(-40.0);
|
|
|
+ sensorSchema.setMax_value(60.0);
|
|
|
+ unit.setObservations(singletonList(sensorSchema));
|
|
|
+
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(encode(unit));
|
|
|
+ });
|
|
|
+
|
|
|
+ router().get(create("registry/getCollar/:id")).handler(ctx -> {
|
|
|
+ // domain is different
|
|
|
|
|
|
+ ctx.response().putHeader(CONTENT_TYPE, APPLICATION_JSON).end(
|
|
|
+ new JsonObject().put("message", "not implemented yet").encode());
|
|
|
});
|
|
|
}
|
|
|
}
|