LayerManagerControl: fixed handling error in ILM calls
authorTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 28 Feb 2013 13:26:38 +0000 (05:26 -0800)
committerTimo Lotterbach <timo.lotterbach@bmw-carit.de>
Thu, 28 Feb 2013 13:37:02 +0000 (05:37 -0800)
LayerManagerControl used to ignore a lot of return values from ilmClient
library. This is fixed now.

Signed-off-by: Timo Lotterbach <timo.lotterbach@bmw-carit.de>
LayerManagerControl/src/commands.cpp
LayerManagerControl/src/common.cpp
LayerManagerControl/src/control.cpp
LayerManagerControl/src/demo.cpp
LayerManagerControl/src/print.cpp
LayerManagerControl/src/scatter.cpp
LayerManagerControl/src/sceneio.cpp

index c792fc7..c57802e 100644 (file)
@@ -79,7 +79,15 @@ COMMAND("get scene|screens|layers|surfaces")
         (void)input;
         unsigned int count = 0;
         unsigned int* array = NULL;
-        ilm_getScreenIDs(&count, &array);
+
+        ilmErrorTypes callResult = ilm_getScreenIDs(&count, &array);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get screen IDs\n";
+            return;
+        }
+
         printArray("Screen", array, count);
     }
     else if (input->contains("layers"))
@@ -87,7 +95,15 @@ COMMAND("get scene|screens|layers|surfaces")
         (void)input;
         int count = 0;
         unsigned int* array = NULL;
-        ilm_getLayerIDs(&count, &array);
+
+        ilmErrorTypes callResult = ilm_getLayerIDs(&count, &array);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get layer IDs\n";
+            return;
+        }
+
         printArray("Layer", array, count);
     }
     else if (input->contains("surfaces"))
@@ -95,7 +111,15 @@ COMMAND("get scene|screens|layers|surfaces")
         (void)input;
         int count = 0;
         unsigned int* array = NULL;
-        ilm_getSurfaceIDs(&count, &array);
+
+        ilmErrorTypes callResult = ilm_getSurfaceIDs(&count, &array);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get surface IDs\n";
+            return;
+        }
+
         printArray("Surface", array, count);
     }
 }
@@ -124,18 +148,36 @@ COMMAND("dump screen|layer|surface <id> to <file>")
 {
     if (input->contains("screen"))
     {
-        ilm_takeScreenshot(input->getUint("id"),
-                           input->getString("file").c_str());
+        ilmErrorTypes callResult = ilm_takeScreenshot(input->getUint("id"),
+                                                        input->getString("file").c_str());
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to take screenshot of screen with ID " << input->getUint("id") << "\n";
+            return;
+        }
     }
     else if (input->contains("layer"))
     {
-        ilm_takeLayerScreenshot(input->getString("file").c_str(),
-                                input->getUint("id"));
+        ilmErrorTypes callResult = ilm_takeLayerScreenshot(input->getString("file").c_str(),
+                                                            input->getUint("id"));
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to take screenshot of layer with ID " << input->getUint("id") << "\n";
+            return;
+        }
     }
     else if (input->contains("surface"))
     {
-        ilm_takeSurfaceScreenshot(input->getString("file").c_str(),
-                                  input->getUint("id"));
+        ilmErrorTypes callResult = ilm_takeSurfaceScreenshot(input->getString("file").c_str(),
+                                                                input->getUint("id"));
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to take screenshot of surface with ID " << input->getUint("id") << "\n";
+            return;
+        }
     }
 }
 
@@ -143,23 +185,35 @@ COMMAND("dump screen|layer|surface <id> to <file>")
 COMMAND("set layer|surface <id> source region <x> <y> <w> <h>")
 //=============================================================================
 {
+    t_ilm_uint id = input->getUint("id");
+    t_ilm_uint x = input->getUint("x");
+    t_ilm_uint y = input->getUint("y");
+    t_ilm_uint w = input->getUint("w");
+    t_ilm_uint h = input->getUint("h");
+
     if (input->contains("layer"))
     {
-        ilm_layerSetSourceRectangle(input->getUint("id"),
-                                    input->getUint("x"),
-                                    input->getUint("y"),
-                                    input->getUint("w"),
-                                    input->getUint("h"));
+        ilmErrorTypes callResult = ilm_layerSetSourceRectangle(id, x, y, w, h);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set source rectangle (" << x << "," << y << ", "<< w << ", " << h <<") for layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        ilm_surfaceSetSourceRectangle(input->getUint("id"),
-                                      input->getUint("x"),
-                                      input->getUint("y"),
-                                      input->getUint("w"),
-                                      input->getUint("h"));
-            ilm_commitChanges();
+        ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(id, x, y, w, h);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set source rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for surface with ID " << id << "\n";
+            return;
+        }
+
+        ilm_commitChanges();
     }
 }
 
