Skip to content

Commit

Permalink
Feature/save stationary image to fiware (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
saschadoemer authored Aug 16, 2024
1 parent 81c23b7 commit ba3d167
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/de/app/fivegla/api/enums/EntityType.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum EntityType {
SENTEK_SENSOR("SentekSensor"),
WEENAT_SENSOR("WeenatSensor"),
AGVOLUTION_SENSOR("AgvolutionSensor"),
MICASENSE_IMAGE("MicaseSenseImage"),
IMAGE("Image"),
STATIONARY_IMAGE("StationaryImage"),
SENSOTERRA_SENSOR("SensoterraSensor"),
FARM21_SENSOR("Farm21Sensor"),
AGRANIMO_SENSOR("AgranimoSensor"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.app.fivegla.api.enums.EntityType;
import de.app.fivegla.integration.fiware.FiwareEntityIntegrationService;
import de.app.fivegla.integration.fiware.model.CameraImage;
import de.app.fivegla.integration.fiware.model.StationaryCameraImage;
import de.app.fivegla.integration.fiware.model.internal.TextAttribute;
import de.app.fivegla.persistence.entity.Group;
import de.app.fivegla.persistence.entity.Image;
Expand Down Expand Up @@ -35,7 +36,7 @@ public class ImageProcessingFiwareIntegrationServiceWrapper {
public void createCameraImage(Tenant tenant, Group group, String cameraId, Image image, String transactionId) {
var deviceMeasurement = new CameraImage(
tenant.getFiwarePrefix() + cameraId,
EntityType.MICASENSE_IMAGE.getKey(),
EntityType.IMAGE.getKey(),
new TextAttribute(group.getOid()),
new TextAttribute(image.getOid()),
new TextAttribute(cameraId),
Expand All @@ -55,6 +56,18 @@ public void createCameraImage(Tenant tenant, Group group, String cameraId, Image
* @param micaSenseImage the image to create the measurement for
*/
public void createStationaryCameraImage(Tenant tenant, Group group, String cameraId, StationaryImage micaSenseImage) {
// FIXME: Save stationary image in FIWARE
var deviceMeasurement = new StationaryCameraImage(
tenant.getFiwarePrefix() + cameraId,
EntityType.STATIONARY_IMAGE.getKey(),
new TextAttribute(group.getOid()),
new TextAttribute(micaSenseImage.getOid()),
new TextAttribute(cameraId),
new TextAttribute(micaSenseImage.getChannel().name()),
new TextAttribute(micaSenseImage.getBase64encodedImage()),
new TextAttribute(imagePathBaseUrl + micaSenseImage.getFullFilename(tenant)),
new TextAttribute(micaSenseImage.getMeasuredAt().toString()),
micaSenseImage.getLatitude(),
micaSenseImage.getLongitude());
fiwareEntityIntegrationService.persist(tenant, group, deviceMeasurement);
}
}

0 comments on commit ba3d167

Please sign in to comment.