diff --git a/sdk/examples/space/edge-ai/src/main/java/esa/mo/nmf/apps/edgeai/MCAdapter.java b/sdk/examples/space/edge-ai/src/main/java/esa/mo/nmf/apps/edgeai/MCAdapter.java index 43b16b21a..bbc134f15 100644 --- a/sdk/examples/space/edge-ai/src/main/java/esa/mo/nmf/apps/edgeai/MCAdapter.java +++ b/sdk/examples/space/edge-ai/src/main/java/esa/mo/nmf/apps/edgeai/MCAdapter.java @@ -41,6 +41,10 @@ import esa.mo.nmf.NMFException; import esa.mo.nmf.NMFInterface; import esa.mo.nmf.NMFProvider; +import java.io.IOException; +import org.ccsds.moims.mo.mal.MALException; +import org.ccsds.moims.mo.mal.MALInteractionException; +import org.ccsds.moims.mo.platform.artificialintelligence.consumer.ArtificialIntelligenceStub; /** * The adapter for the NMF App @@ -77,7 +81,6 @@ public void initialRegistrations(MCRegistration registration) { @Override public UInteger actionArrived(Identifier name, AttributeValueList attributeValues, Long actionInstanceObjId, boolean reportProgress, MALInteraction interaction) { - if (ACTION_START_AI.equals(name.getValue())) { triggerAIInference(actionInstanceObjId, attributeValues); return null; // Success! @@ -141,6 +144,17 @@ private void triggerAIInference(Long actionInstanceObjId, AttributeValueList att processMap.put(actionInstanceObjId, exec); */ + + try { + String modelPath = ""; + String inputTilesPath = ""; + + ArtificialIntelligenceStub aiService = connector.getPlatformServices().getAIService(); + Long id = aiService.setModel(modelPath); + aiService.doInference(id, inputTilesPath); + } catch (MALInteractionException | MALException | IOException | NMFException ex) { + LOG.log(Level.SEVERE, "AI was not performed...", ex); + } } private void destroyProcess(AttributeValueList attributeValues) {