@@ -167,22 +221,34 @@ COMMAND("set layer|surface <id> source region <x> <y> <w> <h>")
 COMMAND("set layer|surface <id> destination region <x> <y> <w> <h>")
 //=============================================================================
 {
+    t_ilm_uint id = input->getUint("id");
+    t_ilm_uint x = input->getUint("x");
+    t_ilm_uint y = input->getUint("y");
+    t_ilm_uint w = input->getUint("w");
+    t_ilm_uint h = input->getUint("h");
+
     if (input->contains("layer"))
     {
-        ilm_layerSetDestinationRectangle(input->getUint("id"),
-                                        input->getUint("x"),
-                                        input->getUint("y"),
-                                        input->getUint("w"),
-                                        input->getUint("h"));
+        ilmErrorTypes callResult = ilm_layerSetDestinationRectangle(id, x, y, w, h);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set destination rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        ilm_surfaceSetDestinationRectangle(input->getUint("id"),
-                                           input->getUint("x"),
-                                           input->getUint("y"),
-                                           input->getUint("w"),
-                                           input->getUint("h"));
+        ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(id, x, y, w, h);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set destination rectangle (" << x << ", " << y << ", "<< w << ", " << h <<") for surface with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -191,17 +257,32 @@ COMMAND("set layer|surface <id> destination region <x> <y> <w> <h>")
 COMMAND("set layer|surface <id> opacity <opacity>")
 //=============================================================================
 {
+    t_ilm_uint id = input->getUint("id");
+    double opacity = input->getDouble("opacity");
+
     if (input->contains("layer"))
     {
-        ilm_layerSetOpacity(input->getUint("id"),
-                input->getDouble("opacity"));
+        ilmErrorTypes callResult = ilm_layerSetOpacity(id, opacity);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set opacity "<< opacity << " for layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        ilm_surfaceSetOpacity(input->getUint("id"),
-                                  input->getDouble("opacity"));
-            ilm_commitChanges();
+        ilmErrorTypes callResult = ilm_surfaceSetOpacity(id, opacity);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set opacity "<< opacity << " for surface with ID " << id << "\n";
+            return;
+        }
+
+        ilm_commitChanges();
     }
 }
 
@@ -209,16 +290,31 @@ COMMAND("set layer|surface <id> opacity <opacity>")
 COMMAND("set layer|surface <id> visibility <visibility>")
 //=============================================================================
 {
+    t_ilm_uint id = input->getUint("id");
+    t_ilm_bool visibility = input->getBool("visibility");
+
     if (input->contains("layer"))
     {
-        ilm_layerSetVisibility(input->getUint("id"),
-                               input->getBool("visibility"));
+        ilmErrorTypes callResult = ilm_layerSetVisibility(id, visibility);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set visibility "<< visibility << " for layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        ilm_surfaceSetVisibility(input->getUint("id"),
-                                 input->getBool("visibility"));
+        ilmErrorTypes callResult = ilm_surfaceSetVisibility(id, visibility);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set visibility "<< visibility << " for surface with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -227,16 +323,31 @@ COMMAND("set layer|surface <id> visibility <visibility>")
 COMMAND("set layer|surface <id> orientation <orientation>")
 //=============================================================================
 {
+    t_ilm_uint id = input->getUint("id");
+    ilmOrientation orientation = (ilmOrientation)input->getInt("orientation");
+
     if (input->contains("layer"))
     {
-        ilm_layerSetOrientation(input->getUint("id"),
-                    (ilmOrientation)input->getInt("orientation"));
+        ilmErrorTypes callResult = ilm_layerSetOrientation(id, orientation);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set orientation "<< orientation << " for layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        ilm_surfaceSetOrientation(input->getUint("id"),
-                      (ilmOrientation)input->getInt("orientation"));
+        ilmErrorTypes callResult = ilm_surfaceSetOrientation(id, orientation);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set orientation "<< orientation << " for surface with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 
@@ -254,13 +365,29 @@ COMMAND("set screen|layer <id> render order [<idarray>]")
             unsigned int* array = NULL;
             unsigned int screenid = input->getUint("id");
             input->getUintArray("idarray", &array, &count);
-            ilm_displaySetRenderOrder(screenid, array, count);
+
+            ilmErrorTypes callResult = ilm_displaySetRenderOrder(screenid, array, count);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set render order for screen with ID " << screenid << "\n";
+                return;
+            }
+
             ilm_commitChanges();
         }
         else
         {
             unsigned int screenid = input->getUint("id");
-            ilm_displaySetRenderOrder(screenid, NULL, 0);
+
+            ilmErrorTypes callResult = ilm_displaySetRenderOrder(screenid, NULL, 0);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set render order for screen with ID " << screenid << "\n";
+                return;
+            }
+
             ilm_commitChanges();
         }
     }
@@ -272,13 +399,29 @@ COMMAND("set screen|layer <id> render order [<idarray>]")
             unsigned int* array = NULL;
             unsigned int layerid = input->getUint("id");
             input->getUintArray("idarray", &array, &count);
-            ilm_layerSetRenderOrder(layerid, array, count);
+
+            ilmErrorTypes callResult = ilm_layerSetRenderOrder(layerid, array, count);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set render order for layer with ID " << layerid << "\n";
+                return;
+            }
+
             ilm_commitChanges();
         }
         else
         {
             unsigned int layerid = input->getUint("id");
-            ilm_layerSetRenderOrder(layerid, NULL, 0);
+
+            ilmErrorTypes callResult = ilm_layerSetRenderOrder(layerid, NULL, 0);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set render order for layer with ID " << layerid << "\n";
+                return;
+            }
+
             ilm_commitChanges();
         }
     }
