1 #include <appcore-efl.h>
2 #include <Elementary.h>
7 #include <ico_dbus_amb_efl.h>
10 #include "logresult.h"
12 void notifyvalue(const char *objectname, const char *property, dbus_type type, union dbus_value_variant value, int sequence, struct timeval tv, void *user_data) {
13 enum ClientType cltype = CLIENT_APP;
14 enum CommandType cotype = CMDTYPE_NOTIFY;
15 LogResult *logger = reinterpret_cast<LogResult*>(user_data);
18 logger->PutOut(cltype, cotype, std::string(property), value.yval, tv);
20 case DBUS_TYPE_BOOLEAN :
22 logger->PutOut(cltype, cotype, std::string(property), true, tv);
25 logger->PutOut(cltype, cotype, std::string(property), false, tv);
28 case DBUS_TYPE_INT16 :
29 logger->PutOut(cltype, cotype, std::string(property), value.i16val, tv);
31 case DBUS_TYPE_UINT16 :
32 logger->PutOut(cltype, cotype, std::string(property), value.ui16val, tv);
34 case DBUS_TYPE_INT32 :
35 logger->PutOut(cltype, cotype, std::string(property), value.i32val, tv);
37 case DBUS_TYPE_UINT32 :
38 logger->PutOut(cltype, cotype, std::string(property), value.ui32val, tv);
40 case DBUS_TYPE_DOUBLE :
41 logger->PutOut(cltype, cotype, std::string(property), value.dval, tv);
43 case DBUS_TYPE_STRING :
44 logger->PutOut(cltype, cotype, std::string(property), value.sval, tv);
52 EAPI int elm_main(int argc, char *argv[]) {
54 std::string configpath = "/etc/ambd/AMBformat.conf";
55 while ((ret = getopt(argc, argv, "c:")) != -1) {
58 configpath = std::string(optarg);
65 struct appcore_ops ops;
73 assert(ico_dbus_amb_start() == 0);
76 if (!config.readConfig(configpath)) {
77 std::cerr << "Can't read VIC-Plugin config file." << std::endl;
81 std::vector<VehicleInfoDefine> vehicleinfolist =config.getVehicleInfoConfig();
84 auto itr_end = vehicleinfolist.end();
85 for (auto itr = vehicleinfolist.begin(); itr != itr_end; itr++) {
86 auto itr2_end = (*itr).status.end();
87 for (auto itr2 = (*itr).status.begin(); itr2 != itr2_end; itr2++) {
88 std::cerr << "dbusObjectName = " << (*itr2).dbusObjectName << ", dbusPropertyName = " << (*itr2).dbusPropertyName << std::endl;
89 switch ((*itr2).type) {
91 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT32, notifyvalue, &logger);
95 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_DOUBLE, notifyvalue, &logger);
99 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BYTE, notifyvalue, &logger);
103 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT16, notifyvalue, &logger);
107 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT16, notifyvalue, &logger);
111 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT32, notifyvalue, &logger);
115 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_INT64, notifyvalue, &logger);
119 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_UINT64, notifyvalue, &logger);
123 ico_dbus_amb_subscribe((*itr2).dbusObjectName.c_str(), (*itr2).dbusPropertyName.c_str(), 0, DBUS_TYPE_BOOLEAN, notifyvalue, &logger);
133 appcore_efl_main("org.tizen.ico.testdbus", &argc, &argv, &ops);
135 assert(ico_dbus_amb_end() == 0);