aboutsummaryrefslogtreecommitdiffstats
path: root/src/wm_layer_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wm_layer_control.cpp')
-rw-r--r--src/wm_layer_control.cpp77
1 files changed, 69 insertions, 8 deletions
diff --git a/src/wm_layer_control.cpp b/src/wm_layer_control.cpp
index 30e013f..5f23af1 100644
--- a/src/wm_layer_control.cpp
+++ b/src/wm_layer_control.cpp
@@ -13,24 +13,80 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#include <assert.h>
-#include "layers.hpp"
-#include "wm_layer.hpp"
+#include <unistd.h>
#include "wm_layer_control.hpp"
+#include "wm_layer.hpp"
+
+#define LC_AREA_PATH "/etc/area.db"
+#define LC_LAYER_SETTING_PATH "/etc/layer_setting.json"
using std::string;
namespace wm {
-LayerControl::LayerControl(const string& path) : wm_layers()
+static void notification_static(ilmObjectType object,
+ t_ilm_uint id,
+ t_ilm_bool created,
+ void* data)
{
- WMError ret = this->load(path);
- assert(ret == WMError::SUCCESS);
+ static_cast<LayerControl*>(data)->dispatchILMEvent(object, id, created);
}
-LayerControl::~LayerControl()
-{}
+LayerControl::LayerControl(const std::string& root)
+{
+ string area_path = root + LC_AREA_PATH;
+ string layer_path= root + LC_LAYER_SETTING_PATH;
+ // load layers.setting.json
+ // load area.db
+}
+
+WMError LayerControl::init()
+{
+ ilmErrorTypes rc = ilm_init();
+ t_ilm_uint num = 0;
+ t_ilm_uint *ids;
+ int cnt = 0;
+
+ while (rc != ILM_SUCCESS)
+ {
+ cnt++;
+ if (20 <= cnt)
+ {
+ HMI_ERROR("Could not connect to compositor");
+ goto lc_init_error;
+ }
+ HMI_ERROR("Wait to start weston ...");
+ sleep(1);
+ ilm_init();
+ }
+ if(rc != ILM_SUCCESS) goto lc_init_error;
+
+ rc = ilm_getScreenIDs(&num, &ids);
+
+ if(rc != ILM_SUCCESS) goto lc_init_error;
+
+ for(unsigned i = 0; i < num; i++)
+ {
+ HMI_INFO("get screen: %d", ids[i]);
+ }
+ // Currently, 0 is only available
+ this->screenID = ids[0];
+
+ rc = ilm_getPropertiesOfScreen(this->screenID, &this->screen_prop);
+
+ if(rc != ILM_SUCCESS) goto lc_init_error;
+
+ // Register Callback from ILM
+ ilm_registerNotification(notification_static, this);
+
+ return WMError::SUCCESS;
+
+lc_init_error:
+ HMI_ERROR("Failed to initialize. Terminate WM");
+
+ return WMError::FAIL;
+}
unsigned LayerControl::getNewLayerID(const string& role)
{
@@ -60,4 +116,9 @@ WMError LayerControl::load(const string &path)
return WMError::SUCCESS;
}
+void LayerControl::dispatchILMEvent(ilmObjectType object, t_ilm_uint id, t_ilm_bool created)
+{
+ ;
+}
+
} // namespace wm \ No newline at end of file