@@ -292,18 +435,50 @@ COMMAND("set layer|surface <id> width <width>")
     {
         unsigned int dimension[2];
         unsigned int layerid = input->getUint("id");
-        ilm_layerGetDimension(layerid, dimension);
+
+        ilmErrorTypes callResult = ilm_layerGetDimension(layerid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get dimensions of layer with ID " << layerid << "\n";
+            return;
+        }
+
         dimension[0] = input->getUint("width");
-        ilm_layerSetDimension(layerid, dimension);
+
+        callResult = ilm_layerSetDimension(layerid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set dimensions of layer with ID " << layerid << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
         unsigned int dimension[2];
         unsigned int surfaceid = input->getUint("id");
-        ilm_surfaceGetDimension(surfaceid, dimension);
+
+        ilmErrorTypes callResult = ilm_surfaceGetDimension(surfaceid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get dimensions of surface with ID " << surfaceid << "\n";
+            return;
+        }
+
         dimension[0] = input->getUint("width");
-        ilm_surfaceSetDimension(surfaceid, dimension);
+
+        callResult = ilm_surfaceSetDimension(surfaceid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set dimensions of surface with ID " << surfaceid << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -316,18 +491,50 @@ COMMAND("set layer|surface <id> height <height>")
     {
         unsigned int dimension[2];
         unsigned int layerid = input->getUint("id");
-        ilm_layerGetDimension(layerid, dimension);
+
+        ilmErrorTypes callResult = ilm_layerGetDimension(layerid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get dimensions of layer with ID " << layerid << "\n";
+            return;
+        }
+
         dimension[1] = input->getUint("height");
-        ilm_layerSetDimension(layerid, dimension);
+
+        callResult = ilm_layerSetDimension(layerid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set dimensions of layer with ID " << layerid << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
         unsigned int dimension[2];
         unsigned int surfaceid = input->getUint("id");
-        ilm_surfaceGetDimension(surfaceid, dimension);
+
+        ilmErrorTypes callResult = ilm_surfaceGetDimension(surfaceid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get dimensions of surface with ID " << surfaceid << "\n";
+            return;
+        }
+
         dimension[1] = input->getUint("height");
-        ilm_surfaceSetDimension(surfaceid, dimension);
+
+        callResult = ilm_surfaceSetDimension(surfaceid, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set dimensions of surface with ID " << surfaceid << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -336,22 +543,33 @@ COMMAND("set layer|surface <id> height <height>")
 COMMAND("set layer|surface <id> position <x> <y>")
 //=============================================================================
 {
+    unsigned int id = input->getUint("id");
+    unsigned int dimension[2];
+    dimension[0] = input->getUint("x");
+    dimension[1] = input->getUint("y");
+
     if (input->contains("layer"))
     {
-        unsigned int dimension[2];
-        unsigned int layerid = input->getUint("id");
-        dimension[0] = input->getUint("x");
-        dimension[1] = input->getUint("y");
-        ilm_layerSetPosition(layerid, dimension);
+        ilmErrorTypes callResult = ilm_layerSetPosition(id, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set position of layer with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        unsigned int dimension[2];
-        unsigned int surfaceid = input->getUint("id");
-        dimension[0] = input->getUint("x");
-        dimension[1] = input->getUint("y");
-        ilm_surfaceSetPosition(surfaceid, dimension);
+        ilmErrorTypes callResult = ilm_surfaceSetPosition(id, dimension);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set position of surface with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -365,12 +583,26 @@ COMMAND("create layer <layerid> [<width> <height>]")
         unsigned int layerid = input->getUint("layerid");
         unsigned int width = input->getUint("width");
         unsigned int height = input->getUint("height");
-        ilm_layerCreateWithDimension(&layerid, width, height);
+
+        ilmErrorTypes callResult = ilm_layerCreateWithDimension(&layerid, width, height);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to create layer with ID " << layerid << "\n";
+            return;
+        }
     }
     else
     {
         unsigned int layerid = input->getUint("layerid");
-        ilm_layerCreate(&layerid);
+
+        ilmErrorTypes callResult = ilm_layerCreate(&layerid);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to create layer with ID " << layerid << "\n";
+            return;
+        }
     }
 }
 
@@ -383,7 +615,14 @@ COMMAND("create surface <surfaceid> <nativehandle> <width> <height> <pixelformat
     unsigned int width = input->getUint("width");
     unsigned int height = input->getUint("height");
     e_ilmPixelFormat pixelformat = (e_ilmPixelFormat)input->getUint("pixelformat");
-    ilm_surfaceCreate(nativeHandle, width, height, pixelformat, &surfaceid);
+
+    ilmErrorTypes callResult = ilm_surfaceCreate(nativeHandle, width, height, pixelformat, &surfaceid);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to create surface with ID " << surfaceid << "\n";
+        return;
+    }
 }
 
 //=============================================================================
@@ -393,13 +632,29 @@ COMMAND("destroy layer|surface <id>")
     if (input->contains("layer"))
     {
         unsigned int layerid = input->getUint("id");
-        ilm_layerRemove(layerid);
+
+        ilmErrorTypes callResult = ilm_layerRemove(layerid);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove layer with ID " << layerid << "\n";
+            return;
+        }
     }
     else if (input->contains("surface"))
     {
         unsigned int surfaceid = input->getUint("id");
-        ilm_surfaceRemove(surfaceid);
+
+        ilmErrorTypes callResult = ilm_surfaceRemove(surfaceid);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove surface with ID " << surfaceid << "\n";
+            return;
+        }
     }
+
+    ilm_commitChanges();
 }
 
 //=============================================================================
@@ -442,29 +697,36 @@ COMMAND("set surface <surfaceid> accept <acceptance> input events from devices <
 COMMAND("set layer|surface <id> chromakey <red> <green> <blue>")
 //=============================================================================
 {
+    t_ilm_layer id = input->getUint("id");
+    t_ilm_int color[3] =
+    {
+        input->getInt("red"),
+        input->getInt("green"),
+        input->getInt("blue")
+    };
+
     if (input->contains("layer"))
     {
-        t_ilm_layer layer = input->getUint("id");
-        t_ilm_int color[3] =
+        ilmErrorTypes callResult = ilm_layerSetChromaKey(id, color);
+        if (ILM_SUCCESS != callResult)
         {
-            input->getInt("red"),
-            input->getInt("green"),
-            input->getInt("blue")
-        };
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set chroma key (" << color[0] << ", " << color[1] << ", " << color[2] << ") for layer with ID " << id << "\n";
+            return;
+        }
 
-        ilm_layerSetChromaKey(layer, color);
         ilm_commitChanges();
     }
     else if (input->contains("surface"))
     {
-        t_ilm_surface surface = input->getUint("id");
-        t_ilm_int color[3] =
+        ilmErrorTypes callResult = ilm_surfaceSetChromaKey(id, color);
+        if (ILM_SUCCESS != callResult)
         {
-            input->getInt("red"),
-            input->getInt("green"),
-            input->getInt("blue")
-        };
-        ilm_surfaceSetChromaKey(surface, color);
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set chroma key (" << color[0] << ", " << color[1] << ", " << color[2] << ") for surface with ID " << id << "\n";
+            return;
+        }
+
         ilm_commitChanges();
     }
 }
@@ -474,7 +736,15 @@ COMMAND("set surface <surfaceid> chromakey disabled")
 //=============================================================================
 {
     t_ilm_surface surface = input->getUint("surfaceid");
-    ilm_surfaceSetChromaKey(surface, NULL);
+
+    ilmErrorTypes callResult = ilm_surfaceSetChromaKey(surface, NULL);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to disable chroma key for surface with ID " << surface << "\n";
+        return;
+    }
+
     ilm_commitChanges();
 }
 
index 30215a7..5e42e03 100644 (file)
@@ -148,7 +148,15 @@ void captureSceneData(t_scene_data* pScene)
 
     //get screen information
     t_ilm_uint screenWidth = 0, screenHeight = 0;
-    ilm_getScreenResolution(0, &screenWidth, &screenHeight);
+
+    ilmErrorTypes callResult = ilm_getScreenResolution(0, &screenWidth, &screenHeight);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get screen resolution for screen with ID " << 0 << "\n";
+        return;
+    }
+
     scene.screenWidth = screenWidth;
     scene.screenHeight = screenHeight;
 
@@ -158,7 +166,15 @@ void captureSceneData(t_scene_data* pScene)
     //get screens
     unsigned int screenCount = 0;
     t_ilm_display* screenArray = NULL;
-    ilm_getScreenIDs(&screenCount, &screenArray);
+
+    callResult = ilm_getScreenIDs(&screenCount, &screenArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available screen IDs\n";
+        return;
+    }
+
     scene.screens = vector<t_ilm_display>(screenArray, screenArray + screenCount);
 
     //layers on each screen
@@ -168,7 +184,14 @@ void captureSceneData(t_scene_data* pScene)
 
         t_ilm_int layerCount = 0;
         t_ilm_layer* layerArray = NULL;
-        ilm_getLayerIDsOnScreen(screenId, &layerCount, &layerArray);
+
+        callResult = ilm_getLayerIDsOnScreen(screenId, &layerCount, &layerArray);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get layers on screen with ID "<< screenId <<"\n";
+            return;
+        }
 
         scene.screenLayers[screenId] = vector<t_ilm_layer>(layerArray, layerArray + layerCount);
 
@@ -193,7 +216,15 @@ void captureSceneData(t_scene_data* pScene)
 
         //layer properties
         ilmLayerProperties lp;
-        ilm_getPropertiesOfLayer(layerId, &lp);
+
+        callResult = ilm_getPropertiesOfLayer(layerId, &lp);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get properties of layer with ID "<< layerId <<"\n";
+            return;
+        }
+
         scene.layerProperties[layerId] = lp;
     }
 
@@ -205,7 +236,14 @@ void captureSceneData(t_scene_data* pScene)
         //surfaces on layer (in rendering order)
         int surfaceCount = 0;
         t_ilm_surface* surfaceArray = NULL;
