diff options
author | Kozoriz <kozorizandriy@gmail.com> | 2016-04-26 12:41:54 +0300 |
---|---|---|
committer | Kozoriz <kozorizandriy@gmail.com> | 2016-04-26 15:50:21 +0300 |
commit | 4ecdb2a83871784f34430ed09d5ef6a2c0855506 (patch) | |
tree | dc36b449e5d32ac3e493e16865cf9d88d9991817 /src/components/application_manager/src | |
parent | cf58bb97d09c536dce3b492d1517da0b837bc8eb (diff) | |
download | sdl_core-4ecdb2a83871784f34430ed09d5ef6a2c0855506.tar.gz |
Format all code in project
Formated all code in appMain, components, plugins to correct coding-style
Used clang-format-3.6
Used 2 commands :
find src/appMain/ -name "*.h" -o -name "*.cc" -o -name "*.hpp" -o -name "*.cpp" | xargs clang-format-3.6 -i -style=file
find src/components/ -name "*.h" -o -name "*.cc" -o -name "*.hpp" -o -name "*.cpp" | xargs clang-format-3.6 -i -style=file
find src/plugins/ -name "*.h" -o -name "*.cc" -o -name "*.hpp" -o -name "*.cpp" | xargs clang-format-3.6 -i -style=file
Diffstat (limited to 'src/components/application_manager/src')
10 files changed, 207 insertions, 211 deletions
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc index 19612470b7..c98b7ec028 100644 --- a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc +++ b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc @@ -37,11 +37,9 @@ namespace application_manager { namespace commands { UISetIconRequest::UISetIconRequest(const MessageSharedPtr& message) - : RequestToHMI(message) { -} + : RequestToHMI(message) {} -UISetIconRequest::~UISetIconRequest() { -} +UISetIconRequest::~UISetIconRequest() {} void UISetIconRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); @@ -52,4 +50,3 @@ void UISetIconRequest::Run() { } // namespace commands } // namespace application_manager - diff --git a/src/components/application_manager/src/commands/pending.cc b/src/components/application_manager/src/commands/pending.cc index 0c04464af3..c410a84fa5 100644 --- a/src/components/application_manager/src/commands/pending.cc +++ b/src/components/application_manager/src/commands/pending.cc @@ -37,13 +37,9 @@ namespace application_manager { namespace commands { +Pending::Pending() : last_(hmi_apis::FunctionID::INVALID_ENUM) {} -Pending::Pending() -: last_(hmi_apis::FunctionID::INVALID_ENUM) { -} - -Pending::~Pending() { -} +Pending::~Pending() {} void Pending::Add(hmi_apis::FunctionID::eType id) { sync_primitives::AutoLock L(lock_); diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc index bb500687dd..a7c887d348 100644 --- a/src/components/application_manager/src/message.cc +++ b/src/components/application_manager/src/message.cc @@ -56,19 +56,17 @@ MessageType MessageTypeFromRpcType(protocol_handler::RpcType rpc_type) { } Message::Message(protocol_handler::MessagePriority priority) - : function_id_(0), - correlation_id_(0), - type_(kUnknownType), - priority_(priority), - connection_key_(0), - binary_data_(NULL), - data_size_(0), - payload_size_(0), - version_(kUnknownProtocol) { -} - -Message::Message(const Message& message) - : priority_(message.priority_) { + : function_id_(0) + , correlation_id_(0) + , type_(kUnknownType) + , priority_(priority) + , connection_key_(0) + , binary_data_(NULL) + , data_size_(0) + , payload_size_(0) + , version_(kUnknownProtocol) {} + +Message::Message(const Message& message) : priority_(message.priority_) { *this = message; } @@ -99,13 +97,13 @@ bool Message::operator==(const Message& message) { bool data_size = data_size_ == message.data_size_; bool payload_size = payload_size_ == message.payload_size_; - - bool binary_data = std::equal(binary_data_->begin(), binary_data_->end(), + bool binary_data = std::equal(binary_data_->begin(), + binary_data_->end(), message.binary_data_->begin(), BinaryDataPredicate); - return function_id && correlation_id && connection_key && type && binary_data - && json_message && version && data_size && payload_size; + return function_id && correlation_id && connection_key && type && + binary_data && json_message && version && data_size && payload_size; } Message::~Message() { @@ -191,7 +189,7 @@ void Message::set_protocol_version(ProtocolVersion version) { version_ = version; } -const smart_objects::SmartObject &Message::smart_object() const { +const smart_objects::SmartObject& Message::smart_object() const { return smart_object_; } diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index 226ff0da3f..09d9512b19 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -54,63 +54,67 @@ namespace application_manager { using protocol_handler::Extract; namespace { - typedef std::map<MessageType, std::string> MessageTypeMap; - MessageTypeMap messageTypes = { - std::make_pair(kRequest, "Request"), - std::make_pair(kResponse, "Response"), - std::make_pair(kNotification, "Notification") - }; +typedef std::map<MessageType, std::string> MessageTypeMap; +MessageTypeMap messageTypes = {std::make_pair(kRequest, "Request"), + std::make_pair(kResponse, "Response"), + std::make_pair(kNotification, "Notification")}; } CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") -application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocol( - const protocol_handler::RawMessagePtr message) { +application_manager::Message* +MobileMessageHandler::HandleIncomingMessageProtocol( + const protocol_handler::RawMessagePtr message) { DCHECK_OR_RETURN(message, NULL); application_manager::Message* out_message = NULL; switch (message->protocol_version()) { - case ProtocolVersion::kV1: - LOG4CXX_DEBUG(logger_, "Protocol version - V1"); - out_message = MobileMessageHandler::HandleIncomingMessageProtocolV1(message); - break; - case ProtocolVersion::kV2: - LOG4CXX_DEBUG(logger_, "Protocol version - V2"); - out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); - break; - case ProtocolVersion::kV3: - LOG4CXX_DEBUG(logger_, "Protocol version - V3"); - out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); - break; - case ProtocolVersion::kV4: - LOG4CXX_DEBUG(logger_, "Protocol version - V4"); - out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message); - break; - default: - LOG4CXX_WARN(logger_, "Can't recognise protocol version"); - out_message = NULL; - break; + case ProtocolVersion::kV1: + LOG4CXX_DEBUG(logger_, "Protocol version - V1"); + out_message = + MobileMessageHandler::HandleIncomingMessageProtocolV1(message); + break; + case ProtocolVersion::kV2: + LOG4CXX_DEBUG(logger_, "Protocol version - V2"); + out_message = + MobileMessageHandler::HandleIncomingMessageProtocolV2(message); + break; + case ProtocolVersion::kV3: + LOG4CXX_DEBUG(logger_, "Protocol version - V3"); + out_message = + MobileMessageHandler::HandleIncomingMessageProtocolV2(message); + break; + case ProtocolVersion::kV4: + LOG4CXX_DEBUG(logger_, "Protocol version - V4"); + out_message = + MobileMessageHandler::HandleIncomingMessageProtocolV2(message); + break; + default: + LOG4CXX_WARN(logger_, "Can't recognise protocol version"); + out_message = NULL; + break; } if (out_message == NULL) { - LOG4CXX_WARN(logger_, "Message is NULL"); - return NULL; + LOG4CXX_WARN(logger_, "Message is NULL"); + return NULL; } - LOG4CXX_DEBUG(logger_, "Incoming RPC_INFO: " << - (out_message->connection_key() >> 16) <<", "<< - messageTypes[out_message->type()] <<", "<< - out_message->function_id() << ", " << - out_message->correlation_id() << ", " << - out_message->json_message()); + LOG4CXX_DEBUG(logger_, + "Incoming RPC_INFO: " << (out_message->connection_key() >> 16) + << ", " + << messageTypes[out_message->type()] + << ", " << out_message->function_id() + << ", " << out_message->correlation_id() + << ", " << out_message->json_message()); return out_message; } -protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocol( - const MobileMessage& message) { - - LOG4CXX_DEBUG(logger_, "Outgoing RPC_INFO: " << - (message->connection_key() >> 16) <<", "<< - messageTypes[message->type()]<<", "<< - message->function_id() << ", " << - message->correlation_id() << ", " << - message->json_message()); +protocol_handler::RawMessage* +MobileMessageHandler::HandleOutgoingMessageProtocol( + const MobileMessage& message) { + LOG4CXX_DEBUG(logger_, + "Outgoing RPC_INFO: " << (message->connection_key() >> 16) + << ", " << messageTypes[message->type()] + << ", " << message->function_id() << ", " + << message->correlation_id() << ", " + << message->json_message()); if (message->protocol_version() == application_manager::kV1) { return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message); @@ -123,16 +127,14 @@ protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtoco return NULL; } - application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV1( - const ::protocol_handler::RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_AUTO_TRACE(logger_); application_manager::Message* outgoing_message = - new application_manager::Message( - protocol_handler::MessagePriority::FromServiceType( - message->service_type()) - ); + new application_manager::Message( + protocol_handler::MessagePriority::FromServiceType( + message->service_type())); if (!message) { NOTREACHED(); return NULL; @@ -140,11 +142,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( outgoing_message->set_connection_key(message->connection_key()); outgoing_message->set_protocol_version( - static_cast<application_manager::ProtocolVersion>(message - ->protocol_version())); - outgoing_message->set_json_message( - std::string(reinterpret_cast<const char*>(message->data()), - message->data_size())); + static_cast<application_manager::ProtocolVersion>( + message->protocol_version())); + outgoing_message->set_json_message(std::string( + reinterpret_cast<const char*>(message->data()), message->data_size())); if (outgoing_message->json_message().empty()) { delete outgoing_message; @@ -156,18 +157,18 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1( application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocolV2( - const ::protocol_handler::RawMessagePtr message) { + const ::protocol_handler::RawMessagePtr message) { LOG4CXX_AUTO_TRACE(logger_); utils::BitStream message_bytestream(message->data(), message->data_size()); protocol_handler::ProtocolPayloadV2 payload; - protocol_handler::Extract(&message_bytestream, &payload, - message->data_size()); + protocol_handler::Extract( + &message_bytestream, &payload, message->data_size()); // Silently drop message if it wasn't parsed correctly if (message_bytestream.IsBad()) { - LOG4CXX_WARN(logger_, - "Drop ill-formed message from mobile, partially parsed: " - << payload); + LOG4CXX_WARN( + logger_, + "Drop ill-formed message from mobile, partially parsed: " << payload); return NULL; } @@ -183,8 +184,8 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( outgoing_message->set_correlation_id(int32_t(payload.header.correlation_id)); outgoing_message->set_connection_key(message->connection_key()); outgoing_message->set_protocol_version( - static_cast<application_manager::ProtocolVersion>(message - ->protocol_version())); + static_cast<application_manager::ProtocolVersion>( + message->protocol_version())); outgoing_message->set_data_size(message->data_size()); outgoing_message->set_payload_size(message->payload_size()); @@ -197,12 +198,11 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV1( - const MobileMessage& message) { + const MobileMessage& message) { LOG4CXX_AUTO_TRACE(logger_); std::string messageString = message->json_message(); if (messageString.length() == 0) { - LOG4CXX_WARN(logger_, - "Drop ill-formed message from mobile"); + LOG4CXX_WARN(logger_, "Drop ill-formed message from mobile"); return NULL; } @@ -210,16 +210,16 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1( memcpy(rawMessage, messageString.c_str(), messageString.length() + 1); protocol_handler::RawMessage* result = new protocol_handler::RawMessage( - message->connection_key(), 1, rawMessage, messageString.length() + 1); + message->connection_key(), 1, rawMessage, messageString.length() + 1); - delete [] rawMessage; + delete[] rawMessage; return result; } protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocolV2( - const MobileMessage& message) { + const MobileMessage& message) { LOG4CXX_AUTO_TRACE(logger_); if (message->json_message().length() == 0) { LOG4CXX_ERROR(logger_, "json string is empty."); @@ -269,10 +269,10 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2( dataForSending[offset++] = jsonSize; memcpy(dataForSending + offset, message->json_message().c_str(), jsonSize); - + // Default the service type to RPC Service - uint8_t type = 0x07; - + uint8_t type = 0x07; + if (message->has_binary_data()) { // Change the service type to Hybrid Service type = 0x0F; @@ -284,13 +284,13 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV2( } protocol_handler::RawMessage* msgToProtocolHandler = - new protocol_handler::RawMessage(message->connection_key(), - message->protocol_version(), - dataForSending, - dataForSendingSize, - type); + new protocol_handler::RawMessage(message->connection_key(), + message->protocol_version(), + dataForSending, + dataForSendingSize, + type); - delete [] dataForSending; + delete[] dataForSending; return msgToProtocolHandler; } diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc index 4fe765688f..11c1dc9a91 100644 --- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc +++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc @@ -76,28 +76,28 @@ StatisticsDelegate::StatisticsDelegate(PolicyHandler& policy_handler, , timespan_seconds_(timespan_seconds) , policy_handler_(policy_handler) {} - void StatisticsDelegate::threadMain() { - LOG4CXX_AUTO_TRACE(logger_); - switch (type_) { - case INCREMENT_GLOBAL: - policy_handler_.Increment(global_counter_); - break; - case INCREMENT_APP: - policy_handler_.Increment(app_id_, app_counter_); - break; - case SET: - policy_handler_.Set(app_id_, app_info_, value_); - break; - case ADD: - policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_); - break; - default: - LOG4CXX_ERROR(logger_,"Unknown statistics operator"); - break; - } +void StatisticsDelegate::threadMain() { + LOG4CXX_AUTO_TRACE(logger_); + switch (type_) { + case INCREMENT_GLOBAL: + policy_handler_.Increment(global_counter_); + break; + case INCREMENT_APP: + policy_handler_.Increment(app_id_, app_counter_); + break; + case SET: + policy_handler_.Set(app_id_, app_info_, value_); + break; + case ADD: + policy_handler_.Add(app_id_, stop_watch_, timespan_seconds_); + break; + default: + LOG4CXX_ERROR(logger_, "Unknown statistics operator"); + break; } +} - void StatisticsDelegate::exitThreadMain() { - // Do nothing - } -} // namespace policy +void StatisticsDelegate::exitThreadMain() { + // Do nothing +} +} // namespace policy diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc index e1b47a0d96..a88aef0cc1 100644 --- a/src/components/application_manager/src/policies/policy_retry_sequence.cc +++ b/src/components/application_manager/src/policies/policy_retry_sequence.cc @@ -42,8 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") RetrySequence::RetrySequence(PolicyHandler* const policy_handler) // TODO (Risk copy of PolicyHandler Pointer) - : policy_handler_(policy_handler) { -} + : policy_handler_(policy_handler) {} void RetrySequence::threadMain() { StartNextRetry(); @@ -54,8 +53,7 @@ void RetrySequence::StartNextRetry() { DCHECK(policy_handler_); // TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib - BinaryMessageSptr pt_snapshot = policy_handler_ - ->RequestPTUpdate(); + BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate(); if (pt_snapshot) { policy_handler_->SendMessageToSDK(*pt_snapshot); @@ -77,4 +75,3 @@ void RetrySequence::StartNextRetry() { } } // namespace policy - diff --git a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc index 5a01e28d6d..d1c6fafb07 100644 --- a/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc +++ b/src/components/application_manager/src/policies/pt_exchange_handler_impl.cc @@ -42,8 +42,9 @@ namespace policy { CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler") PTExchangeHandlerImpl::PTExchangeHandlerImpl(PolicyHandler* handler) - : policy_handler_(handler), - retry_sequence_(threads::CreateThread("RetrySequence", new RetrySequence(handler))) { + : policy_handler_(handler) + , retry_sequence_( + threads::CreateThread("RetrySequence", new RetrySequence(handler))) { DCHECK(policy_handler_); LOG4CXX_INFO(logger_, "Exchan created"); } @@ -59,7 +60,8 @@ void PTExchangeHandlerImpl::Start() { retry_sequence_->stop(); threads::DeleteThread(retry_sequence_); - retry_sequence_ = threads::CreateThread("RetrySequence", new RetrySequence(policy_handler_)); + retry_sequence_ = threads::CreateThread("RetrySequence", + new RetrySequence(policy_handler_)); if (policy_handler_) { policy_handler_->ResetRetrySequence(); diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 2eb412559f..80b18a53c6 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -44,47 +44,40 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController") uint32_t RequestInfo::HmiConnectoinKey = 0; -HMIRequestInfo::HMIRequestInfo( - RequestPtr request, - const uint64_t timeout_msec): - RequestInfo(request, HMIRequest, timeout_msec) { - correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectoinKey; +HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) + : RequestInfo(request, HMIRequest, timeout_msec) { + correlation_id_ = request_->correlation_id(); + app_id_ = RequestInfo::HmiConnectoinKey; } -HMIRequestInfo::HMIRequestInfo( - RequestPtr request, - const TimevalStruct &start_time, - const uint64_t timeout_msec): - RequestInfo(request, HMIRequest, start_time, timeout_msec) { - correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectoinKey; +HMIRequestInfo::HMIRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_msec) + : RequestInfo(request, HMIRequest, start_time, timeout_msec) { + correlation_id_ = request_->correlation_id(); + app_id_ = RequestInfo::HmiConnectoinKey; } -MobileRequestInfo::MobileRequestInfo( - RequestPtr request, - const uint64_t timeout_msec): - RequestInfo(request, MobileRequest, timeout_msec) { - correlation_id_ = request_.get()->correlation_id(); - app_id_ = request_.get()->connection_key(); +MobileRequestInfo::MobileRequestInfo(RequestPtr request, + const uint64_t timeout_msec) + : RequestInfo(request, MobileRequest, timeout_msec) { + correlation_id_ = request_.get()->correlation_id(); + app_id_ = request_.get()->connection_key(); } -MobileRequestInfo::MobileRequestInfo( - RequestPtr request, - const TimevalStruct &start_time, - const uint64_t timeout_msec): - RequestInfo(request, MobileRequest, start_time, timeout_msec) { - correlation_id_ = request_.get()->correlation_id(); - app_id_ = request_.get()->connection_key(); +MobileRequestInfo::MobileRequestInfo(RequestPtr request, + const TimevalStruct& start_time, + const uint64_t timeout_msec) + : RequestInfo(request, MobileRequest, start_time, timeout_msec) { + correlation_id_ = request_.get()->correlation_id(); + app_id_ = request_.get()->connection_key(); } RequestInfo::RequestInfo(RequestPtr request, const RequestInfo::RequestType requst_type, const TimevalStruct& start_time, - const uint64_t timeout_msec): - request_(request), - start_time_(start_time), - timeout_msec_(timeout_msec) { + const uint64_t timeout_msec) + : request_(request), start_time_(start_time), timeout_msec_(timeout_msec) { updateEndTime(); requst_type_ = requst_type; correlation_id_ = request_->correlation_id(); @@ -93,17 +86,18 @@ RequestInfo::RequestInfo(RequestPtr request, void application_manager::request_controller::RequestInfo::updateEndTime() { end_time_ = date_time::DateTime::getCurrentTime(); - date_time::DateTime::AddMilliseconds( end_time_, timeout_msec_ ); + date_time::DateTime::AddMilliseconds(end_time_, timeout_msec_); } -void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { +void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { timeout_msec_ = timeout_msec; updateEndTime(); } bool RequestInfo::isExpired() { TimevalStruct curr_time = date_time::DateTime::getCurrentTime(); - return date_time::DateTime::getmSecs(end_time_) <= date_time::DateTime::getmSecs(curr_time); + return date_time::DateTime::getmSecs(end_time_) <= + date_time::DateTime::getmSecs(curr_time); } uint64_t RequestInfo::hash() { @@ -114,7 +108,7 @@ uint64_t RequestInfo::GenerateHash(uint32_t var1, uint32_t var2) { uint64_t hash_result = 0; hash_result = var1; hash_result = hash_result << 32; - hash_result = hash_result | var2; + hash_result = hash_result | var2; return hash_result; } @@ -125,8 +119,10 @@ FakeRequestInfo::FakeRequestInfo(uint32_t app_id, uint32_t correaltion_id) { bool RequestInfoSet::Add(RequestInfoPtr request_info) { DCHECK_OR_RETURN(request_info, false); - LOG4CXX_DEBUG(logger_, "Add request app_id = " << request_info->app_id() - << "; corr_id = " << request_info->requestId()); + LOG4CXX_DEBUG( + logger_, + "Add request app_id = " << request_info->app_id() + << "; corr_id = " << request_info->requestId()); sync_primitives::AutoLock lock(this_lock_); CheckSetSizes(); const std::pair<HashSortedRequestInfoSet::iterator, bool>& insert_resilt = @@ -141,8 +137,10 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { CheckSetSizes(); return true; } else { - LOG4CXX_ERROR(logger_, "Request with app_id = " << request_info->app_id() - << "; corr_id " << request_info->requestId() << " Already exist "); + LOG4CXX_ERROR(logger_, + "Request with app_id = " + << request_info->app_id() << "; corr_id " + << request_info->requestId() << " Already exist "); } CheckSetSizes(); return false; @@ -160,7 +158,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, HashSortedRequestInfoSet::iterator it = hash_sorted_pending_requests_.find(request_info_for_search); if (it != hash_sorted_pending_requests_.end()) { - result = *it; + result = *it; } return result; } @@ -183,7 +181,7 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin(); while (it != time_sorted_pending_requests_.end()) { RequestInfoPtr tmp = *it; - if (0 == tmp ->timeout_msec()) { + if (0 == tmp->timeout_msec()) { ++it; } else { result = tmp; @@ -201,8 +199,7 @@ bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { } CheckSetSizes(); - size_t erased_count = - hash_sorted_pending_requests_.erase(request_info); + size_t erased_count = hash_sorted_pending_requests_.erase(request_info); DCHECK((erased_count <= 1)); if (1 == erased_count) { TimeSortedRequestInfoSet::iterator it = @@ -227,17 +224,17 @@ bool RequestInfoSet::RemoveRequest(const RequestInfoPtr request_info) { return Erase(request_info); } - -uint32_t RequestInfoSet::RemoveRequests(const RequestInfoSet::AppIdCompararator& filter) { +uint32_t RequestInfoSet::RemoveRequests( + const RequestInfoSet::AppIdCompararator& filter) { LOG4CXX_AUTO_TRACE(logger_); uint32_t erased = 0; sync_primitives::AutoLock lock(this_lock_); - HashSortedRequestInfoSet::iterator it = std::find_if( - hash_sorted_pending_requests_.begin(), - hash_sorted_pending_requests_.end(), - filter); - while (it != hash_sorted_pending_requests_.end()) { + HashSortedRequestInfoSet::iterator it = + std::find_if(hash_sorted_pending_requests_.begin(), + hash_sorted_pending_requests_.end(), + filter); + while (it != hash_sorted_pending_requests_.end()) { HashSortedRequestInfoSet::iterator to_erase = it++; Erase(*to_erase); it = std::find_if(it, hash_sorted_pending_requests_.end(), filter); @@ -247,15 +244,16 @@ uint32_t RequestInfoSet::RemoveRequests(const RequestInfoSet::AppIdCompararator& return erased; } - uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); - return RemoveRequests(AppIdCompararator(AppIdCompararator::Equal, connection_key)); + return RemoveRequests( + AppIdCompararator(AppIdCompararator::Equal, connection_key)); } uint32_t RequestInfoSet::RemoveMobileRequests() { LOG4CXX_AUTO_TRACE(logger_); - return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, RequestInfo::HmiConnectoinKey)); + return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, + RequestInfo::HmiConnectoinKey)); } const size_t RequestInfoSet::Size() { @@ -275,8 +273,7 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest( uint32_t app_time_scale, uint32_t max_request_per_time_scale) { LOG4CXX_AUTO_TRACE(logger_); - if (max_request_per_time_scale > 0 - && app_time_scale > 0) { + if (max_request_per_time_scale > 0 && app_time_scale > 0) { TimevalStruct end = date_time::DateTime::getCurrentTime(); TimevalStruct start = {0, 0}; start.tv_sec = end.tv_sec - app_time_scale; @@ -284,10 +281,13 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest( sync_primitives::AutoLock lock(this_lock_); TimeScale scale(start, end, app_id); const uint32_t count = std::count_if(time_sorted_pending_requests_.begin(), - time_sorted_pending_requests_.end(), scale); + time_sorted_pending_requests_.end(), + scale); if (count >= max_request_per_time_scale) { - LOG4CXX_WARN(logger_, "Processing requests count " << count << - " exceed application limit " << max_request_per_time_scale); + LOG4CXX_WARN(logger_, + "Processing requests count " << count + << " exceed application limit " + << max_request_per_time_scale); return false; } LOG4CXX_DEBUG(logger_, "Requests count " << count); @@ -297,13 +297,13 @@ bool RequestInfoSet::CheckTimeScaleMaxRequest( return true; } -bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eType hmi_level, +bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest( + mobile_apis::HMILevel::eType hmi_level, uint32_t app_id, uint32_t app_time_scale, uint32_t max_request_per_time_scale) { LOG4CXX_AUTO_TRACE(logger_); - if (max_request_per_time_scale > 0 && - app_time_scale > 0) { + if (max_request_per_time_scale > 0 && app_time_scale > 0) { TimevalStruct end = date_time::DateTime::getCurrentTime(); TimevalStruct start = {0, 0}; start.tv_sec = end.tv_sec - app_time_scale; @@ -311,11 +311,14 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eTy sync_primitives::AutoLock lock(this_lock_); HMILevelTimeScale scale(start, end, app_id, hmi_level); const uint32_t count = std::count_if(time_sorted_pending_requests_.begin(), - time_sorted_pending_requests_.end(), scale); + time_sorted_pending_requests_.end(), + scale); if (count >= max_request_per_time_scale) { - LOG4CXX_WARN(logger_, "Processing requests count " << count - << " exceed application limit " << max_request_per_time_scale - << " in hmi level " << hmi_level); + LOG4CXX_WARN(logger_, + "Processing requests count " + << count << " exceed application limit " + << max_request_per_time_scale << " in hmi level " + << hmi_level); return false; } LOG4CXX_DEBUG(logger_, "Requests count " << count); @@ -325,7 +328,8 @@ bool RequestInfoSet::CheckHMILevelTimeScaleMaxRequest(mobile_apis::HMILevel::eTy return true; } -bool RequestInfoSet::AppIdCompararator::operator()(const RequestInfoPtr value_compare) const { +bool RequestInfoSet::AppIdCompararator::operator()( + const RequestInfoPtr value_compare) const { switch (compare_type_) { case Equal: return value_compare->app_id() == app_id_; diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index d52f503536..a625b1f761 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -114,7 +114,7 @@ const char* start_time = "startTime"; const char* end_time = "endTime"; const char* hours = "hours"; const char* minutes = "minutes"; -const char* seconds = "seconds"; +const char* seconds = "seconds"; const char* update_mode = "updateMode"; const char* trigger_source = "triggerSource"; const char* hmi_level = "hmiLevel"; @@ -218,7 +218,7 @@ const char* sdl_version = "sdlVersion"; const char* system_software_version = "systemSoftwareVersion"; const char* priority = "priority"; -//resuming +// resuming const char* application_commands = "applicationCommands"; const char* application_submenus = "applicationSubMenus"; const char* application_choice_sets = "applicationChoiceSets"; @@ -280,7 +280,7 @@ const char* default_ = "default"; const char* languages = "languages"; const char* ttsName = "ttsName"; const char* vrSynonyms = "vrSynonyms"; -} // namespace json +} // namespace json namespace http_request { const char* httpRequest = "HTTPRequest"; @@ -296,7 +296,7 @@ const char* instance_follow_redirect = "InstanceFollowRedirect"; const char* charset = "charset"; const char* content_lenght = "Content_Lenght"; const char* GET = "GET"; -} // http_request +} // http_request namespace mobile_notification { const char* state = "state"; diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc index 9483703f37..42c48520e9 100644 --- a/src/components/application_manager/src/usage_statistics.cc +++ b/src/components/application_manager/src/usage_statistics.cc @@ -47,7 +47,8 @@ namespace { std::string LanguageIdToString(Language::eType lang_id) { const char* str; - const bool ok = EnumConversionHelper<Language::eType>::EnumToCString(lang_id, &str); + const bool ok = + EnumConversionHelper<Language::eType>::EnumToCString(lang_id, &str); return ok ? str : "unknown"; } @@ -73,9 +74,10 @@ UsageStatistics::UsageStatistics( time_in_hmi_state_sptr_->Start(SECONDS_HMI_NONE); } -UsageStatistics::UsageStatistics(const std::string& app_id, +UsageStatistics::UsageStatistics( + const std::string& app_id, utils::SharedPtr<StatisticsManager> statistics_manager, - AppStopwatch* time_in_hmi_state_ptr) + AppStopwatch* time_in_hmi_state_ptr) : time_in_hmi_state_sptr_(time_in_hmi_state_ptr) , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI) , app_registration_language_vui_(statistics_manager, app_id, LANGUAGE_VUI) |