/*
* Copyright (c) 2017 TOYOTA MOTOR CORPORATION
+ * Copyright (c) 2018,2019 TOYOTA MOTOR CORPORATION
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
std::string("hideWindow"),
std::string("replyShowWindow"),
std::string("showNotification"),
- std::string("showInformation")
+ std::string("showInformation"),
+ std::string("getRunnables")
};
const std::vector<std::string> LibHomeScreen::event_list {
std::string("replyShowWindow"),
std::string("showNotification"),
std::string("showInformation"),
+ std::string("application-list-changed"),
std::string("none")
};
*/
void LibHomeScreen::set_event_handler(enum EventType et, handler_func f)
{
- if (et >= 1 && et <= 7) {
+ if (et > Event_Min && et < Event_Max) {
switch (et) {
case Event_ShowWindow:
this->subscribe(LibHomeScreen::event_list[0]);
case Event_ShowInformation:
this->subscribe(LibHomeScreen::event_list[6]);
break;
+ case Event_AppListChanged:
+ this->subscribe(LibHomeScreen::event_list[7]);
+ break;
}
this->handlers[et] = std::move(f);
return this->call("showInformation", json);
}
+/**
+ * get runnables list
+ *
+ * Call HomeScreen Service's getRunnables verb to get runnalbes list.
+ *
+ * #### Parameters
+ * - Nothing
+ *
+ * #### Return
+ * - Returns 0 on success or -1 in case of error.
+ *
+ */
+int LibHomeScreen::getRunnables(void)
+{
+ return this->call("getRunnables", nullptr);
+}
+
/************* Callback Function *************/
i->second(json_data);
}
}
+ else if (strcasecmp(event_type, LibHomeScreen::event_list[7].c_str()) == 0) {
+ auto i = this->handlers.find(Event_AppListChanged);
+ if ( i != this->handlers.end() ) {
+ i->second(json_data);
+ }
+ }
}
/**