-        ilm_getSurfaceIDsOnLayer(layerId, &surfaceCount, &surfaceArray);
+
+        callResult = ilm_getSurfaceIDsOnLayer(layerId, &surfaceCount, &surfaceArray);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get surfaces on layer with ID "<< layerId <<"\n";
+            return;
+        }
 
         //rendering order on layer
         scene.layerSurfaces[layerId] = vector<t_ilm_surface>(surfaceArray, surfaceArray + surfaceCount);
@@ -221,7 +259,15 @@ void captureSceneData(t_scene_data* pScene)
     //get all surfaces (on layers and without layers)
     t_ilm_int surfaceCount = 0;
     t_ilm_surface* surfaceArray = NULL;
-    ilm_getSurfaceIDs(&surfaceCount, &surfaceArray);
+
+    callResult = ilm_getSurfaceIDs(&surfaceCount, &surfaceArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available surfaces\n";
+        return;
+    }
+
     scene.surfaces = vector<t_ilm_surface>(surfaceArray, surfaceArray + surfaceCount);
 
     for (int k = 0; k < surfaceCount; ++k)
@@ -230,7 +276,15 @@ void captureSceneData(t_scene_data* pScene)
 
         //surface properties
         ilmSurfaceProperties sp;
-        ilm_getPropertiesOfSurface(surfaceId, &sp);
+
+        callResult = ilm_getPropertiesOfSurface(surfaceId, &sp);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get properties of surface with ID " << surfaceId << "\n";
+            return;
+        }
+
         scene.surfaceProperties[surfaceId] = sp;
     }
 }
@@ -247,7 +301,13 @@ void setScene(t_scene_data* pScene, bool clean)
         t_ilm_surface surface = it->first;
         t_ilm_layer layer = it->second;
 
-        ilm_layerRemoveSurface(layer, surface);
+        ilmErrorTypes callResult = ilm_layerRemoveSurface(layer, surface);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove surface " << surface << " from layer " << layer << "\n";
+            return;
+        }
     }
 
     ilm_commitChanges();
@@ -264,7 +324,13 @@ void setScene(t_scene_data* pScene, bool clean)
             if (find(pScene->surfaces.begin(), pScene->surfaces.end(), surface) == pScene->surfaces.end())
             {
                 //remove surface !
-                ilm_surfaceRemove(surface);
+                ilmErrorTypes callResult = ilm_surfaceRemove(surface);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to remove surface " << surface << "\n";
+                    return;
+                }
             }
         }
 
@@ -278,7 +344,13 @@ void setScene(t_scene_data* pScene, bool clean)
             if (find(pScene->layers.begin(), pScene->layers.end(), layer) == pScene->layers.end())
             {
                 //remove surface !
-                ilm_layerRemove(layer);
+                ilmErrorTypes callResult = ilm_layerRemove(layer);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to remove layer " << layer << "\n";
+                    return;
+                }
             }
         }
 
@@ -294,7 +366,14 @@ void setScene(t_scene_data* pScene, bool clean)
         if (find(initialScene.layers.begin(), initialScene.layers.end(), layer) == initialScene.layers.end())
         {
             ilmLayerProperties& props = pScene->layerProperties[layer];
-            ilm_layerCreateWithDimension(&layer, props.origSourceWidth, props.origSourceHeight);
+
+            ilmErrorTypes callResult = ilm_layerCreateWithDimension(&layer, props.origSourceWidth, props.origSourceHeight);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to create layer with ID " << layer << " and dimensions (" << props.origSourceWidth << " ," << props.origSourceHeight << ")\n";
+                return;
+            }
         }
     }
 
@@ -443,7 +522,14 @@ void emptyScene(t_scene_data* pScene)
     for(t_ilm_uint i = 0 ; i < count ; ++i)
     {
         pScene->screens.push_back(screenArray[i]);
-        ilm_getScreenResolution(screenArray[0], & pScene->screenWidth, & pScene->screenHeight);
+
+        ilmErrorTypes callResult = ilm_getScreenResolution(screenArray[0], & pScene->screenWidth, & pScene->screenHeight);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get screen resolution for screen with ID " << screenArray[0] << "\n";
+            return;
+        }
     }
 }
 
@@ -457,7 +543,12 @@ t_scene_data cloneToUniLayerScene(t_scene_data* pScene)
         extraLayer = pScene->layers[0];
     }
 
-    ilm_layerCreate(&extraLayer);
+    ilmErrorTypes callResult = ilm_layerCreate(&extraLayer);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to create layer\n";
+    }
 
     ilmLayerProperties extraLayerProperties;
     extraLayerProperties.destHeight = pScene->screenHeight;
@@ -573,7 +664,14 @@ void transformScene(t_scene_data* pInitialScene, t_scene_data* pFinalScene, t_il
                 t_ilm_surface surface = *it;
                 tuple4 coords = interpolateCoordinatesHelper(start[surface], end[surface], t);
 
-                ilm_surfaceSetDestinationRectangle(surface, coords.x, coords.y, coords.z - coords.x, coords.w - coords.y);
+                ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface, coords.x, coords.y, coords.z - coords.x, coords.w - coords.y);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coords.x << "," << coords.y << ", "<< coords.z - coords.x << ", " << coords.w - coords.y
+                            <<") for surface with ID " << surface << "\n";
+                    return;
+                }
 
                 float opacity = t * pFinalScene->surfaceProperties[surface].opacity
                         + (1-t) * pInitialScene->surfaceProperties[surface].opacity;
index 78c546e..549b761 100644 (file)
@@ -64,7 +64,16 @@ void getCommunicatorPerformance()
 
     while (gBenchmark_running)
     {
-        ilm_getNumberOfHardwareLayers(0, &hwLayerCnt);
+        t_ilm_uint screenid = 0;
+
+        ilmErrorTypes callResult = ilm_getNumberOfHardwareLayers(screenid, &hwLayerCnt);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get number of hardware layers for screen with ID " << screenid << "\n";
+            return;
+        }
+
         ++runs;
     }
 
@@ -75,22 +84,29 @@ void getCommunicatorPerformance()
 
 void setSurfaceKeyboardFocus(t_ilm_surface surface)
 {
-    if (ilm_SetKeyboardFocusOn(surface) != ILM_SUCCESS)
+    ilmErrorTypes callResult = ilm_SetKeyboardFocusOn(surface);
+    if (ILM_SUCCESS != callResult)
     {
-        cerr << "Error during communication" << endl;
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set keyboard focus at surface with ID " << surface << "\n";
+        return;
     }
 }
 
 void getKeyboardFocus()
 {
     t_ilm_surface surfaceId;
-    if (ilm_GetKeyboardFocusSurfaceId(&surfaceId) == ILM_SUCCESS)
+
+    ilmErrorTypes callResult = ilm_GetKeyboardFocusSurfaceId(&surfaceId);
+    if (ILM_SUCCESS == callResult)
     {
         cout << "keyboardFocusSurfaceId == " << surfaceId << endl;
     }
     else
     {
-        cerr << "Error during communication" << endl;
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get keyboard focus surface ID\n";
+        return;
     }
 }
 
