+ mp_qhs->showWindow(application_id.section('@', 0, 0).toStdString().c_str(), j_json);
+}
+
+void HomescreenHandler::updateShortcut(QString id, struct json_object* object)
+{
+ mp_qhs->updateShortcut(id.toStdString().c_str(), object);
+}
+
+
+void HomescreenHandler::setCurrentApplication(QString application_name)
+{
+ HMI_DEBUG("HomeScreen","setCurrentApplication %s", application_name.toStdString().c_str());
+ current_application = application_name;
+}
+
+QString HomescreenHandler::getCurrentApplication()
+{
+ HMI_DEBUG("HomeScreen","getCurrentApplication %s", current_application.toStdString().c_str());
+ return current_application;
+}
+
+int HomescreenHandler::getPidOfApplication(QString application_name) {
+ DIR *dir = NULL;
+ struct dirent *dir_ent_ptr = NULL;
+ FILE *fp = NULL;
+ char file_path[50] = {0};
+ char cur_task_ame[50] = {0};
+ char buf[BUF_SIZE] = {0};
+ int pid = -1;
+
+ dir = opendir("/proc");
+ if (dir) {
+ while((dir_ent_ptr = readdir(dir)) != NULL) {
+ if ((strcmp(dir_ent_ptr->d_name, ".") == 0) || (strcmp(dir_ent_ptr->d_name, "..") == 0)
+ || (DT_DIR != dir_ent_ptr->d_type))
+ continue;
+ sprintf(file_path, "/proc/%s/status", dir_ent_ptr->d_name);
+ fp = fopen(file_path, "r");
+ if (fp) {
+ if (fgets(buf, BUF_SIZE - 1, fp) == NULL) {
+ fclose(fp);
+ continue;
+ }
+ sscanf(buf, "%*s %s", cur_task_ame);
+ if (0 == strcmp(application_name.toStdString().c_str(), cur_task_ame)) {
+ pid = atoi(dir_ent_ptr->d_name);
+ break;
+ }
+ }
+ }
+ }