summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Byrne <jack@livio.io>2015-08-28 16:09:52 -0400
committerJack Byrne <jack@livio.io>2015-08-28 16:09:52 -0400
commitd7f3cc3e8a847f16b0a70359842ae31d175aec5f (patch)
tree9d6b7519ede02a17cab9f010a58929ad5b3e1c9d
parentfeb79e262c6355a6a7d5b44e301a18bedf2d4160 (diff)
downloadsmartdevicelink-hotfix/change-device-info-to-string.tar.gz
Changed device_info id to string and mac_addresshotfix/change-device-info-to-string
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h2
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc10
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc3
-rw-r--r--src/components/application_manager/src/message_helper.cc8
-rw-r--r--src/components/interfaces/HMI_API.xml2
-rw-r--r--src/components/interfaces/QT_HMI_API.xml2
7 files changed, 17 insertions, 12 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index 0046b4bf4..5c5e29e06 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -343,7 +343,7 @@ class ApplicationManagerImpl : public ApplicationManager,
*/
mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app);
- void ConnectToDevice(uint32_t id);
+ void ConnectToDevice(const std::string& device_mac);
void OnHMIStartedCooperation();
/*
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index b8ba76541..6ffa7e233 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -542,14 +542,20 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
return result;
}
-void ApplicationManagerImpl::ConnectToDevice(uint32_t id) {
+void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
// TODO(VS): Call function from ConnectionHandler
if (!connection_handler_) {
LOG4CXX_WARN(logger_, "Connection handler is not set.");
return;
}
- connection_handler_->ConnectToDevice(id);
+ connection_handler::DeviceHandle handle;
+ if (!connection_handler_->GetDeviceID(device_mac, &handle) ) {
+ LOG4CXX_ERROR(logger_, "Attempt to connect to invalid device with mac:"
+ << device_mac );
+ return;
+ }
+ connection_handler_->ConnectToDevice(handle);
}
void ApplicationManagerImpl::OnHMIStartedCooperation() {
diff --git a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
index 5d73c7b80..441538bee 100644
--- a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
@@ -50,7 +50,7 @@ void OnDeviceChosenNotification::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::device_info)) {
ApplicationManagerImpl::instance()->ConnectToDevice(
(*message_)[strings::msg_params][strings::device_info][strings::id]
- .asInt());
+ .asString());
}
}
diff --git a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
index fbb2bcfe9..b41eb6b86 100644
--- a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
@@ -95,8 +95,7 @@ void OnDeviceStateChangedNotification::Run() {
.asString();
if (device_id.empty()) {
if ((*message_)[strings::msg_params].keyExists("deviceId")) {
- device_id = MessageHelper::GetDeviceMacAddressForHandle(
- (*message_)[strings::msg_params]["deviceId"]["id"].asInt());
+ device_id = (*message_)[strings::msg_params]["deviceId"]["id"].asString();
}
} else {
// Policy uses hashed MAC address as device_id
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
index 2fd6d9f74..11bd6afda 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper.cc
@@ -335,7 +335,7 @@ void MessageHelper::SendOnAppRegisteredNotificationToHMI(
<< application_impl.device());
}
device_info[strings::name] = device_name;
- device_info[strings::id] = application_impl.device();
+ device_info[strings::id] = mac_address;
const policy::DeviceConsent device_consent =
policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
@@ -1320,7 +1320,7 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
output[strings::device_info] = smart_objects::SmartObject(smart_objects::SmartType_Map);
output[strings::device_info][strings::name] = device_name;
- output[strings::device_info][strings::id] = app->device();
+ output[strings::device_info][strings::id] = mac_address;
const policy::DeviceConsent device_consent =
policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
output[strings::device_info][strings::isSDLAllowed] =
@@ -1537,7 +1537,7 @@ void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissio
(*message)[strings::msg_params]["device"]["name"] = permissions.deviceInfo
.device_name;
(*message)[strings::msg_params]["device"]["id"] = permissions.deviceInfo
- .device_handle;
+ .device_mac_address;
}
(*message)[strings::msg_params]["isAppRevoked"] = permissions.appRevoked;
@@ -1577,7 +1577,7 @@ void MessageHelper::SendOnSDLConsentNeeded(
(*message)[strings::params][strings::message_type] =
MessageType::kNotification;
- (*message)[strings::msg_params]["device"]["id"] = device_info.device_handle;
+ (*message)[strings::msg_params]["device"]["id"] = device_info.device_mac_address;
(*message)[strings::msg_params]["device"]["name"] = device_info.device_name;
ApplicationManagerImpl::instance()->ManageHMICommand(message);
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 0aae26f30..0f00117b1 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -1302,7 +1302,7 @@
<param name="name" type="String" mandatory="true">
<description>The name of the device connected.</description>
</param>
- <param name="id" type="Integer" mandatory="true">
+ <param name="id" type="String" mandatory="true">
<description>The ID of the device connected</description>
</param>
<param name="transportType" type="Common.TransportType" mandatory="false">
diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml
index 6db4ec838..eab9edb86 100644
--- a/src/components/interfaces/QT_HMI_API.xml
+++ b/src/components/interfaces/QT_HMI_API.xml
@@ -1114,7 +1114,7 @@
<param name="name" type="String" mandatory="true">
<description>The name of the device connected.</description>
</param>
- <param name="id" type="Integer" mandatory="true">
+ <param name="id" type="String" mandatory="true">
<description>The ID of the device connected</description>
</param>
<param name="transportType" type="Common.TransportType" mandatory="false">