@@ -126,7 +142,14 @@ void setSurfaceAcceptsInput(t_ilm_surface surfaceId, string kbdPointerTouch, t_i
         tok = strtok(NULL, ":");
     }
 
-    ilm_UpdateInputEventAcceptanceOn(surfaceId, devices, acceptance);
+    ilmErrorTypes callResult = ilm_UpdateInputEventAcceptanceOn(surfaceId, devices, acceptance);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to update input event acceptance on surface with ID " << surfaceId << "\n";
+        return;
+    }
+
     ilm_commitChanges();
 
     delete[] str;
@@ -172,14 +195,14 @@ void layerNotificationCallback(t_ilm_layer layer, struct ilmLayerProperties* pro
 
 void testNotificationLayer(t_ilm_layer layerid)
 {
-
-    ilmErrorTypes ret;
     cout << "Setup notification for layer " << layerid << " \n";
-    ret = ilm_layerAddNotification(layerid, layerNotificationCallback);
 
-    if (ret != ILM_SUCCESS)
+    ilmErrorTypes callResult = ilm_layerAddNotification(layerid, layerNotificationCallback);
+    if (ILM_SUCCESS != callResult)
     {
-        cerr << "ilm_layerAddNotification returned error " << ret << "\n";
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to add notification callback to layer with ID " << layerid << "\n";
+        return;
     }
 
     for  (int i = 0; i < 2; ++i)
@@ -212,11 +235,12 @@ void watchLayer(unsigned int* layerids, unsigned int layeridCount)
     {
         unsigned int layerid = layerids[i];
         cout << "Setup notification for layer " << layerid << "\n";
-        ilmErrorTypes ret = ilm_layerAddNotification(layerid, layerNotificationCallback);
 
-        if (ret != ILM_SUCCESS)
+        ilmErrorTypes callResult = ilm_layerAddNotification(layerid, layerNotificationCallback);
+        if (ILM_SUCCESS != callResult)
         {
-            cerr << "ilm_layerAddNotification(" << layerid << ") returned error " << ret << "\n";
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to add notification callback to layer with ID " << layerid << "\n";
             return;
         }
     }
@@ -229,7 +253,14 @@ void watchLayer(unsigned int* layerids, unsigned int layeridCount)
     {
         unsigned int layerid = layerids[i];
         cout << "Removing notification for layer " << layerid << "\n";
-        ilm_layerRemoveNotification(layerid);
+
+        ilmErrorTypes callResult = ilm_layerRemoveNotification(layerid);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove notification callback of layer with ID " << layerid << "\n";
+            return;
+        }
     }
 
     if (layerids)
@@ -282,11 +313,12 @@ void watchSurface(unsigned int* surfaceids, unsigned int surfaceidCount)
     {
         unsigned int surfaceid = surfaceids[i];
         cout << "Setup notification for surface " << surfaceid << "\n";
-        ilmErrorTypes ret = ilm_surfaceAddNotification(surfaceid, surfaceNotificationCallback);
 
-        if (ret != ILM_SUCCESS)
+        ilmErrorTypes callResult = ilm_surfaceAddNotification(surfaceid, surfaceNotificationCallback);
+        if (ILM_SUCCESS != callResult)
         {
-            cerr << "ilm_surfaceAddNotification(" << surfaceid << ") returned error " << ret << "\n";
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to add notification callback to surface with ID " << surfaceid << "\n";
             return;
         }
     }
@@ -299,7 +331,14 @@ void watchSurface(unsigned int* surfaceids, unsigned int surfaceidCount)
     {
         unsigned int surfaceid = surfaceids[i];
         cout << "Removing notification for surface " << surfaceid << "\n";
-        ilm_surfaceRemoveNotification(surfaceid);
+
+        ilmErrorTypes callResult = ilm_surfaceRemoveNotification(surfaceid);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove notification callback of surface with ID " << surfaceid << "\n";
+            return;
+        }
     }
 
     if (surfaceids)
@@ -310,10 +349,13 @@ void watchSurface(unsigned int* surfaceids, unsigned int surfaceidCount)
 
 void setOptimization(t_ilm_uint id, t_ilm_uint mode)
 {
-    if (ilm_SetOptimizationMode((ilmOptimization)id,
-                                    (ilmOptimizationMode)mode) != ILM_SUCCESS)
+    ilmErrorTypes callResult = ilm_SetOptimizationMode((ilmOptimization)id,
+                                    (ilmOptimizationMode)mode);
+    if (ILM_SUCCESS != callResult)
     {
-        cerr << "Error during communication" << endl;
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set optimization with ID "<< id <<" mode " << mode << "\n";
+        return;
     }
 
     ilm_commitChanges();
@@ -323,7 +365,9 @@ void getOptimization(t_ilm_uint id)
 {
     ilmOptimization optimizationId = (ilmOptimization)id;
     ilmOptimizationMode optimizationMode;
-    if (ilm_GetOptimizationMode(optimizationId, &optimizationMode) == ILM_SUCCESS)
+
+    ilmErrorTypes callResult = ilm_GetOptimizationMode(optimizationId, &optimizationMode);
+    if (callResult == ILM_SUCCESS)
     {
         switch ( optimizationId )
         {
@@ -362,7 +406,9 @@ void getOptimization(t_ilm_uint id)
     }
     else
     {
-        cerr << "Error during communication" << endl;
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get mode for optimization with ID "<< optimizationId << "\n";
+        return;
     }
 
     ilm_commitChanges();
index 228932d..dcd2184 100644 (file)
@@ -154,26 +154,53 @@ void demoAnimatorDownwards(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             {
                 //set source region to only the visible part of the surface
                 int ySource = static_cast<int>(-coordinates.y / surfaceScale[surface]);
-                ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
+                            <<") for surface with ID " << surface << "\n";
+                }
 
                 //set the destination region AT THE TOP of the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         0,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w) <<") for surface with ID " << surface << "\n";
+                }
             }
             else
             {
                 //set source region to whole surface
-                ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
+                            <<") for surface with ID " << surface << "\n";
+                }
 
                 //set destination region to the region on the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         coordinates.y,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w - coordinates.y));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                }
             }
 
             surfaceCoordinates[surface] = coordinates;
@@ -269,7 +296,13 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
             t_ilm_surface surface = *it;
 
             float opacity = min(1.0, 1.1 - surfaceScale[surface]);
-            ilm_surfaceSetOpacity(surface, opacity);
+
+            ilmErrorTypes callResult = ilm_surfaceSetOpacity(surface, opacity);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+            }
         }
 
         for (vector<t_ilm_surface>::iterator it = renderedSurfaces.begin();
@@ -303,26 +336,53 @@ void demoAnimatorRandomDirections(t_scene_data* pInitialScene, t_scene_data* pDe
             {
                 //set source region to only the visible part of the surface
                 int ySource = static_cast<int>(-coordinates.y / surfaceScale[surface]);
-                ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, ySource, properties.sourceWidth, properties.sourceHeight - ySource);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
+                            <<") for surface with ID " << surface << "\n";
+                }
 
                 //set the destination region AT THE TOP of the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         0,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
+                            <<") for surface with ID " << surface << "\n";
+                }
             }
             else
             {
                 //set source region to whole surface
-                ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
+                            <<") for surface with ID " << surface << "\n";
+                }
 
                 //set destination region to the region on the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         coordinates.y,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w - coordinates.y));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                }
             }
 
             surfaceCoordinates[surface] = coordinates;
