diff options
author | Kevron Rees <kevron.m.rees@intel.com> | 2014-12-09 15:26:21 -0800 |
---|---|---|
committer | Kevron Rees <kevron.m.rees@intel.com> | 2014-12-09 15:26:21 -0800 |
commit | 85633d91650867e1b8c7b09c4fbec76897bf0cba (patch) | |
tree | b67072c224dfec76d12f993c87275be6d2551125 | |
parent | 957968c985209841509ed538233aefb552ebb797 (diff) | |
download | automotive-message-broker-85633d91650867e1b8c7b09c4fbec76897bf0cba.tar.gz |
fixed gvariant creation for set
-rw-r--r-- | xwalk/CMakeLists.txt | 4 | ||||
-rw-r--r-- | xwalk/vehicle.cc | 19 | ||||
-rw-r--r-- | xwalk/vehicle_api.js | 6 |
3 files changed, 17 insertions, 12 deletions
diff --git a/xwalk/CMakeLists.txt b/xwalk/CMakeLists.txt index 3704e2b7..fb96843f 100644 --- a/xwalk/CMakeLists.txt +++ b/xwalk/CMakeLists.txt @@ -2,9 +2,9 @@ if(xwalk_vehicle_extension) pkg_check_modules(gio REQUIRED gio-2.0) -set(vehicle_api_headers vehicle.h vehicle_instance.h vehicle_extension.h common/extension.h picojson.h common/utils.h common/virtual_fs.h +set(vehicle_api_headers vehicle.h vehicle_instance.h vehicle_extension.h common/extension.h common/picojson.h common/utils.h common/virtual_fs.h common/XW_Extension_EntryPoints.h common/XW_Extension.h common/XW_Permissions.h common/XW_Extension_Runtime.h common/XW_Extension_SyncMessage.h) -set(vehicle_api_sources vehicle.cc vehicle_extension.cc vehicle_instance.cc common/extension.cc) +set(vehicle_api_sources vehicle.cc vehicle_extension.cc vehicle_instance.cc common/extension.cc common/picojson.h) include_directories(${include_dirs} ${CMAKE_CURRENT_SOURCE_DIR}/) diff --git a/xwalk/vehicle.cc b/xwalk/vehicle.cc index 5256a392..60948737 100644 --- a/xwalk/vehicle.cc +++ b/xwalk/vehicle.cc @@ -99,22 +99,23 @@ picojson::value GetBasic(GVariant* value) { GVariant* GetBasic(picojson::value value, const std::string& type) { GVariant* v = nullptr; + DebugOut() << "Getting GVariant value for signature " << type << " value: " << value.to_str() << endl; + if (type == "i") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (int32_t)value.get<double>()); + DebugOut() << "Variant value: " << g_variant_get_int32(v) << endl; } else if (type == "d") { v = g_variant_new(type.c_str(), value.get<double>()); } else if (type == "q") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (uint16_t)value.get<double>()); } else if (type == "n") { - v = g_variant_new(type.c_str(), value.get<double>()); - } else if (type == "y") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (int16_t)value.get<double>()); } else if (type == "u") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (uint32_t)value.get<double>()); } else if (type == "x") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (int64_t)value.get<double>()); } else if (type == "t") { - v = g_variant_new(type.c_str(), value.get<double>()); + v = g_variant_new(type.c_str(), (uint64_t)value.get<double>()); } else if (type == "b") { v = g_variant_new(type.c_str(), value.get<bool>()); } else if (type == "s") { @@ -682,6 +683,8 @@ void Vehicle::Set(const std::string &object_name, picojson::object value, GError* set_error = nullptr; + DebugOut() << "Trying to set " << attribute << " to " << itr.second.to_str() << endl; + g_dbus_proxy_call_sync(properties_proxy.get(), "Set", g_variant_new("(ssv)", interface_name.c_str(), diff --git a/xwalk/vehicle_api.js b/xwalk/vehicle_api.js index 67e6e7d0..2212834e 100644 --- a/xwalk/vehicle_api.js +++ b/xwalk/vehicle_api.js @@ -151,8 +151,6 @@ function isAvailable(obj, attName) var reply = extension.internal.sendSyncMessage(JSON.stringify(msg)); - - if (reply === "true") { return "available"; } else { @@ -173,6 +171,7 @@ function createPromise(msg) { msg.asyncCallId = next_async_call_id; extension.postMessage(JSON.stringify(msg)); ++next_async_call_id; + return promise; } @@ -353,7 +352,10 @@ _defineVehicleSignalProperty(exports, 'door'); _defineVehicleSignalProperty(exports, 'childSafetyLock'); _defineVehicleSignalProperty(exports, 'seat'); +/// Climate attributes: _defineVehicleSignalProperty(exports, 'temperature'); +_defineVehicleSignalProperty(exports, 'rainSensor'); +_defineVehicleSignalProperty(exports, 'wiperStatus'); _defineVehicleSignalProperty(exports, 'climateControl'); _defineVehicleSignalProperty(exports, 'defrost'); |