summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kutsan <AKutsan@luxoft.com>2016-08-29 17:18:46 +0300
committerAlexander Kutsan <AKutsan@luxoft.com>2016-08-29 17:18:46 +0300
commit6869314b3d1e318fa92f6559326bd5bcfa7d47f0 (patch)
tree3095b3d49121fef4f48fe0f54301c70a597c3f78
parentd73e6dc8724c5799fae14efd4dcb214af74e4904 (diff)
downloadsdl_core-6869314b3d1e318fa92f6559326bd5bcfa7d47f0.tar.gz
Make code appropriate to Google coding style
Style guide : https://google.github.io/styleguide/cppguide.html
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h3
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_press_notification.cc15
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc29
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc42
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc1
-rw-r--r--src/components/utils/src/threads/posix_thread.cc2
7 files changed, 52 insertions, 49 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
index b0a2ee05d1..dc7f9fb755 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
@@ -87,8 +87,7 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
private:
smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification(
- const uint32_t connection_key,
- ApplicationSharedPtr app);
+ const uint32_t connection_key, ApplicationSharedPtr app);
/**
* @brief Sends OnAppRegistered notification to HMI
diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
index 2f64e2f850..64043d2a88 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
@@ -57,7 +57,7 @@ void OnButtonEventNotification::Run() {
const bool is_app_id_exists =
(*message_)[strings::msg_params].keyExists(strings::app_id);
const ApplicationSharedPtr app = application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
@@ -99,7 +99,8 @@ void OnButtonEventNotification::Run() {
const std::vector<ApplicationSharedPtr>& subscribed_apps =
application_manager_.applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribed_apps.begin();
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ subscribed_apps.begin();
for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
@@ -117,10 +118,10 @@ void OnButtonEventNotification::Run() {
}
// if "app_id" absent send notification only in HMI_FULL mode
if (is_app_id_exists || subscribed_app->IsFullscreen()) {
- SendButtonEvent(subscribed_app);
+ SendButtonEvent(subscribed_app);
+ }
}
}
-}
void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
if (!app) {
diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
index 56673f921d..fdf8b559bc 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
@@ -56,9 +56,8 @@ void OnButtonPressNotification::Run() {
const bool is_app_id_exists =
(*message_)[strings::msg_params].keyExists(strings::app_id);
- const ApplicationSharedPtr app =
- application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
+ const ApplicationSharedPtr app = application_manager_.application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
@@ -69,7 +68,8 @@ void OnButtonPressNotification::Run() {
}
// custom_button_id is mandatory for CUSTOM_BUTTON notification
- if (false == (*message_)[strings::msg_params].keyExists(
+ if (false ==
+ (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
LOG4CXX_ERROR(logger_,
"CUSTOM_BUTTON OnButtonPress without custom_button_id.");
@@ -99,7 +99,8 @@ void OnButtonPressNotification::Run() {
const std::vector<ApplicationSharedPtr>& subscribed_apps =
application_manager_.applications_by_button(btn_id);
- std::vector<ApplicationSharedPtr>::const_iterator it = subscribed_apps.begin();
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ subscribed_apps.begin();
for (; subscribed_apps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
@@ -117,10 +118,10 @@ void OnButtonPressNotification::Run() {
}
// if "app_id" absent send notification only in HMI_FULL mode
if (is_app_id_exists || subscribed_app->IsFullscreen()) {
- SendButtonPress(subscribed_app);
+ SendButtonPress(subscribed_app);
+ }
}
}
-}
void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
if (!app) {
diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
index b42a6dc702..b57490806c 100644
--- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
@@ -119,14 +119,14 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
}
std::string policy_table_string = std::string(message.begin(), message.end());
-
- /* The Content-Length to be sent in the HTTP Request header should be
- calculated before additional escape characters are added to the
- policy table string. The mobile proxy will remove the escape
+
+ /* The Content-Length to be sent in the HTTP Request header should be
+ calculated before additional escape characters are added to the
+ policy table string. The mobile proxy will remove the escape
characters after receiving this request. */
content_length = ParsePTString(policy_table_string);
-
+
if (0 > sprintf(size_str, "%zu", content_length)) {
memset(size_str, 0, sizeof(size_str));
}
@@ -152,7 +152,8 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
"\"Content_-Length\": " +
std::string(size_str) +
"},"
- "\"body\": \"" + policy_table_string +
+ "\"body\": \"" +
+ policy_table_string +
"\""
"}"
"}";
@@ -164,16 +165,18 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message) const {
logger_, "Header added: " << std::string(message.begin(), message.end()));
}
-size_t OnSystemRequestNotification::ParsePTString(std::string& pt_string) const{
+size_t OnSystemRequestNotification::ParsePTString(
+ std::string& pt_string) const {
std::string result;
- size_t length = pt_string.length();
+ size_t length = pt_string.length();
size_t result_length = length;
- result.reserve(length*2);
- for(size_t i=0;i<length;++i){
- if(pt_string[i]=='\"' || pt_string[i]=='\\'){
+ result.reserve(length * 2);
+ for (size_t i = 0; i < length; ++i) {
+ if (pt_string[i] == '\"' || pt_string[i] == '\\') {
result += '\\';
- } else if(pt_string[i] == '\n') {
- result_length--; // contentLength is adjusted when this character is not copied to result.
+ } else if (pt_string[i] == '\n') {
+ result_length--; // contentLength is adjusted when this character is not
+ // copied to result.
continue;
}
result += pt_string[i];
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
index a49ca6d3e7..e9f6db05b2 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc
@@ -77,18 +77,17 @@ mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) {
}
std::string AppHMITypeToString(mobile_apis::AppHMIType::eType type) {
- const std::map<mobile_apis::AppHMIType::eType, std::string> app_hmi_type_map = {
- {mobile_apis::AppHMIType::DEFAULT, "DEFAULT"},
- {mobile_apis::AppHMIType::COMMUNICATION, "COMMUNICATION"},
- {mobile_apis::AppHMIType::MEDIA, "MEDIA"},
- {mobile_apis::AppHMIType::MESSAGING, "MESSAGING"},
- {mobile_apis::AppHMIType::NAVIGATION, "NAVIGATION"},
- {mobile_apis::AppHMIType::INFORMATION, "INFORMATION"},
- {mobile_apis::AppHMIType::SOCIAL, "SOCIAL"},
- {mobile_apis::AppHMIType::BACKGROUND_PROCESS, "BACKGROUND_PROCESS"},
- {mobile_apis::AppHMIType::TESTING, "TESTING"},
- {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}
- };
+ const std::map<mobile_apis::AppHMIType::eType, std::string> app_hmi_type_map =
+ {{mobile_apis::AppHMIType::DEFAULT, "DEFAULT"},
+ {mobile_apis::AppHMIType::COMMUNICATION, "COMMUNICATION"},
+ {mobile_apis::AppHMIType::MEDIA, "MEDIA"},
+ {mobile_apis::AppHMIType::MESSAGING, "MESSAGING"},
+ {mobile_apis::AppHMIType::NAVIGATION, "NAVIGATION"},
+ {mobile_apis::AppHMIType::INFORMATION, "INFORMATION"},
+ {mobile_apis::AppHMIType::SOCIAL, "SOCIAL"},
+ {mobile_apis::AppHMIType::BACKGROUND_PROCESS, "BACKGROUND_PROCESS"},
+ {mobile_apis::AppHMIType::TESTING, "TESTING"},
+ {mobile_apis::AppHMIType::SYSTEM, "SYSTEM"}};
std::map<mobile_apis::AppHMIType::eType, std::string>::const_iterator iter =
app_hmi_type_map.find(type);
@@ -120,11 +119,11 @@ struct CheckMissedTypes {
std::string app_type_str = AppHMITypeToString(
static_cast<mobile_apis::AppHMIType::eType>(value.asInt()));
if (!app_type_str.empty()) {
- policy::StringArray::const_iterator it = policy_app_types_.begin();
- policy::StringArray::const_iterator it_end = policy_app_types_.end();
- for (; it != it_end; ++it) {
- if (app_type_str == *it) {
- return true;
+ policy::StringArray::const_iterator it = policy_app_types_.begin();
+ policy::StringArray::const_iterator it_end = policy_app_types_.end();
+ for (; it != it_end; ++it) {
+ if (app_type_str == *it) {
+ return true;
}
}
}
@@ -336,13 +335,14 @@ void RegisterAppInterfaceRequest::Run() {
GetPolicyHandler().SetDeviceInfo(device_mac, device_info);
SendRegisterAppInterfaceResponseToMobile();
- smart_objects::SmartObjectSPtr so = GetLockScreenIconUrlNotification(connection_key(), application);
+ smart_objects::SmartObjectSPtr so =
+ GetLockScreenIconUrlNotification(connection_key(), application);
application_manager_.ManageMobileCommand(so, commands::Command::ORIGIN_SDL);
}
-smart_objects::SmartObjectSPtr RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
- const uint32_t connection_key,
- ApplicationSharedPtr app) {
+smart_objects::SmartObjectSPtr
+RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification(
+ const uint32_t connection_key, ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr());
smart_objects::SmartObjectSPtr message =
utils::MakeShared<smart_objects::SmartObject>(
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 6070de641b..cf312acc6d 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1184,7 +1184,6 @@ std::string PolicyHandler::GetLockScreenIconUrl() const {
return policy_manager_->GetLockScreenIconUrl();
}
-
void PolicyHandler::ResetRetrySequence() {
POLICY_LIB_CHECK_VOID();
policy_manager_->ResetRetrySequence();
diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc
index 5118e5291b..51e59fa108 100644
--- a/src/components/utils/src/threads/posix_thread.cc
+++ b/src/components/utils/src/threads/posix_thread.cc
@@ -288,7 +288,7 @@ Thread::~Thread() {
join();
// in some platforms pthread_join behaviour is undefined when thread is
// not created(pthread_create) and call pthread_join.
- if(handle_) {
+ if (handle_) {
pthread_join(handle_, NULL);
}
}