@@ -431,7 +491,13 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             int displacement = static_cast<int>(t * abs(surfaceSpeed[surface]));
 
             t_ilm_float opacity = min(1.0, max(0.0, 1 - fraction)); //between 0 and 1
-            ilm_surfaceSetOpacity(surface, opacity);
+
+            ilmErrorTypes callResult = ilm_surfaceSetOpacity(surface, opacity);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+            }
 
             //move
             coordinates.y += displacement;
@@ -442,30 +508,57 @@ void demoAnimatorWaterfall(t_scene_data* pInitialScene, t_scene_data* pDemoScene
             {
                 //set source region to only the visible part of the surface
                 int ySource = static_cast<int>(-coordinates.y / surfaceScale[surface]);
-                ilm_surfaceSetSourceRectangle(surface,
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface,
                         0,
                         ySource,
                         properties.sourceWidth,
                         properties.sourceHeight - ySource);
 
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << ySource << ", "<< properties.sourceWidth << ", " << properties.sourceHeight - ySource
+                            <<") for surface with ID " << surface << "\n";
+                }
+
                 //set the destination region AT THE TOP of the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         0,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << 0 << ", "<< max(0, coordinates.z - coordinates.x) << ", " << max(0, coordinates.w)
+                            <<") for surface with ID " << surface << "\n";
+                }
             }
             else
             {
                 //set source region to whole surface
-                ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                ilmErrorTypes callResult = ilm_surfaceSetSourceRectangle(surface, 0, 0, properties.sourceWidth, properties.sourceHeight);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set source rectangle (" << 0 << "," << 0 << ", "<< properties.sourceWidth << ", " << properties.sourceHeight
+                            <<") for surface with ID " << surface << "\n";
+                }
 
                 //set destination region to the region on the layer used for displaying the surface
-                ilm_surfaceSetDestinationRectangle(surface,
+                callResult = ilm_surfaceSetDestinationRectangle(surface,
                         coordinates.x,
                         coordinates.y,
                         max(0, coordinates.z - coordinates.x),
                         max(0, coordinates.w - coordinates.y));
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << coordinates.x << "," << coordinates.y << ", "<< max(0, coordinates.z - coordinates.x) << ", "
+                            << max(0, coordinates.w - coordinates.y) <<") for surface with ID " << surface << "\n";
+                }
             }
 
             surfaceCoordinates[surface] = coordinates;
@@ -498,11 +591,19 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
         surfaceProperties.destHeight = 0;
         surfaceProperties.destWidth = 0;
 
-        ilm_surfaceSetDestinationRectangle(surface,
+        ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                 surfaceProperties.destX,
                 surfaceProperties.destY,
                 surfaceProperties.destWidth,
                 surfaceProperties.destHeight);
+
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                    << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+        }
+
     }
 
     //sleeping time
@@ -531,13 +632,26 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
             currentSurfaceIndex = (currentSurfaceIndex + 1) % renderedSurfaces.size();
             t_ilm_layer layer = pDemoScene->screenLayers.begin()->second[0];
 
-            ilm_surfaceSetDestinationRectangle(surface,
+            ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                     surfaceProperties.destX,
                     surfaceProperties.destY,
                     surfaceProperties.destWidth,
                     surfaceProperties.destHeight);
 
-            ilm_layerSetRenderOrder(layer, renderedSurfaces.data() + currentSurfaceIndex, 1);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                        << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+            }
+
+            callResult = ilm_layerSetRenderOrder(layer, renderedSurfaces.data() + currentSurfaceIndex, 1);
+
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set render order for layer with ID " << layer << "\n";
+            }
         }
         else
         {
@@ -548,14 +662,27 @@ void demoAnimatorZooming(t_scene_data* pInitialScene, t_scene_data* pDemoScene,
             surfaceProperties.destWidth += 2 * change;
             surfaceProperties.destHeight += 2 * change;
 
-            ilm_surfaceSetDestinationRectangle(surface,
+            ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                     surfaceProperties.destX,
                     surfaceProperties.destY,
                     surfaceProperties.destWidth,
                     surfaceProperties.destHeight);
 
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                        << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+            }
+
             float opacity = 1 / pow(t, 0.4);
-            ilm_surfaceSetOpacity(surface, opacity);
+
+            callResult = ilm_surfaceSetOpacity(surface, opacity);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+            }
         }
 
         ilm_commitChanges();
@@ -584,12 +711,19 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
         surfaceProperties.destHeight = 0;
         surfaceProperties.destWidth = 0;
 
-        ilm_surfaceSetDestinationRectangle(surface,
+        ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                 surfaceProperties.destX,
                 surfaceProperties.destY,
                 surfaceProperties.destWidth,
                 surfaceProperties.destHeight);
 
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                    << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+        }
+
         scaleFactors[surface] = 1;
     }
 
@@ -616,12 +750,19 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
 
                 t_ilm_layer layer = pDemoScene->screenLayers.begin()->second[0];
 
-                ilm_surfaceSetDestinationRectangle(surface,
+                ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                         surfaceProperties.destX,
                         surfaceProperties.destY,
                         surfaceProperties.destWidth,
                         surfaceProperties.destHeight);
 
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                            << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                }
+
                 ilm_commitChanges();
                 //update render order
                 t_ilm_surface firstSurface = renderedSurfaces[0];
@@ -632,7 +773,14 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
 
                 renderedSurfaces[renderedSurfaces.size() - 1] = firstSurface;
 
-                ilm_layerSetRenderOrder(layer, renderedSurfaces.data(), renderedSurfaces.size());
+                callResult = ilm_layerSetRenderOrder(layer, renderedSurfaces.data(), renderedSurfaces.size());
+
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set render order for layer with ID " << layer << "\n";
+                }
+
                 ilm_commitChanges();
             }
             else
