From 483b1315fb7a292993c644a7b97e71f5ff698df0 Mon Sep 17 00:00:00 2001 From: Timo Lotterbach Date: Thu, 10 Jan 2013 03:33:16 -0800 Subject: [PATCH] ilmClient: added support for GetPropertiesOfScreen Signed-off-by: Timo Lotterbach --- LayerManagerClient/ilmClient/include/ilm_client.h | 10 +++++++ LayerManagerClient/ilmClient/include/ilm_types.h | 13 ++++++++ .../ilmClient/src/generic_ilm_client.c | 22 ++++++++++++++ .../ilmClient/tests/IlmCommandTest.cpp | 35 ++++++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/LayerManagerClient/ilmClient/include/ilm_client.h b/LayerManagerClient/ilmClient/include/ilm_client.h index ec79fb0..55d611a 100644 --- a/LayerManagerClient/ilmClient/include/ilm_client.h +++ b/LayerManagerClient/ilmClient/include/ilm_client.h @@ -770,6 +770,16 @@ ilmErrorTypes ilm_layerAddNotification(t_ilm_layer layer, layerNotificationFunc */ ilmErrorTypes ilm_layerRemoveNotification(t_ilm_layer layer); +/** + * \brief Get the screen properties from the Layermanagement + * \ingroup ilmClient + * \param[in] screenID screen Indentifier + * \param[out] pScreenProperties pointer where the screen properties should be stored + * \return ILM_SUCCESS if the method call was successful + * \return ILM_FAILED if the client can not get the resolution. + */ +ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties); + #ifdef __cplusplus } // #endif // __cplusplus diff --git a/LayerManagerClient/ilmClient/include/ilm_types.h b/LayerManagerClient/ilmClient/include/ilm_types.h index 0ea8ea8..715185d 100644 --- a/LayerManagerClient/ilmClient/include/ilm_types.h +++ b/LayerManagerClient/ilmClient/include/ilm_types.h @@ -237,6 +237,19 @@ struct ilmLayerProperties }; /** + * \brief Typedef for representing a the screen properties structure + * \ingroup ilmControl + **/ +struct ilmScreenProperties +{ + t_ilm_uint layerCount; /*!< number of layers displayed on the screen */ + t_ilm_layer* layerIds; /*!< array of layer ids */ + t_ilm_uint harwareLayerCount; /*!< number of hardware layers */ + t_ilm_uint screenWidth; /*!< width value of screen in pixels */ + t_ilm_uint screenHeight; /*!< height value of screen in pixels */ +}; + +/** * enum representing all possible incoming events for ilmClient and * Communicator Plugin */ diff --git a/LayerManagerClient/ilmClient/src/generic_ilm_client.c b/LayerManagerClient/ilmClient/src/generic_ilm_client.c index f8cc6dc..1f01300 100644 --- a/LayerManagerClient/ilmClient/src/generic_ilm_client.c +++ b/LayerManagerClient/ilmClient/src/generic_ilm_client.c @@ -1916,3 +1916,25 @@ ilmErrorTypes ilm_surfaceRemoveNotification(t_ilm_surface surface) gIpcModule.destroyMessage(command); return returnValue; } + +ilmErrorTypes ilm_getPropertiesOfScreen(t_ilm_display screenID, struct ilmScreenProperties* pScreenProperties) +{ + ilmErrorTypes returnValue = ILM_FAILED; + + t_ilm_message response = 0; + t_ilm_message command = gIpcModule.createMessage("GetPropertiesOfScreen"); + if (pScreenProperties + && command + && gIpcModule.appendUint(command, screenID) + && sendAndWaitForResponse(command, &response, gResponseTimeout) + && gIpcModule.getUintArray(response, &pScreenProperties->layerIds, &pScreenProperties->layerCount) + && gIpcModule.getUint(response, &pScreenProperties->harwareLayerCount) + && gIpcModule.getUint(response, &pScreenProperties->screenWidth) + && gIpcModule.getUint(response, &pScreenProperties->screenHeight)) + { + returnValue = ILM_SUCCESS; + } + gIpcModule.destroyMessage(response); + gIpcModule.destroyMessage(command); + return returnValue; +} diff --git a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp index 933ecaa..fb15d00 100644 --- a/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp +++ b/LayerManagerClient/ilmClient/tests/IlmCommandTest.cpp @@ -724,3 +724,38 @@ TEST_F(IlmCommandTest, SetGetOptimizationMode) { ilm_GetOptimizationMode(id, &retmode); ASSERT_EQ(mode, retmode); } + +TEST_F(IlmCommandTest, ilm_getPropertiesOfScreen) { + t_ilm_uint numberOfScreens = 0; + t_ilm_uint* screenIDs = NULL; + ilm_getScreenIDs(&numberOfScreens,&screenIDs); + ASSERT_TRUE(numberOfScreens>0); + + t_ilm_display screen = screenIDs[0]; + ilmScreenProperties screenProperties; + + t_ilm_layer layerIds[3] = {100, 200, 300};//t_ilm_layer layerIds[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; + ilm_layerCreate(layerIds); + ilm_layerCreate(layerIds + 1); + ilm_layerCreate(layerIds + 2); + + ilm_commitChanges(); + + ilm_displaySetRenderOrder(screen, layerIds, 3); + + ilm_commitChanges(); + + + ilm_getPropertiesOfScreen(screen, &screenProperties); + ASSERT_EQ(3, screenProperties.layerCount); + ASSERT_EQ(layerIds[0], screenProperties.layerIds[0]); + ASSERT_EQ(layerIds[1], screenProperties.layerIds[1]); + ASSERT_EQ(layerIds[2], screenProperties.layerIds[2]); + + ASSERT_GT(screenProperties.screenWidth, 0u); + ASSERT_GT(screenProperties.screenHeight, 0u); + + t_ilm_uint numberOfHardwareLayers; + ilm_getNumberOfHardwareLayers(screen, &numberOfHardwareLayers); + ASSERT_EQ(numberOfHardwareLayers, screenProperties.harwareLayerCount); +} -- 2.7.4