1 #include <appcore-efl.h>
2 #include <Elementary.h>
6 #include <ico_dbus_amb_efl.h>
11 void getvalue(const char *objectname, const char *property, dbus_type type, union dbus_value_variant value, void *user_data) {
12 enum ClientType cltype = CLIENT_APP;
13 enum CommandType cotype = CMDTYPE_GET;
14 LogResult *logger = reinterpret_cast<LogResult*>(user_data);
17 logger->PutOut(cltype, cotype, std::string(property), value.yval);
19 case DBUS_TYPE_BOOLEAN :
21 logger->PutOut(cltype, cotype, std::string(property), true);
24 logger->PutOut(cltype, cotype, std::string(property), false);
27 case DBUS_TYPE_INT16 :
28 logger->PutOut(cltype, cotype, std::string(property), value.i16val);
30 case DBUS_TYPE_UINT16 :
31 logger->PutOut(cltype, cotype, std::string(property), value.ui16val);
33 case DBUS_TYPE_INT32 :
34 logger->PutOut(cltype, cotype, std::string(property), value.i32val);
36 case DBUS_TYPE_UINT32 :
37 logger->PutOut(cltype, cotype, std::string(property), value.ui32val);
39 case DBUS_TYPE_DOUBLE :
40 logger->PutOut(cltype, cotype, std::string(property), value.dval);
42 case DBUS_TYPE_STRING :
43 logger->PutOut(cltype, cotype, std::string(property), value.sval);
51 EAPI int elm_main(int argc, char *argv[]) {
53 std::string configpath = "/etc/ambd/AMBformat.conf";
54 while ((ret = getopt(argc, argv, "c:")) != -1) {
57 configpath = std::string(optarg);
64 struct appcore_ops ops;
72 assert(ico_dbus_amb_start() == 0);
75 if (!config.readConfig(configpath)) {
76 std::cerr << "Can't read VIC-Plugin config file." << std::endl;
80 std::vector<VehicleInfoDefine> vehicleinfolist =config.getVehicleInfoConfig();
83 auto itr_end = vehicleinfolist.end();
84 for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
85 auto itr2_end = (*itr).status.end();
86 for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
87 switch ((*itr2).type) {
89 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT32, getvalue, &logger);
93 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_DOUBLE, getvalue, &logger);
97 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BYTE, getvalue, &logger);
101 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT16, getvalue, &logger);
105 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT16, getvalue, &logger);
109 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT32, getvalue, &logger);
113 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT64, getvalue, &logger);
117 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT64, getvalue, &logger);
121 ico_dbus_amb_get((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BOOLEAN, getvalue, &logger);
131 appcore_efl_main("org.tizen.ico.testdbus", &argc, &argv, &ops);
133 assert(ico_dbus_amb_end() == 0);