@@ -646,14 +794,27 @@ void demoAnimatorCascadedZooming(t_scene_data* pInitialScene, t_scene_data* pDem
                 surfaceProperties.destWidth += 2 * change;
                 surfaceProperties.destHeight += 2 * change;
 
-                ilm_surfaceSetDestinationRectangle(surface,
+                ilmErrorTypes callResult = ilm_surfaceSetDestinationRectangle(surface,
                         surfaceProperties.destX,
                         surfaceProperties.destY,
                         surfaceProperties.destWidth,
                         surfaceProperties.destHeight);
 
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set destination rectangle (" << surfaceProperties.destX << "," << surfaceProperties.destY << ", "<< surfaceProperties.destWidth << ", "
+                            << surfaceProperties.destHeight <<") for surface with ID " << surface << "\n";
+                }
+
                 float opacity = 1 / pow(scaleFactors[surface], 0.4f);
-                ilm_surfaceSetOpacity(surface, opacity);
+
+                callResult = ilm_surfaceSetOpacity(surface, opacity);
+                if (ILM_SUCCESS != callResult)
+                {
+                    cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                    cout << "Failed to set opacity " << opacity <<" for surface with ID " << surface << "\n";
+                }
             }
         }
 
index ba1a844..05ee7e4 100644 (file)
@@ -85,11 +85,12 @@ void printScreenProperties(unsigned int screenid, const char* prefix)
     cout << prefix << "---------------------------------------\n";
 
     ilmScreenProperties screenProperties;
-    ilmErrorTypes result = ilm_getPropertiesOfScreen(screenid, &screenProperties);
-    if (ILM_SUCCESS != result)
+
+    ilmErrorTypes callResult = ilm_getPropertiesOfScreen(screenid, &screenProperties);
+    if (ILM_SUCCESS != callResult)
     {
-        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(result) << "\n";
-        cout << "No screen with ID " << screenid << " found\n";
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get properties of screen with ID " << screenid << " found\n";
         return;
     }
 
@@ -115,11 +116,12 @@ void printLayerProperties(unsigned int layerid, const char* prefix)
     cout << prefix << "---------------------------------------\n";
 
     ilmLayerProperties p;
-    ilmErrorTypes result = ilm_getPropertiesOfLayer(layerid, &p);
-    if (ILM_SUCCESS != result)
+
+    ilmErrorTypes callResult = ilm_getPropertiesOfLayer(layerid, &p);
+    if (ILM_SUCCESS != callResult)
     {
-        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(result) << "\n";
-        cout << "No layer with ID " << layerid << " found\n";
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get properties of layer with ID " << layerid << " found\n";
         return;
     }
 
@@ -179,9 +181,18 @@ void printLayerProperties(unsigned int layerid, const char* prefix)
             << "(r=" << p.chromaKeyRed << ", g=" << p.chromaKeyGreen << ", b=" << p.chromaKeyBlue << ")\n";
 
     cout << prefix << "- surface render order: ";
+
     int surfaceCount = 0;
     unsigned int* surfaceArray = NULL;
-    ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+
+    callResult = ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get surfaces on layer with ID " << layerid << " \n";
+        return;
+    }
+
     for (int surfaceIndex = 0; surfaceIndex < surfaceCount; ++surfaceIndex)
     {
         cout << surfaceArray[surfaceIndex] << "(0x" << hex
@@ -190,16 +201,33 @@ void printLayerProperties(unsigned int layerid, const char* prefix)
     cout << "\n";
 
     cout << prefix << "- on screen:            ";
+
     unsigned int screenCount = 0;
     unsigned int* screenArray = NULL;
-    ilm_getScreenIDs(&screenCount, &screenArray);
+
+    callResult = ilm_getScreenIDs(&screenCount, &screenArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available screens\n";
+        return;
+    }
+
     for (unsigned int screenIndex = 0; screenIndex < screenCount;
             ++screenIndex)
     {
         unsigned int screenid = screenArray[screenIndex];
         int layerCount = 0;
         unsigned int* layerArray = NULL;
-        ilm_getLayerIDsOnScreen(screenid, &layerCount, &layerArray);
+
+        callResult = ilm_getLayerIDsOnScreen(screenid, &layerCount, &layerArray);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get available layers on screen with ID" << screenid << "\n";
+            return;
+        }
+
         for (int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
         {
             unsigned int id = layerArray[layerIndex];
@@ -219,10 +247,11 @@ void printSurfaceProperties(unsigned int surfaceid, const char* prefix)
     cout << prefix << "---------------------------------------\n";
 
     ilmSurfaceProperties p;
-    ilmErrorTypes result = ilm_getPropertiesOfSurface(surfaceid, &p);
-    if (ILM_SUCCESS != result)
+
+    ilmErrorTypes callResult = ilm_getPropertiesOfSurface(surfaceid, &p);
+    if (ILM_SUCCESS != callResult)
     {
-        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(result) << "\n";
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
         cout << "No surface with ID " << surfaceid << " found\n";
         return;
     }
@@ -298,7 +327,13 @@ void printSurfaceProperties(unsigned int surfaceid, const char* prefix)
             << "\n";
 
     t_ilm_surface keyboardFocusSurfaceId;
-    ilm_GetKeyboardFocusSurfaceId(&keyboardFocusSurfaceId);
+    callResult = ilm_GetKeyboardFocusSurfaceId(&keyboardFocusSurfaceId);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get keyboard focus surface ID\n";
+        return;
+    }
 
     cout << prefix << "- has keyboard focus: "
             << (keyboardFocusSurfaceId == surfaceid ? "true" : "false")
@@ -315,13 +350,29 @@ void printSurfaceProperties(unsigned int surfaceid, const char* prefix)
     cout << prefix << "- on layer:           ";
     int layerCount = 0;
     unsigned int* layerArray = NULL;
-    ilm_getLayerIDs(&layerCount, &layerArray);
+
+    callResult = ilm_getLayerIDs(&layerCount, &layerArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available layer IDs\n";
+        return;
+    }
+
     for (int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
     {
         unsigned int layerid = layerArray[layerIndex];
         int surfaceCount = 0;
         unsigned int* surfaceArray = NULL;
-        ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+
+        callResult = ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get surface IDs on layer" << layerid << "\n";
+            return;
+        }
+
         for (int surfaceIndex = 0; surfaceIndex < surfaceCount;
                 ++surfaceIndex)
         {
@@ -340,7 +391,13 @@ void printScene()
     unsigned int screenCount = 0;
     unsigned int* screenArray = NULL;
 
-    ilm_getScreenIDs(&screenCount, &screenArray);
+    ilmErrorTypes callResult = ilm_getScreenIDs(&screenCount, &screenArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available screen IDs\n";
+        return;
+    }
 
     for (unsigned int screenIndex = 0; screenIndex < screenCount; ++screenIndex)
     {
@@ -350,7 +407,15 @@ void printScene()
 
         int layerCount = 0;
         unsigned int* layerArray = NULL;
-        ilm_getLayerIDsOnScreen(screenid, &layerCount, &layerArray);
+
+        callResult = ilm_getLayerIDsOnScreen(screenid, &layerCount, &layerArray);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to get available layers on screen with ID" << screenid << "\n";
+            return;
+        }
+
         for (int layerIndex = 0; layerIndex < layerCount; ++layerIndex)
         {
             unsigned int layerid = layerArray[layerIndex];
@@ -359,7 +424,15 @@ void printScene()
 
             int surfaceCount = 0;
             unsigned int* surfaceArray = NULL;
-            ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+
+            callResult = ilm_getSurfaceIDsOnLayer(layerid, &surfaceCount, &surfaceArray);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to get available surfaces on layer with ID" << layerid << "\n";
+                return;
+            }
+
             for (int surfaceIndex = 0; surfaceIndex < surfaceCount; ++surfaceIndex)
             {
                 unsigned int surfaceid = surfaceArray[surfaceIndex];
index 5c5caad..22e70f8 100644 (file)
@@ -24,6 +24,7 @@
 using std::max;
 using std::min;
 
+#include <cstdlib>
 
 #include <iostream>
 using std::cout;
@@ -106,11 +107,23 @@ void* scatterThreadCallback(void* param)
         {
             t_ilm_surface currentSurface = *surface;
 
-            ilm_surfaceSetVisibility(currentSurface, false);
+            ilmErrorTypes callResult = ilm_surfaceSetVisibility(currentSurface, false);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set visibility "<< false << " for surface with ID " << currentSurface << "\n";
+            }
+
             ilm_commitChanges();
             usleep(100000);
 
-            ilm_surfaceSetVisibility(currentSurface, true);
+            callResult = ilm_surfaceSetVisibility(currentSurface, true);
+            if (ILM_SUCCESS != callResult)
+            {
+                cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+                cout << "Failed to set visibility "<< true << " for surface with ID " << currentSurface << "\n";
+            }
+
             ilm_commitChanges();
         }
 
index c8faafd..470e6c3 100644 (file)
@@ -362,14 +362,27 @@ void createSceneContentsHelper(IlmSurface* pIlmsurface)
     //if surface does not exist: create it
     t_ilm_int surfaceCount;
     t_ilm_surface* surfaceArray;
-    ilm_getSurfaceIDs(&surfaceCount, &surfaceArray);
+
+    ilmErrorTypes callResult = ilm_getSurfaceIDs(&surfaceCount, &surfaceArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available surface IDs\n";
+    }
+
 
     if (find(surfaceArray, surfaceArray + surfaceCount, surfaceId)
             == surfaceArray + surfaceCount)
     {
         ilmPixelFormat pixelFormat;
         pixelFormat = toPixelFormat(props.pixelformat);
-        ilm_surfaceCreate(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, &surfaceId);
+
+        ilmErrorTypes callResult = ilm_surfaceCreate(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, &surfaceId);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to create surface\n";
+        }
     }
 }
 
@@ -383,11 +396,23 @@ void createSceneContentsHelper(IlmLayer* pIlmlayer)
     //create layer if does not exist
     t_ilm_int layerCount;
     t_ilm_layer* layerArray;
-    ilm_getLayerIDs(&layerCount, &layerArray);
+
+    ilmErrorTypes callResult = ilm_getLayerIDs(&layerCount, &layerArray);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to get available layer IDs\n";
+    }
 
     if (find(layerArray, layerArray + layerCount, layerId) == layerArray + layerCount)
     {
-        ilm_layerCreateWithDimension(&layerId, props.origSourceWidth, props.origSourceHeight);
+        ilmErrorTypes callResult = ilm_layerCreateWithDimension(&layerId, props.origSourceWidth, props.origSourceHeight);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to create layer width dimensions (" << props.origSourceWidth <<" ,"<< props.origSourceHeight << ")\n";
+        }
+
         ilm_commitChanges();
     }
 
@@ -404,7 +429,13 @@ void createSceneContentsHelper(IlmLayer* pIlmlayer)
         createSceneContentsHelper(*it);
     }
 
-    ilm_layerSetRenderOrder(layerId, renderOrder.data(), renderOrder.size());
+    callResult = ilm_layerSetRenderOrder(layerId, renderOrder.data(), renderOrder.size());
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set render order for layer with ID "<< layerId << ")\n";
+    }
+
     ilm_commitChanges();
 }
 
@@ -426,7 +457,13 @@ void createSceneContentsHelper(IlmDisplay* pIlmdisplay)
         ilm_commitChanges();
     }
 
-    ilm_displaySetRenderOrder(displayId, renderOrder.data(), renderOrder.size());
+    ilmErrorTypes callResult = ilm_displaySetRenderOrder(displayId, renderOrder.data(), renderOrder.size());
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set render order for display with ID "<< displayId << ")\n";
+    }
+
     ilm_commitChanges();
 }
 
@@ -463,7 +500,13 @@ void restoreSceneHelper(IlmSurface* pIlmsurface)
 
     ilmPixelFormat pixelFormat;
     pixelFormat = toPixelFormat(props.pixelformat);
-    ilm_surfaceSetNativeContent(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, surfaceId);
+
+    ilmErrorTypes callResult = ilm_surfaceSetNativeContent(props.nativeSurface, props.origSourceWidth, props.origSourceHeight, pixelFormat, surfaceId);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set native content for surface with ID "<< surfaceId << ")\n";
+    }
 
     ilm_commitChanges();
 
@@ -487,7 +530,13 @@ void restoreSceneHelper(IlmLayer* pIlmlayer)
     ilmLayerProperties props = getLayerProperties(pIlmlayer);
 
     //set layer properties
-    ilm_layerSetDestinationRectangle(layerId, props.destX, props.destY, props.destWidth, props.destHeight);
+    ilmErrorTypes callResult = ilm_layerSetDestinationRectangle(layerId, props.destX, props.destY, props.destWidth, props.destHeight);
+    if (ILM_SUCCESS != callResult)
+    {
+        cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+        cout << "Failed to set destination rectangle for layer with ID "<< layerId << ")\n";
+    }
+
     ilm_commitChanges();
     ilm_layerSetOpacity(layerId, props.opacity);
     ilm_commitChanges();
@@ -537,7 +586,12 @@ void restoreScene(IlmScene* pIlmscene)
     for (map<t_ilm_surface, t_ilm_layer>::iterator it = currentScene.surfaceLayer.begin();
             it != currentScene.surfaceLayer.end(); ++it)
     {
-        ilm_layerRemoveSurface(it->second, it->first);
+        ilmErrorTypes callResult = ilm_layerRemoveSurface(it->second, it->first);
+        if (ILM_SUCCESS != callResult)
+        {
+            cout << "LayerManagerService returned: " << ILM_ERROR_STRING(callResult) << "\n";
+            cout << "Failed to remove surface "<< it->first << " from layer " << it->second << ")\n";
+        }
     }
 
     ilm_commitChanges();